FS#42103 - [syncthing] syncthing@.service fails if home directory is only mounted on login

Attached to Project: Community Packages
Opened by Sakeno Gawa (sakenogawa) - Wednesday, 24 September 2014, 15:34 GMT
Last edited by Martin Wimpress (flexiondotorg) - Friday, 03 October 2014, 10:25 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Martin Wimpress (flexiondotorg)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I have my home directory encrypted with ecryptfs and auto-mounted on login. When the syncthing service is started by systemd on `multi-user.target`, the home directory is not available and startup fails:

Sep 24 16:38:15 hostname syncthing[608]: 16:38:15 main.go:1003: FATAL: mkdir /home/username/.config: permission denied
Sep 24 16:38:15 hostname systemd[1]: syncthing@username.service: main process exited, code=exited, status=1/FAILURE
Sep 24 16:38:15 hostname systemd[1]: Unit syncthing@username.service entered failed state.
Sep 24 16:38:15 hostname systemd[1]: syncthing@username.service start request repeated too quickly, refusing to start.
Sep 24 16:38:15 hostname systemd[1]: Failed to start Syncthing service for username.
Sep 24 16:38:15 hostname systemd[1]: Unit syncthing@username.service entered failed state.

I assumed I would be able to install the service in the user instance of systemd with `systemctl --user enable syncthing.service`, but since there's no corresponding unit in /usr/lib/systemd/user I did not succeed. However, I got it to work by adding the following unit file at ~/.config/systemd/user/syncthing.service:

[Unit]
Description=Syncthing service for %u
After=network.target

[Service]
Environment=STNORESTART=yes
ExecStart=/usr/bin/syncthing
Restart=on-success

[Install]
WantedBy=default.target

I don't know how common it is not to have the home directory available until login, but would you consider adding a user unit file to the package?

The package version I use is 0.9.17-2.
This task depends upon

Closed by  Martin Wimpress (flexiondotorg)
Friday, 03 October 2014, 10:25 GMT
Reason for closing:  Implemented
Comment by Martin Wimpress (flexiondotorg) - Friday, 03 October 2014, 10:25 GMT
Thanks for the feedback.

syncthing 0.9.19-2 has just been released to [community] that adds the user unit you requested :-)

Loading...