systemctl / systemd file resetting after upgrades


I have two ubuntu servers running syncthing. I’ve been using it for years, but since switching to systemd, the configuration files have been resetting at every upgrade. I installed and upgrade with apt-get.

I made a custom unit file at /lib/systemd/system/syncthing@.service. It reverts to the default file at every upgrade, and I have to update it manually each time. Very annoying.

Any idea how to prevent it from reverting?

You must run it under some user with syncthing@username.service, not with syncthing@.service Check documentation about service installation. In any case, problem not with syncthing, but with your system package manager.

Copy the unit file to /etc/systemd/system and edit it there. Files in that directory take precedence over those in /lib/systemd/system and are not affected by package upgrades.

You will then need to systemctl reenable the service (once) so that systemd properly symlinks to your custom unit file at its new location.

1 Like

Look up systemctl edit

I prefer starting/stopping Syncthing as user unit with systemctl start/stop --user syncthing. This has the advantage that it allows to start/stop Syncthing without being root.

Ok, I didn’t know about /etc/systemd/system. Will try that at next upgrade!


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