systemd user service not found after reboot
up vote
3
down vote
favorite
I set up syncthing as a systemd user service on a 16.04 computer. Worked fine. Since I upgraded to 18.04 the service disappears upon reboot.
After rebooting, I see:
$ systemctl --user status syncthing.service
Unit syncthing.service could not be found.
And syncthing
is indeed not running.
Here is ~/.config/systemd/user/syncthing.service
(following the example, but note the binary is under my home dir):
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
[Service]
ExecStart=/home/user/syncthing-prefix/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=default.target
I then run this:
$ systemctl --user enable syncthing.service
$ systemctl --user start syncthing.service
Following the setup instructions I used to install the user service originally.
After running the above two commands, I see:
$ systemctl --user status syncthing.service
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
Loaded: loaded (/home/user/.config/systemd/user/syncthing.service; enabled;
Active: active (running) since Tue 2018-11-06 15:28:16 PST; 4s ago
Docs: man:syncthing(1)
Main PID: 4221 (syncthing)
CGroup: /user.slice/user-1000.slice/user@1000.service/syncthing.service
└─4221 /home/user/syncthing-prefix/syncthing -no-b
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: GUI and API listening on 127
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Access the GUI via the follo
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:19 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:20 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
as expected. And syncthing then works, as expected, until the next reboot.
Note that I have an encrypted home dir. This was the case when I was using 16.04, too.
18.04 systemd
This question has an open bounty worth +50
reputation from Adam Monsen ending in 4 days.
This question has not received enough attention.
add a comment |
up vote
3
down vote
favorite
I set up syncthing as a systemd user service on a 16.04 computer. Worked fine. Since I upgraded to 18.04 the service disappears upon reboot.
After rebooting, I see:
$ systemctl --user status syncthing.service
Unit syncthing.service could not be found.
And syncthing
is indeed not running.
Here is ~/.config/systemd/user/syncthing.service
(following the example, but note the binary is under my home dir):
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
[Service]
ExecStart=/home/user/syncthing-prefix/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=default.target
I then run this:
$ systemctl --user enable syncthing.service
$ systemctl --user start syncthing.service
Following the setup instructions I used to install the user service originally.
After running the above two commands, I see:
$ systemctl --user status syncthing.service
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
Loaded: loaded (/home/user/.config/systemd/user/syncthing.service; enabled;
Active: active (running) since Tue 2018-11-06 15:28:16 PST; 4s ago
Docs: man:syncthing(1)
Main PID: 4221 (syncthing)
CGroup: /user.slice/user-1000.slice/user@1000.service/syncthing.service
└─4221 /home/user/syncthing-prefix/syncthing -no-b
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: GUI and API listening on 127
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Access the GUI via the follo
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:19 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:20 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
as expected. And syncthing then works, as expected, until the next reboot.
Note that I have an encrypted home dir. This was the case when I was using 16.04, too.
18.04 systemd
This question has an open bounty worth +50
reputation from Adam Monsen ending in 4 days.
This question has not received enough attention.
Are you trying to start a service before logging in with the user? This should be enable usingsudo loginctl enable-linger USERNAME
– pim
Nov 12 at 7:33
It could happen right when I log in or before. This setLinger: yes
but didn't fix the reported issue on my machine.
– Adam Monsen
yesterday
Is your home folder encrypted? (ecryptfs?)
– pim
yesterday
Yes, I have an encrypted home dir
– Adam Monsen
21 hours ago
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I set up syncthing as a systemd user service on a 16.04 computer. Worked fine. Since I upgraded to 18.04 the service disappears upon reboot.
After rebooting, I see:
$ systemctl --user status syncthing.service
Unit syncthing.service could not be found.
And syncthing
is indeed not running.
Here is ~/.config/systemd/user/syncthing.service
(following the example, but note the binary is under my home dir):
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
[Service]
ExecStart=/home/user/syncthing-prefix/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=default.target
I then run this:
$ systemctl --user enable syncthing.service
$ systemctl --user start syncthing.service
Following the setup instructions I used to install the user service originally.
After running the above two commands, I see:
$ systemctl --user status syncthing.service
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
Loaded: loaded (/home/user/.config/systemd/user/syncthing.service; enabled;
Active: active (running) since Tue 2018-11-06 15:28:16 PST; 4s ago
Docs: man:syncthing(1)
Main PID: 4221 (syncthing)
CGroup: /user.slice/user-1000.slice/user@1000.service/syncthing.service
└─4221 /home/user/syncthing-prefix/syncthing -no-b
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: GUI and API listening on 127
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Access the GUI via the follo
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:19 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:20 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
as expected. And syncthing then works, as expected, until the next reboot.
Note that I have an encrypted home dir. This was the case when I was using 16.04, too.
18.04 systemd
I set up syncthing as a systemd user service on a 16.04 computer. Worked fine. Since I upgraded to 18.04 the service disappears upon reboot.
After rebooting, I see:
$ systemctl --user status syncthing.service
Unit syncthing.service could not be found.
And syncthing
is indeed not running.
Here is ~/.config/systemd/user/syncthing.service
(following the example, but note the binary is under my home dir):
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
[Service]
ExecStart=/home/user/syncthing-prefix/syncthing -no-browser -no-restart -logflags=0
Restart=on-failure
SuccessExitStatus=3 4
RestartForceExitStatus=3 4
[Install]
WantedBy=default.target
I then run this:
$ systemctl --user enable syncthing.service
$ systemctl --user start syncthing.service
Following the setup instructions I used to install the user service originally.
After running the above two commands, I see:
$ systemctl --user status syncthing.service
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
Loaded: loaded (/home/user/.config/systemd/user/syncthing.service; enabled;
Active: active (running) since Tue 2018-11-06 15:28:16 PST; 4s ago
Docs: man:syncthing(1)
Main PID: 4221 (syncthing)
CGroup: /user.slice/user-1000.slice/user@1000.service/syncthing.service
└─4221 /home/user/syncthing-prefix/syncthing -no-b
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Device XXXXXXX-XXXXXXX-XXXXX
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: GUI and API listening on 127
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Access the GUI via the follo
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:18 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:19 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
Nov 06 15:28:20 kind syncthing[4221]: [XXXXX] INFO: Completed initial scan of se
as expected. And syncthing then works, as expected, until the next reboot.
Note that I have an encrypted home dir. This was the case when I was using 16.04, too.
18.04 systemd
18.04 systemd
edited Nov 7 at 20:33
asked Nov 6 at 23:39
Adam Monsen
1,05121127
1,05121127
This question has an open bounty worth +50
reputation from Adam Monsen ending in 4 days.
This question has not received enough attention.
This question has an open bounty worth +50
reputation from Adam Monsen ending in 4 days.
This question has not received enough attention.
Are you trying to start a service before logging in with the user? This should be enable usingsudo loginctl enable-linger USERNAME
– pim
Nov 12 at 7:33
It could happen right when I log in or before. This setLinger: yes
but didn't fix the reported issue on my machine.
– Adam Monsen
yesterday
Is your home folder encrypted? (ecryptfs?)
– pim
yesterday
Yes, I have an encrypted home dir
– Adam Monsen
21 hours ago
add a comment |
Are you trying to start a service before logging in with the user? This should be enable usingsudo loginctl enable-linger USERNAME
– pim
Nov 12 at 7:33
It could happen right when I log in or before. This setLinger: yes
but didn't fix the reported issue on my machine.
– Adam Monsen
yesterday
Is your home folder encrypted? (ecryptfs?)
– pim
yesterday
Yes, I have an encrypted home dir
– Adam Monsen
21 hours ago
Are you trying to start a service before logging in with the user? This should be enable using
sudo loginctl enable-linger USERNAME
– pim
Nov 12 at 7:33
Are you trying to start a service before logging in with the user? This should be enable using
sudo loginctl enable-linger USERNAME
– pim
Nov 12 at 7:33
It could happen right when I log in or before. This set
Linger: yes
but didn't fix the reported issue on my machine.– Adam Monsen
yesterday
It could happen right when I log in or before. This set
Linger: yes
but didn't fix the reported issue on my machine.– Adam Monsen
yesterday
Is your home folder encrypted? (ecryptfs?)
– pim
yesterday
Is your home folder encrypted? (ecryptfs?)
– pim
yesterday
Yes, I have an encrypted home dir
– Adam Monsen
21 hours ago
Yes, I have an encrypted home dir
– Adam Monsen
21 hours ago
add a comment |
2 Answers
2
active
oldest
votes
up vote
0
down vote
It seems you have met a known bug, that can be fixed by changing the order of two lines in /etc/pam.d/common-session
from
session optional pam_systemd.so
session optional pam_ecryptfs.so unwrap
to
session optional pam_ecryptfs.so unwrap
session optional pam_systemd.so
Starting the service before login
Since the user directory (where your service is stored) is encrypted before login, this service can't be started before login. Anyway before login (unencryption), syncthing
would have nowhere to read/write.
Security warning
This service may let the user home directory unencrypted after the logout (another bug, see this question).
add a comment |
up vote
0
down vote
You have the same problem than https://unix.stackexchange.com/q/417162/116970
I would suggest that you add a After=
and a Requires=
line on your syncthing.service
in the [Unit]
section so that syncthing is run after the home folder is mounted.
More spefically, you coud try:
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=home-yourusername.mount
Requires=home-yourusername.mount
...
and replace yourusername with your user name
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
It seems you have met a known bug, that can be fixed by changing the order of two lines in /etc/pam.d/common-session
from
session optional pam_systemd.so
session optional pam_ecryptfs.so unwrap
to
session optional pam_ecryptfs.so unwrap
session optional pam_systemd.so
Starting the service before login
Since the user directory (where your service is stored) is encrypted before login, this service can't be started before login. Anyway before login (unencryption), syncthing
would have nowhere to read/write.
Security warning
This service may let the user home directory unencrypted after the logout (another bug, see this question).
add a comment |
up vote
0
down vote
It seems you have met a known bug, that can be fixed by changing the order of two lines in /etc/pam.d/common-session
from
session optional pam_systemd.so
session optional pam_ecryptfs.so unwrap
to
session optional pam_ecryptfs.so unwrap
session optional pam_systemd.so
Starting the service before login
Since the user directory (where your service is stored) is encrypted before login, this service can't be started before login. Anyway before login (unencryption), syncthing
would have nowhere to read/write.
Security warning
This service may let the user home directory unencrypted after the logout (another bug, see this question).
add a comment |
up vote
0
down vote
up vote
0
down vote
It seems you have met a known bug, that can be fixed by changing the order of two lines in /etc/pam.d/common-session
from
session optional pam_systemd.so
session optional pam_ecryptfs.so unwrap
to
session optional pam_ecryptfs.so unwrap
session optional pam_systemd.so
Starting the service before login
Since the user directory (where your service is stored) is encrypted before login, this service can't be started before login. Anyway before login (unencryption), syncthing
would have nowhere to read/write.
Security warning
This service may let the user home directory unencrypted after the logout (another bug, see this question).
It seems you have met a known bug, that can be fixed by changing the order of two lines in /etc/pam.d/common-session
from
session optional pam_systemd.so
session optional pam_ecryptfs.so unwrap
to
session optional pam_ecryptfs.so unwrap
session optional pam_systemd.so
Starting the service before login
Since the user directory (where your service is stored) is encrypted before login, this service can't be started before login. Anyway before login (unencryption), syncthing
would have nowhere to read/write.
Security warning
This service may let the user home directory unencrypted after the logout (another bug, see this question).
answered 5 hours ago
pim
1,830824
1,830824
add a comment |
add a comment |
up vote
0
down vote
You have the same problem than https://unix.stackexchange.com/q/417162/116970
I would suggest that you add a After=
and a Requires=
line on your syncthing.service
in the [Unit]
section so that syncthing is run after the home folder is mounted.
More spefically, you coud try:
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=home-yourusername.mount
Requires=home-yourusername.mount
...
and replace yourusername with your user name
add a comment |
up vote
0
down vote
You have the same problem than https://unix.stackexchange.com/q/417162/116970
I would suggest that you add a After=
and a Requires=
line on your syncthing.service
in the [Unit]
section so that syncthing is run after the home folder is mounted.
More spefically, you coud try:
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=home-yourusername.mount
Requires=home-yourusername.mount
...
and replace yourusername with your user name
add a comment |
up vote
0
down vote
up vote
0
down vote
You have the same problem than https://unix.stackexchange.com/q/417162/116970
I would suggest that you add a After=
and a Requires=
line on your syncthing.service
in the [Unit]
section so that syncthing is run after the home folder is mounted.
More spefically, you coud try:
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=home-yourusername.mount
Requires=home-yourusername.mount
...
and replace yourusername with your user name
You have the same problem than https://unix.stackexchange.com/q/417162/116970
I would suggest that you add a After=
and a Requires=
line on your syncthing.service
in the [Unit]
section so that syncthing is run after the home folder is mounted.
More spefically, you coud try:
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
After=home-yourusername.mount
Requires=home-yourusername.mount
...
and replace yourusername with your user name
answered 3 hours ago
solsTiCe
5,09221745
5,09221745
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1090634%2fsystemd-user-service-not-found-after-reboot%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Are you trying to start a service before logging in with the user? This should be enable using
sudo loginctl enable-linger USERNAME
– pim
Nov 12 at 7:33
It could happen right when I log in or before. This set
Linger: yes
but didn't fix the reported issue on my machine.– Adam Monsen
yesterday
Is your home folder encrypted? (ecryptfs?)
– pim
yesterday
Yes, I have an encrypted home dir
– Adam Monsen
21 hours ago