Syncthing fails to start as a sytemd service

Version of Syncthing and the operating system I am using:

Syncthing version:1.14.0, Operating system:Arch linux

what happened:

Syncthing fails when trying to set it up as a user service using systemd.

Error log:

systemctl --user status syncthing.service
● syncthing.service - Syncthing - Open Source Continuous File Synchronization
     Loaded: loaded (/home/filip/.config/systemd/user/syncthing.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Fri 2021-03-26 16:21:21 IST; 2s ago
       Docs: man:syncthing(1)
    Process: 9650 ExecStart=/usr/bin/syncthing serve --no-browser --no-restart --logflags=0 (code=exited, status=2)
   Main PID: 9650 (code=exited, status=2)

Mar 26 16:21:20 filmachine syncthing[9650]:  upnp            - UPnP discovery and port mapping
Mar 26 16:21:20 filmachine syncthing[9650]:  ur              - Usage reporting
Mar 26 16:21:20 filmachine syncthing[9650]:  versioner       - File versioning
Mar 26 16:21:20 filmachine syncthing[9650]:  walkfs          - Filesystem access while walking
Mar 26 16:21:20 filmachine syncthing[9650]:  watchaggregator - Filesystem event watcher
Mar 26 16:21:21 filmachine systemd[806]: syncthing.service: Scheduled restart job, restart counter is at 62.
Mar 26 16:21:21 filmachine systemd[806]: Stopped Syncthing - Open Source Continuous File Synchronization.
Mar 26 16:21:21 filmachine systemd[806]: syncthing.service: Start request repeated too quickly.
Mar 26 16:21:21 filmachine systemd[806]: syncthing.service: Failed with result 'exit-code'.
Mar 26 16:21:21 filmachine systemd[806]: Failed to start Syncthing - Open Source Continuous File Synchronization.

What I expected to happen instead:

I expected it to run as a user service

Steps to reproduce the problem:

cp Syncthing/etc/linux-systemd/user/syncthing.service ~./config/systemd/user/
systemctl --user enable syncthing.service
systemctl --user start syncthing.service

Can you post the output of systemctl --user cat syncthing.service? And more logs: journalctl --user -u syncthing -r.

Output of systemctl --user cat syncthing.service

# /home/filip/.config/systemd/user/syncthing.service
[Unit]
Description=Syncthing - Open Source Continuous File Synchronization
Documentation=man:syncthing(1)

[Service]
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
SystemCallArchitectures=native
MemoryDenyWriteExecute=true
NoNewPrivileges=true

[Install]
WantedBy=default.target

Logs

-- Journal begins at Thu 2020-12-17 14:42:05 IST, ends at Sat 2021-03-27 16:05:53 IST. --
Mar 27 16:05:53 filmachine systemd[801]: Failed to start Syncthing - Open Source Continuous File Synchronization.
Mar 27 16:05:53 filmachine systemd[801]: syncthing.service: Failed with result 'exit-code'.
Mar 27 16:05:53 filmachine systemd[801]: syncthing.service: Start request repeated too quickly.
Mar 27 16:05:53 filmachine systemd[801]: Stopped Syncthing - Open Source Continuous File Synchronization.
Mar 27 16:05:53 filmachine systemd[801]: syncthing.service: Scheduled restart job, restart counter is at 4.
Mar 27 16:05:52 filmachine syncthing[142875]:  watchaggregator - Filesystem event watcher
Mar 27 16:05:52 filmachine syncthing[142875]:  walkfs          - Filesystem access while walking
Mar 27 16:05:52 filmachine syncthing[142875]:  versioner       - File versioning
Mar 27 16:05:52 filmachine syncthing[142875]:  ur              - Usage reporting
Mar 27 16:05:52 filmachine syncthing[142875]:  upnp            - UPnP discovery and port mapping
Mar 27 16:05:52 filmachine syncthing[142875]:  upgrade         - Binary upgrades
Mar 27 16:05:52 filmachine syncthing[142875]:  sync            - Mutexes
Mar 27 16:05:52 filmachine syncthing[142875]:  stun            - STUN functionality
Mar 27 16:05:52 filmachine syncthing[142875]:  stats           - Persistent device and folder statistics
Mar 27 16:05:52 filmachine systemd[801]: syncthing.service: Failed with result 'exit-code'.
Mar 27 16:05:52 filmachine syncthing[142875]:  sha256          - SHA256 hashing package
Mar 27 16:05:52 filmachine syncthing[142875]:  scanner         - File change detection and hashing
Mar 27 16:05:52 filmachine syncthing[142875]:  relay           -
Mar 27 16:05:52 filmachine syncthing[142875]:  protocol        - The BEP protocol
Mar 27 16:05:52 filmachine syncthing[142875]:  pmp             - NAT-PMP discovery and port mapping
Mar 27 16:05:52 filmachine syncthing[142875]:  nat             - NAT discovery and port mapping
Mar 27 16:05:52 filmachine syncthing[142875]:  model           - The root hub
Mar 27 16:05:52 filmachine syncthing[142875]:  main            - Main package
Mar 27 16:05:52 filmachine syncthing[142875]:  fs              - Filesystem access
Mar 27 16:05:52 filmachine syncthing[142875]:  events          - Event generation and logging
Mar 27 16:05:52 filmachine syncthing[142875]:  discover        - Remote device discovery
Mar 27 16:05:52 filmachine syncthing[142875]:  dialer          - Dialing connections
Mar 27 16:05:52 filmachine syncthing[142875]:  db              - The database layer
Mar 27 16:05:52 filmachine syncthing[142875]:  connections     - Connection handling
Mar 27 16:05:52 filmachine syncthing[142875]:  config          - Configuration loading and saving
Mar 27 16:05:52 filmachine syncthing[142875]:  beacon          - Multicast and broadcast discovery
Mar 27 16:05:52 filmachine syncthing[142875]:  backend         - The database backend
Mar 27 16:05:52 filmachine syncthing[142875]:  app             - Main run facility
Mar 27 16:05:52 filmachine syncthing[142875]:  api             - REST API
Mar 27 16:05:52 filmachine syncthing[142875]: The following are valid values for the STTRACE variable:
Mar 27 16:05:52 filmachine syncthing[142875]: --------------------
Mar 27 16:05:52 filmachine syncthing[142875]: Debugging Facilities
Mar 27 16:05:52 filmachine syncthing[142875]:                    of CPU usage (i.e. performance).
Mar 27 16:05:52 filmachine syncthing[142875]:                    100. Lower numbers keep peak memory usage down, at the price
Mar 27 16:05:52 filmachine syncthing[142875]:  GOGC              Percentage of heap growth at which to trigger GC. Default is
Mar 27 16:05:52 filmachine syncthing[142875]:                    available CPU cores.
Mar 27 16:05:52 filmachine syncthing[142875]:  GOMAXPROCS        Set the maximum number of CPU cores to use. Defaults to all
Mar 27 16:05:52 filmachine syncthing[142875]:                    STRECHECKDBEVERY variable.
Mar 27 16:05:52 filmachine syncthing[142875]:                    indirection GC interval of 13 hours. Same format as the
Mar 27 16:05:52 filmachine syncthing[142875]:  STGCINDIRECTEVERY Set to a time interval to override the default database
Mar 27 16:05:52 filmachine syncthing[142875]:                    Valid values are like "720h", "30s", etc.
Mar 27 16:05:52 filmachine syncthing[142875]:                    "h", "m" and "s" abbreviations for hours minutes and seconds.
Mar 27 16:05:52 filmachine syncthing[142875]:                    check interval of 30 days (720h). The interval understands
Mar 27 16:05:52 filmachine syncthing[142875]:  STRECHECKDBEVERY  Set to a time interval to override the default database
Mar 27 16:05:52 filmachine syncthing[142875]:                    and blank (the default) for auto detection.
Mar 27 16:05:52 filmachine syncthing[142875]:                    "minio" for the github.com/minio/sha256-simd implementation,
Mar 27 16:05:52 filmachine syncthing[142875]:                    are "standard" for the Go standard library implementation,
Mar 27 16:05:52 filmachine syncthing[142875]:  STHASHING         Select the SHA256 hashing package to use. Possible values
Mar 27 16:05:52 filmachine syncthing[142875]:  STNOUPGRADE       Disable automatic upgrades.
Mar 27 16:05:52 filmachine systemd[801]: syncthing.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Mar 27 16:05:52 filmachine syncthing[142875]:  STNORESTART       Equivalent to the -no-restart argument.
Mar 27 16:05:52 filmachine syncthing[142875]:                    sensitivity.  Use only under direction of a developer.
Mar 27 16:05:52 filmachine syncthing[142875]:  STLOCKTHRESHOLD   Used for debugging internal deadlocks; sets debug
Mar 27 16:05:52 filmachine syncthing[142875]:                    sensitivity. Use only under direction of a developer.
Mar 27 16:05:52 filmachine syncthing[142875]:  STDEADLOCKTIMEOUT Used for debugging internal deadlocks; sets debug
Mar 27 16:05:52 filmachine syncthing[142875]:                    supported on Windows.
Mar 27 16:05:52 filmachine syncthing[142875]:  STPERFSTATS       Write running performance statistics to perf-$pid.csv. Not
Mar 27 16:05:52 filmachine syncthing[142875]:                    seconds.
Mar 27 16:05:52 filmachine syncthing[142875]:  STBLOCKPROFILE    Write block profiles to block-$pid-$timestamp.pprof every 20
Mar 27 16:05:52 filmachine syncthing[142875]:                    heap usage increases.
Mar 27 16:05:52 filmachine syncthing[142875]:  STHEAPPROFILE     Write heap profiles to heap-$pid-$timestamp.pprof each time
Mar 27 16:05:52 filmachine syncthing[142875]:  STCPUPROFILE      Write a CPU profile to cpu-$pid.pprof on exit.
Mar 27 16:05:52 filmachine syncthing[142875]:                    the profiler with HTTP access.
Mar 27 16:05:52 filmachine syncthing[142875]:  STPROFILER        Set to a listen address such as "127.0.0.1:9090" to start
Mar 27 16:05:52 filmachine syncthing[142875]:                    facility strings listed below.
Mar 27 16:05:52 filmachine syncthing[142875]:  STTRACE           A comma separated string of facilities to trace. The valid
Mar 27 16:05:52 filmachine syncthing[142875]:                    assets.
Mar 27 16:05:52 filmachine syncthing[142875]:  STGUIASSETS       Directory to load GUI assets from. Overrides compiled in
Mar 27 16:05:52 filmachine syncthing[142875]:                    run.
Mar 27 16:05:52 filmachine syncthing[142875]:                    time. This variable will be ignored anytime after the first
Mar 27 16:05:52 filmachine syncthing[142875]:  STNODEFAULTFOLDER Don't create a default folder when starting for the first
Mar 27 16:05:52 filmachine syncthing[142875]: are mostly useful for developers. Use with care.
Mar 27 16:05:52 filmachine syncthing[142875]: The following environment variables modify Syncthing's behavior in ways that
Mar 27 16:05:52 filmachine syncthing[142875]: --------------------
Mar 27 16:05:52 filmachine syncthing[142875]: Development Settings
Mar 27 16:05:52 filmachine syncthing[142875]: no file, which is the default anywhere else.
Mar 27 16:05:52 filmachine syncthing[142875]: (see -data-dir), which is the default on Windows, and the latter only to stdout,
Mar 27 16:05:52 filmachine syncthing[142875]: values "default" and "-" may be used. The former logs to DATADIR/syncthing.log
Mar 27 16:05:52 filmachine syncthing[142875]: file at the path specified by -logfile=path. In addition to an path, the special
Mar 27 16:05:52 filmachine syncthing[142875]: Logging always happens to the command line (stdout) and optionally to the
Mar 27 16:05:52 filmachine syncthing[142875]: show time only (2).
Mar 27 16:05:52 filmachine syncthing[142875]: above). The value 0 is used to disable all of the above. The default is to
Mar 27 16:05:52 filmachine syncthing[142875]: I.e. to prefix each log line with date and time, set -logflags=3 (1 + 2 from
Mar 27 16:05:52 filmachine syncthing[142875]:   16  Short filename
Mar 27 16:05:52 filmachine syncthing[142875]:    8  Long filename
Mar 27 16:05:52 filmachine syncthing[142875]:    4  Microsecond time
Mar 27 16:05:52 filmachine syncthing[142875]:    2  Time
Mar 27 16:05:52 filmachine syncthing[142875]:    1  Date
Mar 27 16:05:52 filmachine syncthing[142875]: The -logflags value is a sum of the following:
Mar 27 16:05:52 filmachine syncthing[142875]:   -version                  Show version
Mar 27 16:05:52 filmachine syncthing[142875]:   -verbose                  Print verbose log output
Mar 27 16:05:52 filmachine syncthing[142875]:   -upgrade-to=""            Force upgrade directly from specified URL
Mar 27 16:05:52 filmachine syncthing[142875]:   -upgrade-check            Check for available upgrade
Mar 27 16:05:52 filmachine syncthing[142875]:   -upgrade                  Perform upgrade
Mar 27 16:05:52 filmachine syncthing[142875]:   -unpaused                 Start with all devices and folders unpaused
Mar 27 16:05:52 filmachine syncthing[142875]:   -reset-deltas             Reset delta index IDs, forcing a full index exchange
Mar 27 16:05:52 filmachine syncthing[142875]:   -reset-database           Reset the database, forcing a full rescan and resync
Mar 27 16:05:52 filmachine syncthing[142875]:   -paused                   Start with all devices and folders paused
Mar 27 16:05:52 filmachine syncthing[142875]:   -paths                    Show configuration paths
Mar 27 16:05:52 filmachine syncthing[142875]:   -no-restart               Do not restart Syncthing when exiting due to API/GUI command, upgrade, or crash
Mar 27 16:05:52 filmachine syncthing[142875]:   -no-browser               Do not start browser
Mar 27 16:05:52 filmachine syncthing[142875]:   -logflags="2"             Select information in log line prefix (see below)
Mar 27 16:05:52 filmachine syncthing[142875]:   -logfile="-"              Log file name (see below).
Mar 27 16:05:52 filmachine syncthing[142875]:   -log-max-size="10485760"  Maximum size of any file (zero to disable log rotation).
Mar 27 16:05:52 filmachine syncthing[142875]:   -log-max-old-files="3"    Number of old files to keep (zero to keep only current).
Mar 27 16:05:52 filmachine syncthing[142875]:   -home=""                  Set configuration and data directory
Mar 27 16:05:52 filmachine syncthing[142875]:   -help                     Show this help
Mar 27 16:05:52 filmachine syncthing[142875]:   -gui-apikey=""            Override GUI API key
Mar 27 16:05:52 filmachine syncthing[142875]:   -gui-address=""           Override GUI address (e.g. "http://192.0.2.42:8443")
Mar 27 16:05:52 filmachine syncthing[142875]:   -generate=""              Generate key and config in specified dir, then exit
Mar 27 16:05:52 filmachine syncthing[142875]:   -device-id                Show the device ID
Mar 27 16:05:52 filmachine syncthing[142875]:   -data=""                  Set data directory (database and logs)
Mar 27 16:05:52 filmachine syncthing[142875]:   -config=""                Set configuration directory (config and keys)
Mar 27 16:05:52 filmachine syncthing[142875]:   -browser-only             Open GUI in browser
Mar 27 16:05:52 filmachine syncthing[142875]:   -auditfile=""             Specify audit file (use "-" for stdout, "--" for stderr)
Mar 27 16:05:52 filmachine syncthing[142875]:   -audit                    Write events to audit file
Mar 27 16:05:52 filmachine syncthing[142875]:   -allow-newer-config       Allow loading newer than current config version
Mar 27 16:05:52 filmachine syncthing[142875]: Options:
Mar 27 16:05:52 filmachine syncthing[142875]:   syncthing [options]
Mar 27 16:05:52 filmachine syncthing[142875]: Usage:
Mar 27 16:05:52 filmachine systemd[801]: Started Syncthing - Open Source Continuous File Synchronization.
Mar 27 16:05:52 filmachine systemd[801]: Stopped Syncthing - Open Source Continuous File Synchronization.
Mar 27 16:05:52 filmachine systemd[801]: syncthing.service: Scheduled restart job, restart counter is at 3.
Mar 27 16:05:51 filmachine syncthing[142847]:  watchaggregator - Filesystem event watcher
Mar 27 16:05:51 filmachine syncthing[142847]:  walkfs          - Filesystem access while walking
Mar 27 16:05:51 filmachine syncthing[142847]:  versioner       - File versioning
Mar 27 16:05:51 filmachine syncthing[142847]:  ur              - Usage reporting
Mar 27 16:05:51 filmachine syncthing[142847]:  upnp            - UPnP discovery and port mapping
Mar 27 16:05:51 filmachine syncthing[142847]:  upgrade         - Binary upgrades
Mar 27 16:05:51 filmachine syncthing[142847]:  sync            - Mutexes
Mar 27 16:05:51 filmachine syncthing[142847]:  stun            - STUN functionality
Mar 27 16:05:51 filmachine syncthing[142847]:  stats           - Persistent device and folder statistics
Mar 27 16:05:51 filmachine systemd[801]: syncthing.service: Failed with result 'exit-code'.
Mar 27 16:05:51 filmachine syncthing[142847]:  sha256          - SHA256 hashing package
Mar 27 16:05:51 filmachine syncthing[142847]:  scanner         - File change detection and hashing
Mar 27 16:05:51 filmachine syncthing[142847]:  relay           -
Mar 27 16:05:51 filmachine syncthing[142847]:  protocol        - The BEP protocol
Mar 27 16:05:51 filmachine syncthing[142847]:  pmp             - NAT-PMP discovery and port mapping
Mar 27 16:05:51 filmachine syncthing[142847]:  nat             - NAT discovery and port mapping
Mar 27 16:05:51 filmachine syncthing[142847]:  model           - The root hub
Mar 27 16:05:51 filmachine syncthing[142847]:  main            - Main package
Mar 27 16:05:51 filmachine syncthing[142847]:  fs              - Filesystem access
Mar 27 16:05:51 filmachine syncthing[142847]:  events          - Event generation and logging
Mar 27 16:05:51 filmachine syncthing[142847]:  discover        - Remote device discovery
Mar 27 16:05:51 filmachine syncthing[142847]:  dialer          - Dialing connections
Mar 27 16:05:51 filmachine syncthing[142847]:  db              - The database layer
Mar 27 16:05:51 filmachine syncthing[142847]:  connections     - Connection handling
Mar 27 16:05:51 filmachine syncthing[142847]:  config          - Configuration loading and saving
Mar 27 16:05:51 filmachine syncthing[142847]:  beacon          - Multicast and broadcast discovery
Mar 27 16:05:51 filmachine syncthing[142847]:  backend         - The database backend
Mar 27 16:05:51 filmachine syncthing[142847]:  app             - Main run facility
Mar 27 16:05:51 filmachine syncthing[142847]:  api             - REST API
Mar 27 16:05:51 filmachine syncthing[142847]: The following are valid values for the STTRACE variable:

The systemd service file is using the new command line syntax introduced in v1.15.0, but you are still using v1.14.0, thus it’s failing. You need to use the service from the download, not directly from the repository (I know our documentation links the repository, that’s bad - I’ll fix that asap).

I checked the downloads page and over there the latest version is v1.14.0, could you please tell me where I can find v1.15.0?

That’s the latest stable release, v1.15.0 is currently in the candidate channel (v1.15.0-rc.6). You can either use the unit file from the v1.14.0 download with your currently installed v1.14.0 binary or get the latest RC from Releases · syncthing/syncthing · GitHub

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