Error at first startup

I’m trying to get Syncthing running on our ReadyNAS using this guide:

However, I’m getting an error at system startup. How can I troubleshoot this to see what the problem is?

root@BACKUP1:~# systemctl status syncthing@root.service
● syncthing@root.service - Syncthing - Open Source Continuous File Synchronization for root
   Loaded: loaded (/etc/systemd/system/syncthing@.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Tue 2021-04-20 14:03:46 AKDT; 17s ago
     Docs: https://github.com/syncthing/syncthing/wiki
  Process: 24654 ExecStart=/usr/local/bin/syncthing -no-browser -logflags=0 (code=exited, status=203/EXEC)
 Main PID: 24654 (code=exited, status=203/EXEC)

Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:03:46 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Start request repeated too quickly.
Apr 20 14:03:46 BACKUP1 systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'start-limit-hit'.
  1. The guide suggests running things as root, probably to make things easier, but running applications as root is not a great idea.

  2. # journalctl -u syncthing@root.service might have more information about what’s going wrong.

Don’t systemd services have to run as root?

journalctl doesn’t reveal much more, I’m afraid:

root@BACKUP1:~# journalctl -u syncthing@root.service
-- Logs begin at Fri 2020-12-04 13:45:06 AKST, end at Tue 2021-04-20 17:00:57 AKDT. --
Apr 20 14:03:45 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:03:45 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:45 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:03:45 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:45 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:03:45 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:03:46 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:46 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:03:46 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:46 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:03:46 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Start request repeated too quickly.
Apr 20 14:03:46 BACKUP1 systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:03:46 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'start-limit-hit'.
Apr 20 14:07:08 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:07:08 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:08 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:07:08 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:08 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:07:08 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:07:09 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:09 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:07:09 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:09 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 14:07:09 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Start request repeated too quickly.
Apr 20 14:07:09 BACKUP1 systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 14:07:09 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'start-limit-hit'.
Apr 20 16:07:30 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:30 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:07:30 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:07:30 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:07:30 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:07:30 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:30 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:30 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:07:30 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:07:30 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:07:31 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:31 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:07:31 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:31 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:07:31 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:31 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:07:31 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Start request repeated too quickly.
Apr 20 16:07:31 BACKUP1 systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:07:31 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'start-limit-hit'.
Apr 20 16:10:30 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:10:30 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:30 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:10:30 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:30 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:10:30 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:30 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:10:30 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:10:31 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:10:31 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:31 BACKUP1 systemd[1]: Started Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:31 BACKUP1 systemd[1]: syncthing@root.service: Main process exited, code=exited, status=203/EXEC
Apr 20 16:10:31 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:10:31 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 20 16:10:31 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 20 16:10:31 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:31 BACKUP1 systemd[1]: syncthing@root.service: Start request repeated too quickly.
Apr 20 16:10:31 BACKUP1 systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for root.
Apr 20 16:10:31 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 20 16:10:31 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'start-limit-hit'.

No, in general there is no such requirement (on Debian). Your ReadyNAS might do funny things (SELinux or whatever) making it difficult to do otherwise, but almost no systemd service needs to run as root.

203/EXEC means that systemd wasn’t able to launch anything. Does the exectuable

/usr/local/bin/syncthing

actually exist at that location?

Also, in another recent thread they said that ReadyNAS is actually a Debian derivative, meaning that it’s probably easier to install syncthing’s apt repository:

The repository will install the binaries and add a ready-to-use systemd service you just need to start & enable.

Wasn’t there debian 8 mentioned somewhere? Probably too old systemd version, which doesn’t support the hardening options in the syncthing@.service. I don’t remember which exactly, you can do trial and error or just comment all of them.

Also @Nummer378 already said so, but just to reinforce that: Systemd service do not need to and in general shouldn’t be run as root, definitely Syncthing shouldn’t be run as root.

1 Like

Bingo, you hit it. That directory is completely empty.

The strange thing is, though, that the service config file doesn’t point there:

root@BACKUP1:~# nano /lib/systemd/system/syncthing@.service
  GNU nano 2.2.6                          File: /lib/systemd/system/syncthing@.service

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target

[Service]
User=%i
ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0
Restart=on-failure
RestartSec=1
StartLimitIntervalSec=60
StartLimitBurst=4
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

Would you happen to know where I might look to find the line that’s pointing there?

BTW I’m very interested in adopting your recommendation to not run the service as root, but I think my first step here should be to get it running in the first place.

I believe the task of modifying the service to run under a non-privileged user should be discussed in a separate thread (or maybe a different forum).

OK, I’ll work that angle once I get the pointer fixed (see above) and if it still doesn’t fire. As an aside, for making things easier while working in Nano, is there a comment character for these service config files? Perhaps a semicolon or some such thing?

it usually is at /usr/bin/syncthing, where the service points.

You’re modifying the file /lib/systemd/system/syncthing@.service, but systemd has found another systemd service file located at:

/etc/systemd/system/syncthing@.service

The /etc directory has priority, so systemd is completly ignoring the config file you’re modifying. Delete or rename one file.

If you have modified the service, you also need to get systemd to read the new file. Newer systemd warns you that you need to do this and tells you to run:

systemctl daemon-reload

After making any changes.

Yes the # character initiates a one-line comment.

1 Like

Well, I was able to move an inch and a half just now.

I found the local version of the path in /etc/systemd/system/syncthing@.service. So I modified ExecStart= to remove the directory local from the path. It’s now ExecStart=/usr/bin/syncthing -no-browser -logflags=0.

I tried to start the service and I got this:

Warning: syncthing@root.service changed on disk. Run 'systemctl daemon-reload' to reload units.

So I did, and now I’m getting a little bit different error message at startup:

root@BACKUP1:~# systemctl status syncthing@root.service
● syncthing@root.service - Syncthing - Open Source Continuous File Synchronization for root
   Loaded: loaded (/etc/systemd/system/syncthing@.service; enabled; vendor preset: enabled)
   Active: failed (Result: start-limit-hit) since Wed 2021-04-21 13:13:36 AKDT; 3s ago
     Docs: https://github.com/syncthing/syncthing/wiki
  Process: 11019 ExecStart=/usr/bin/syncthing -no-browser -logflags=0 (code=exited, status=1/FAILURE)
 Main PID: 11019 (code=exited, status=1/FAILURE)

Apr 21 13:13:36 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 21 13:13:36 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'exit-code'.
Apr 21 13:13:36 BACKUP1 systemd[1]: syncthing@root.service: Service hold-off time over, scheduling restart.
Apr 21 13:13:36 BACKUP1 systemd[1]: Stopped Syncthing - Open Source Continuous File Synchronization for root.
Apr 21 13:13:36 BACKUP1 systemd[1]: syncthing@root.service: Start request repeated too quickly.
Apr 21 13:13:36 BACKUP1 systemd[1]: Failed to start Syncthing - Open Source Continuous File Synchronization for root.
Apr 21 13:13:36 BACKUP1 systemd[1]: syncthing@root.service: Unit entered failed state.
Apr 21 13:13:36 BACKUP1 systemd[1]: syncthing@root.service: Failed with result 'start-limit-hit'.

I’m curious: why are there two different versions of the service config file?

1. /etc/systemd/system/syncthing@.service

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=https://github.com/syncthing/syncthing/wiki
After=network.target

[Service]
User=%i
Environment=STNORESTART=yes
ExecStart=/usr/bin/syncthing -no-browser -logflags=0
Restart=on-failure
SuccessExitStatus=2 3 4
RestartForceExitStatus=3 4

[Install]
WantedBy=multi-user.target

2. /lib/systemd/system/syncthing@.service

[Unit]
Description=Syncthing - Open Source Continuous File Synchronization for %I
Documentation=man:syncthing(1)
After=network.target

[Service]
User=%i
ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0
Restart=on-failure
RestartSec=1
StartLimitIntervalSec=60
StartLimitBurst=4
SuccessExitStatus=3 4
RestartForceExitStatus=3 4

# Hardening
ProtectSystem=full
PrivateTmp=true
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

[Install]
WantedBy=multi-user.target

Isn’t this architecture just inviting trouble?

1 Like

That wasn’t done by Syncthing. The installed service get’s installed to .../lib/systemd/.... Stuff in /etc/ is local configuration, i.e. changes to the default. And even if you actually want that, you shouldn’t copy the entire file, but only create drop-ins for the bits you want to change. Either run systemctl edit syncthing@ or create a file in /etc/systemd/system/syncthing@.service.d/ manually. Delete the file you have now in /etc/.

I did, and I copied in the contents of /etc/systemd/system/syncthing@.service. There’s now a new file /etc/systemd/system/syncthing@.service.d/override.conf. Will that be the correct name for it?

It seems I’m to delete anything syncthing-related from /lib/systemd/system/, which I’m OK with. I’m not sure why, but I’m favoring the /etc/ version of things. BUT… there’s currently a file in there called syncthing-resume.service. Is that important? Should I copy it to /etc/systemd/system/syncthing@.service.d/?

/lib/systemd/system/syncthing-resume.service

[Unit]
Description=Restart Syncthing after resume
Documentation=man:syncthing(1)
After=sleep.target

[Service]
Type=oneshot
ExecStart=-/usr/bin/pkill -HUP -x syncthing

[Install]
WantedBy=sleep.target

Well, something’s all mucked up now:

root@BACKUP1:~# systemctl start syncthing@root.service
Failed to start syncthing@root.service: Unit syncthing@root.service not found.
1 Like

Now it’s got worse. I figured I’d uninstall so I could run a clean reinstall and start over:

apt purge syncthing
apt install syncthing
rm -Rf /etc/systemd/system/syncthing@.service.d/
syncthing

Now I’m getting this when I try to run syncthing:

[start] 15:58:15 WARNING: Error opening database: resource temporarily unavailable (is another instance of Syncthing running?)

I tried:

/usr/bin/pkill -HUP -x syncthing

But I get the same result. Resource unavailable.

Have I completely hosed this thing?

1 Like

Slightly related: You likely don’t want to run Syncthing as root. If you switch to another user, the db problem will go away too.

I tried to find a nice little HowTo on configuring systemd unit files for you to read, but everything I find is too comprehensive (goes into details you don’t need to know about). Two pointers that should help you not get into such a mess (generic, not just systemd):

  1. Directories within /usr (except /usr/local), respectively in /bin, /lib*, … on other distros, are meant for installations. Basic rule: Don’t touch these ever.

  2. /etc is for systemd wide configuration. That’s where you get to modify/add stuff (be careful modifying obviously, you can still break stuff).

That’s part of the Filesystem Hierarchy Standard - Wikipedia

Did you check that syncthing is indeed not running anymore? If it isn’t and you still get an error, your db might be toast. It should be located at /root/.config/syncthing/index-v... for you and as you haven’t used Syncthing yet, it’s safe to delete. Again, don’t run as root.

More generally: The instructions you linked are old and don’t make sense for you: You are using apt, so just install with https://apt.syncthing.net/. Then setup is trivial: Install (instructions there), then run sudo systemctl enable syncthing@yourdesireduser and ``sudo systemctl start syncthing@yourdesireduser` - done. No need to fiddle around with service files.

Oh, absolutely! But the purist in me would like to first get it running as is, so that no loose ends are left lying around. If I were to move to a non-admin user mid-stream in all of this, it sounds like I’d end up with a non-working (albeit inactive) configuration under root. That idea bugs me.

I’d like to first get it working under root, and then migrate everything to a different user (a subject worthy of a new thread, maybe even in a different forum). What do you think? Would you want the same on your setup?

Ooo… that’s sexy :slightly_smiling_face:

I did:

root@BACKUP1:~# ps aux | grep syncthing
root     24283  0.0  0.0 724636  6192 ?        Sl   Apr20   0:03 syncthing
root     30233  1.9  0.5 727132 43856 ?        SNl  13:52   0:01 syncthing
root     30267  0.0  0.0  17836  1000 pts/1    S+   13:53   0:00 grep syncthing
root@BACKUP1:~# pkill -HUP -x syncthing
root@BACKUP1:~# ps aux | grep syncthing
root     24283  0.0  0.0 724892  6956 ?        Sl   Apr20   0:03 syncthing
root     30272 22.5  0.4 727324 36472 ?        SNl  13:53   0:01 syncthing
root     30286  0.0  0.0  17836  1036 pts/1    S+   13:54   0:00 grep syncthing

See the new PIDs? It’s the walking dead! So it seems it’s still running and also that I can’t kill it. It’s the guest who came to dinner but wouldn’t leave :slightly_smiling_face:

I tried purging it again but had no luck there:

root@BACKUP1:~# apt purge syncthing
root@BACKUP1:~# systemctl stop syncthing
Failed to stop syncthing.service: Unit syncthing.service not loaded.

Will it be possible to completely uninstall this and start over?

Aha! Music to my ears :smiley:

1 Like

Oh Simon, you’re the greatest! :smiley:

I managed to permanently kill the old syncthing instance(s) with a simple reboot. I deleted the database directory and its contents, as you advised, and then reinstalled using the steps you suggested. Easy, peasey, Japanesey.

FYI since this is running on a ReadyNAS, to which I’m connecting as root, I dropped the sudo for everything. I also edited the config file to allow external connections—since a ReadyNAS device is headless—and restarted the service:

/home/admin/.config/syncthing/config.xml

<gui enabled="true" tls="false" debugging="false">
    <address>0.0.0.0:8384</address>
    <apikey>[REDACTED]</apikey>
    <theme>default</theme>
</gui>

And poof! It’s up and running:

image

You’ve got a milkshake comin’. Chocolate sound OK? :wink:

4 Likes

Good to hear it works for you now!

Wow, the praise to effort ratio here is crazy good xD

And just for the record:

Wasn’t paying enough attention earlier: Huping restarts. Just killall syncthing should do.

It’s recommended setting up a password then. Unless it’s in a private/trusted network and everyone anyway has access to the data (disclaimer added so I don’t violate my own recommendation).

Just had to get up and get some (non-liquid) chocolate to the desk as you triggered my chocolate-addiction :smiley:

2 Likes

That has all the makings of a new acronym. PTE Ratio.

OK, thanks.

Yeppers. Done.

Like water for chocolate :slightly_smiling_face:

1 Like

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