Package: syncthing
Version: 1.29.5~ds1-3
Severity: important

Dear Maintainer,

Whenever I reboot my Debian system and login, syncthing fails to start
automatically. I usually don't notice until a few days later when I notice
things haven't been syncing, then I have to remember that I rebooted recently
and start it manually. Once started manually, it stays running until the next
reboot.

After failing to start automatically, `systemctl --user status syncthing` says:

syncthing.service: Scheduled restart job, restart counter is at 4.
syncthing.service: Start request repeated too quickly.
syncthing.service: Failed with result 'exit-code'.
Failed to start syncthing.service - Syncthing - Open Source Continuous File
Synchronization.

Looking a little more deeply with `journalctl --user -t syncthing --boot`, I
see messages like this:

WARNING: Starting API/GUI: listen tcp 127.0.0.1:8384: bind: address already in
use
WARNING: Starting API/GUI: listen tcp 127.0.0.1:8384: bind: address already in
use
WARNING: Starting API/GUI: listen tcp 127.0.0.1:8384: bind: address already in
use
WARNING: Starting API/GUI: listen tcp 127.0.0.1:8384: bind: address already in
use
WARNING: Starting API/GUI: listen tcp 127.0.0.1:8384: bind: address already in
use
WARNING: Failed starting API: listen tcp 127.0.0.1:8384: bind: address already
in use

Evidently syncthing can't bind te ports it needs to listen on, it tries several
times and fails, then systemd restarts it, and after a few restarts systemd
also marks the service as failed.

This was very puzzling to me because I'd just rebooted - what else could
possibly be listening on the syncthing ports? Today I decided to go one step
further, and check the system-wide journal too:

INFO: syncthing v1.29.5 "Gold Grasshopper" (go1.24.9 linux-amd64) debian@debian
2025-11-29 20:48:58 UTC
INFO: Generating ECDSA key and certificate for syncthing...
INFO: Default folder created and/or linked to new config
INFO: Default config saved. Edit /run/gdm3/home/gdm-
greeter/.local/state/syncthing/config.xml to taste (with Syncthing stopped) or
use the GUI

Apparently what's happening is that after the system boots, the greeter runs
under the `gdm3` user, which is apparently counted as a user session, so per-
user units like syncthing are started and bind the relevant ports. When I
login, that starts a *new* user session, and *another* copy of syncthing, which
fails to start because the ports are already bound. Eventually (I'm not sure
how) gdm3's copy of syncthing gives up, or is stopped, so days later when I
notice the problem I can start syncthing and it works perfectly.

It would be good if somehow syncthing could be configured to *not* start up for
system users like gdm3.


-- System Information:
Debian Release: forky/sid
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.18.5+deb14-amd64 (SMP w/4 CPU threads; PREEMPT)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_AU:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages syncthing depends on:
ii  init-system-helpers  1.69
ii  libc6                2.42-11+b1

Versions of packages syncthing recommends:
ii  xdg-utils  1.2.1-2

syncthing suggests no packages.

-- no debconf information

Reply via email to