Snap not auto starting?

Hi all, this is my first post on here and I’m very new to Syncthing.

I’m trying to get the Snap of Syncthing running but I’m having some issues. I have installed the Snap on a Ubuntu Server 18.04 server and also on my laptop running Ubuntu Mate 18.04 just to test as I couldn’t get it to work on the server.

The snap wont run unless a type “Syncthing” into the command line and then the snap starts and I can access the web UI, but as soon at I close the terminal it kills the snap.

Is this right? does it only run while the command line is open? this makes it pretty useless to use on a headless server. I have tried to read the manual but couldn’t find anything. Could it just be a snap issue? or am I missing something simple?

Thanks to anyone who answers.

2 Likes

There are a number of ways to do that, please have a look at this: https://docs.syncthing.net/users/autostart.html#linux

If that doesn’t solve your problem or if you have issues, feel free to ask again.

1 Like

I had the same confusion with the snap install in a VM. Not sure why, but I can’t seem to get it running with systemd.

I cloned the github repo to get a clean copy of the .service file, copied that to /etc/systemd/system/syncthing@user.service, and enable/started it. Looks like it’s having problems starting.

sudo systemctl status syncthing@myuser.service
● syncthing@myuser.service - Syncthing - Open Source Continuous File Synchronization for myuser
   Loaded: loaded (/etc/systemd/system/syncthing@myuser.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-08-26 13:32:10 CDT; 4min 59s ago
     Docs: man:syncthing(1)
  Process: 13148 ExecStart=/usr/bin/syncthing -no-browser -no-restart -logflags=0 (code=exited, status=203/EXEC)
 Main PID: 13148 (code=exited, status=203/EXEC)

Aug 26 13:32:10 myuser-VirtualBox systemd[1]: syncthing@myuser.service: Service RestartSec=100ms expired, scheduling restart.
Aug 26 13:32:10 myuser-VirtualBox systemd[1]: syncthing@myuser.service: Scheduled restart job, restart counter is at 5.
Aug 26 13:32:10 myuser-VirtualBox systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for myuser.
Aug 26 13:32:10 myuser-VirtualBox systemd[1]: syncthing@myuser.service: Start request repeated too quickly.
Aug 26 13:32:10 myuser-VirtualBox systemd[1]: syncthing@myuser.service: Failed with result 'exit-code'.
Aug 26 13:32:10 myuser-VirtualBox systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for myuser.

I assume I botched a step, but I can’t see where. Any idea what’s breaking here?

Snap is not like the other children. Running the snap works differently and the regular systemd units will not work.

I don’t know how to do it correctly. If someone does, they are more than welcome to contribute to out snap packaging.

(Or install the .deb version which gives you a reasonable systemd setup out of the box.)

Looks like I was running into a similar issue to the one mentioned here. I had to comment the whole Hardening section of the service though, not just two lines like they did in that link.

Since I have no idea what those options I turned off actually do I think I’ll take your advice and just install the .deb version instead of the snap.

In case it helps anyone in the future, my understanding from the output of journalctl -ru syncthing@myuser.service is that my error was:

need to run as root or suid

though I’m still not sure specifically what was throwing that.

Yes I ended up going with the .Deb and it works perfectly now. Will try the snap again at some stage. Also I found when the snap was running the CPU usage was through the roof even while doing nothing where as the .Deb is fine.

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