webi-installers icon indicating copy to clipboard operation
webi-installers copied to clipboard

Possible bug in Syncthing Serviceman script (no "systemctl enable" command?)

Open illtellyoulater opened this issue 2 years ago • 2 comments

Hi, as per instructions at https://webinstall.dev/syncthing/, I ran the following commands to setup Syncthing automatic execution:

mkdir -p ~/.config/syncthing/
env PATH="$PATH" serviceman add --user --name syncthing -- syncthing --home ~/.config/syncthing/

which resulted in the following output:

>   syncthing --home ~/.config/syncthing/
OPTIONS: Making some assumptions...

        # Because this is your current working directory
          --workdir /home/myuser

COMMAND: Service "syncthing" will be run like this (more or less):

        # Starts as "myuser", when "myuser" logins
        /home/myuser/.local/bin/syncthing --home /home/myuser/.config/syncthing

LAUNCHER: Starting systemd USER MODE service unit...

        systemctl --user daemon-reload || true
        systemctl stop --user syncthing.service || true
        systemctl start --user syncthing.service || exit

This successfully brought up Syncthing, and correctly created a "syncthing.service" file under ~/.config/systemd/user/ dir.

However, after rebooting and logging again into "myuser", Syncthing was not started.

Looking back at above systemctl commands I noticed that a systemctl --user enable syncthing.service was missing, so I ran it myself and got

Created symlink /home/myuser/.config/systemd/user/default.target.wants/syncthing.service → /home/myuser/.config/systemd/user/syncthing.service.

And after this step I could verify that Syncthing was automatically starting on system reboot.

So in order to make thing clearer for other users or future myself, is this actually a bug in the serviceman script, or did I do anything wrong?

illtellyoulater avatar Aug 30 '23 19:08 illtellyoulater

@coolaj86 Potentially (but not necessarily), related to https://github.com/webinstall/webi-installers/issues/635

mathwhiz1212 avatar Sep 05 '23 21:09 mathwhiz1212

Ah, I bet this is a bug in serviceman because user services on Linux haven't been tested very much.

I will investigate.

coolaj86 avatar Sep 05 '23 21:09 coolaj86