Unable to get synthing started by systemd

Hello,

I’ve already used syncthing with systemd without problems. But I’ve bought a new computer and decided to use home directory encryption so I need to start synthing as user service after login. And I’am unable to do it. I’ve tried

systemctl --user enable syncthing.service

as mentioned in syncthing documentation. It successfully created link in ~/.config/systemd/user/default.target.wants. I can run sycthing manually with systemctl start command. But it never starts automatically.

After some inspection I found, that, despite of theese links, syncthing is missing from default.target dependencies when I try to list them with list-dependencies systemctl command. Which is the problem, probably. I don’t know how to fix it hovever.

What I’am doing wrong? Besides lack of experience with systemd :wink:

What does systemctl --user status syncthing.service say? And please excuse the question, I am asking everything that comes to mind and wasn’t mentioned explicitly: You did use --user when using list-dependencies, right? Also if the status logs are filled with the manual start, you can check logs from after login with journalctl --user -u syncthing.

systemctl --user status syncthing.service
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
   Loaded: loaded (/usr/lib/systemd/user/syncthing.service; enabled; vendor preset: enabled)
   Active: active (running) since Thu 2017-12-07 21:27:04 CET; 23min ago
     Docs: man:syncthing(1)
 Main PID: 9187 (syncthing)
   CGroup: /user.slice/user-1000.slice/user@1000.service/syncthing.service
           └─9187 /usr/bin/syncthing -no-browser -no-restart -logflags=0


pro 07 21:28:20 infisky syncthing[9187]: [SNEDS] INFO: Completed initial scan of readwrite folder "gradle data" (gradle-data)
pro 07 21:28:36 infisky syncthing[9187]: [SNEDS] INFO: Completed initial scan of readwrite folder Textury
pro 07 21:30:19 infisky syncthing[9187]: [SNEDS] INFO: Completed initial scan of readwrite folder "home-p2" (s2wuq-akcth)
pro 07 21:30:29 infisky syncthing[9187]: [SNEDS] INFO: Established secure connection to 2WI2RJS-L3VH6QX-6Z7QBBI-PZ5UZFG-4GXZYOO-ZCTHN5S-PXEHEFC-FMEEUQF at 192.168.1.199:55856-192.168.1.200:22000 (tcp-client) (TL
pro 07 21:30:29 infisky syncthing[9187]: [SNEDS] INFO: Device 2WI2RJS-L3VH6QX-6Z7QBBI-PZ5UZFG-4GXZYOO-ZCTHN5S-PXEHEFC-FMEEUQF client is "syncthing v0.14.40" named "infime"
pro 07 21:30:43 infisky syncthing[9187]: [SNEDS] INFO: Connected to already connected device 2WI2RJS-L3VH6QX-6Z7QBBI-PZ5UZFG-4GXZYOO-ZCTHN5S-PXEHEFC-FMEEUQF (existing: 192.168.1.199:55856-192.168.1.200:22000/tcp
pro 07 21:32:07 infisky syncthing[9187]: [SNEDS] INFO: Completed initial scan of readwrite folder Modely
pro 07 21:32:47 infisky syncthing[9187]: [SNEDS] INFO: kcp://0.0.0.0:22020 detected NAT type: Port restricted NAT
pro 07 21:32:47 infisky syncthing[9187]: [SNEDS] INFO: kcp://0.0.0.0:22020 resolved external address kcp://94.230.144.43:41934 (via stun.schlund.de:3478)
pro 07 21:35:56 infisky syncthing[9187]: [SNEDS] INFO: Completed initial scan of readwrite folder Documents

I’ve started syncthing manually. And yes, I’am using --user switch everywhere. Journalctl shows nothing:

journalctl --user -u syncthing
No journal files were found.
-- No entries --

Weird that the -u parameter doesn’t work with --user, no idea why. But the service is enabled, so it should just work. You can have a look at just journalctl --user, but I don’t know what to look for.

Note that in general this is supposed to work. In fact, here on my machine (Arch Linux) it works fine:

journalctl --user -fu syncthing
-- Logs begin at Tue 2017-06-06 19:32:02 CEST. --
Dez 07 22:30:14 martchus-arch syncthing[626]: [HP76R] INFO: Completed initial scan of readwrite folder music
...

However, I remember someone mentioning the same problem (no log for --user services) on IRC. Not sure what the solution was.

Stupid question, but did you execute all commands with the correct user? For example, if you accidentally call systemctl --user enable syncthing.service as root, the service will not be enabled for your regular user.

Which dependencies are missing according to systemctl list-dependencies --user syncthing?

I’am not running it as root. Dependencies are:

$systemctl list-dependencies --user syncthing
syncthing.service
● ├─-.slice
● ├─syncthing-inotify.service
● └─basic.target
●   ├─paths.target
●   ├─sockets.target
●   │ └─dbus.socket
●   └─timers.target

And I think, that I have the neccessary systemd links:

disnel@infisky:~/.config/systemd/user/default.target.wants$ ll
total 16
drwxr-xr-x 2 disnel disnel 4096 pro  6 20:25 ./
drwxr-xr-x 3 disnel disnel 4096 pro  6 20:21 ../
lrwxrwxrwx 1 disnel disnel   47 pro  6 20:25 syncthing-inotify.service -> /usr/lib/systemd/user/syncthing-inotify.service
lrwxrwxrwx 1 disnel disnel   39 pro  6 20:25 syncthing.service -> /usr/lib/systemd/user/syncthing.service

I think, that the problem is missing dependency here:

disnel@infisky:~$ systemctl --user list-dependencies default.target
default.target
● └─basic.target
●   ├─paths.target
●   ├─sockets.target
●   │ └─dbus.socket
●   └─timers.target

But it should be added with mentioned links, right?

The problem was home folder encryption. I removed it, due to another problem (thread about awfully slow initial scan) and it started working…

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