Syncthing service doesn’t start automatically on boot on Linux Mint

Hello,

I installed syncthing with apt-get on latest linux mint. However, it wasn’t starting automatically, so I used:

systemctl enable syncthing@myuser.service
systemctl start syncthing@myuser.service

But instead myuser i have just used username of my account on thic pc

to set up auto launch as suggested in the documentation. But Syncthing still doesn’t start automatically, I have to manually start it each time in order to use http://localhost:8384/ in the browser.

Did I miss any setup steps?

here is my journalctl -u syncthing@user command:

Jan 17 01:04:19 niebo syncthing[1184]: WARNING: Failure on home directory: mkdir /home/nhoz/.local: permission denied
Jan 17 01:04:20 niebo syncthing[1266]: WARNING: Failure on home directory: mkdir /home/nhoz/.local: permission denied
lines 1-34...skipping...
Jan 17 00:01:38 niebo systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for nhoz.
Jan 17 00:01:38 niebo syncthing[21631]: [start] INFO: syncthing v1.27.2 "Gold Grasshopper" (go1.21.5 linux-amd64) debian@github.syncthing.net 2023-12-25 03:45:16 UTC [noupgrade]
Jan 17 00:01:38 niebo syncthing[21631]: [start] WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)
Jan 17 00:01:38 niebo systemd[1]: syncthing@nhoz.service: Main process exited, code=exited, status=1/FAILURE
Jan 17 00:01:38 niebo systemd[1]: syncthing@nhoz.service: Failed with result 'exit-code'.
Jan 17 00:01:39 niebo systemd[1]: syncthing@nhoz.service: Scheduled restart job, restart counter is at 1.
Jan 17 00:01:39 niebo systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for nhoz.
Jan 17 00:01:39 niebo systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for nhoz.
Jan 17 00:01:39 niebo syncthing[21648]: [start] INFO: syncthing v1.27.2 "Gold Grasshopper" (go1.21.5 linux-amd64) debian@github.syncthing.net 2023-12-25 03:45:16 UTC [noupgrade]
Jan 17 00:01:39 niebo syncthing[21648]: [start] WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)
Jan 17 00:01:39 niebo systemd[1]: syncthing@nhoz.service: Main process exited, code=exited, status=1/FAILURE
Jan 17 00:01:39 niebo systemd[1]: syncthing@nhoz.service: Failed with result 'exit-code'.
Jan 17 00:01:41 niebo systemd[1]: syncthing@nhoz.service: Scheduled restart job, restart counter is at 2.
Jan 17 00:01:41 niebo systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for nhoz.
Jan 17 00:01:41 niebo systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for nhoz.
Jan 17 00:01:41 niebo syncthing[21665]: [start] INFO: syncthing v1.27.2 "Gold Grasshopper" (go1.21.5 linux-amd64) debian@github.syncthing.net 2023-12-25 03:45:16 UTC [noupgrade]
Jan 17 00:01:41 niebo syncthing[21665]: [start] WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)
Jan 17 00:01:41 niebo systemd[1]: syncthing@nhoz.service: Main process exited, code=exited, status=1/FAILURE
Jan 17 00:01:41 niebo systemd[1]: syncthing@nhoz.service: Failed with result 'exit-code'.
Jan 17 00:01:42 niebo systemd[1]: syncthing@nhoz.service: Scheduled restart job, restart counter is at 3.
Jan 17 00:01:42 niebo systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for nhoz.
Jan 17 00:01:42 niebo systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for nhoz.
Jan 17 00:01:42 niebo syncthing[21682]: [start] INFO: syncthing v1.27.2 "Gold Grasshopper" (go1.21.5 linux-amd64) debian@github.syncthing.net 2023-12-25 03:45:16 UTC [noupgrade]
Jan 17 00:01:42 niebo syncthing[21682]: [start] WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)
Jan 17 00:01:42 niebo systemd[1]: syncthing@nhoz.service: Main process exited, code=exited, status=1/FAILURE
Jan 17 00:01:42 niebo systemd[1]: syncthing@nhoz.service: Failed with result 'exit-code'.
Jan 17 00:01:43 niebo systemd[1]: syncthing@nhoz.service: Scheduled restart job, restart counter is at 4.
Jan 17 00:01:43 niebo systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for nhoz.
Jan 17 00:01:43 niebo systemd[1]: syncthing@nhoz.service: Start request repeated too quickly.
Jan 17 00:01:43 niebo systemd[1]: syncthing@nhoz.service: Failed with result 'exit-code'.
Jan 17 00:01:43 niebo systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for nhoz.

Is your home directory encrypted?

Yes, it is encrypted.

Generally that means it’s unlocked and mounted when you log in (as it requires your password). Syncthing can’t access anything on boot, then.

A systemd user unit might work.

sudo systemctl disable --now syncthing@nhoz
systemctl --user enable --now syncthing

Note that the second line is deliberately not executed via sudo.

1 Like

Thank you! It worked.

Can sameone explain to me, why

systemctl enable syncthing@myuser.service

didn’t work? but

systemctl --user enable --now syncthing

Is working?

User services are tied to the user scope. So they are started once your user is logged in. A system service is started on boot after its dependencies (e.g network) are satisfied.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.