Hi everyone ! Syncthing gave me quite a hard time yesterday. First, for some reason, I wasn’t able to log in, syncthing would refused my id and password. So I start with a new config file, copy the contents from the previous one and restart again. That was still not working until I delete the user/password in the config file.
Now I want to use the systemd service to start/stop syncthing (I run it from a script until now) but I’m having another issue. The service stops quickly with this error :
mars 28 09:06:44 systemd[1]: syncthing.service: Start request repeated too quickly.
mars 28 09:06:44 systemd[1]: syncthing.service: Failed with result ‘core-dump’.
I may have mess (a bit) with the systemd file so maybe it comes from there ?
Here’s the content of my syncthing.service file :
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)
Is there something I need to do in order to get the syncthing service up and running ? I can get syncthing to work from a terminal with this command line, but it won’t work from the systemd service file … Any idea what I’m doing wrong ? Thanks for your help !
Found the solution myself (I think). I was not running the service as the regular user. If I run the service with systemctl --user start synchting.service, it runs without issue.
But then what if I want to run the service without --user ? Is that possible ? (or not recommanded ?)
I am not entirely sure, but I think the problem is with $USER. Systemd service files aren’t shell files, I think you can’t use env variables. Look at the official service file by Syncthing to see how it is usually done (via syncthing@.service and %i as placeholder for the given user name). There is also some way to use environment variables via an option - check systemd docs (or better google, as systemd docs are generally clear, but huge and fragmented).
Some unrelated stuff (shouldn’t hurt):
The -home line is unnecessary, as it’s also the default location, however that doesn’t do any harm.
Thank you imsodin for your help. Well, that’s exactly how I got the service to finally run without issue (Plus I’ve learned something new about systemd today with this great doc). But I’m still confused as to why I should use --user (syncthing is actually the only service I have that requires it, I think)