syncthing: runs at startup

Hi there,
I am new to openSUSE, using syncthing. The problem is application starts at boot, but it seems the application is set-up to run without systemd. Do you have any information on how can I debug the program so I can disable syncthing startup at boot.

huya@huya:~> ps -ax |grep syncthing
 1702 ?        SNsl   0:01 /usr/bin/syncthing -no-browser -no-restart -logflags=0
 1918 ?        SNsl   0:07 /usr/bin/syncthing -no-browser -no-restart -logflags=0
 2804 pts/0    S+     0:00 grep --color=auto syncthing

huya@huya:~> systemctl status syncthing@service
● syncthing@service.service - Syncthing - Open Source Continuous File Synchronization for service
   Loaded: loaded (/usr/lib/systemd/system/syncthing@.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:syncthing(1)

Have a look in /etc/init.d for startup scripts, or search /etc for a config file that triggers the autostart.

Hello, and welcome to the mad-house.

I do not use this new-fangled stuff like syncthing myself (rsync is about my limit), but I did notice that the syncthing package contains
/usr/lib/systemd/system/syncthing-resume.service
/usr/lib/systemd/system/syncthing@.service
/usr/lib/systemd/user/syncthing.service
which suggests to me that you might want to try disabling syncthing-resume.service.

Have you considered using either qsyncthingtray or syncthing-gtk to control-configure your file-syncs?

The fact that you have 2 instances of syncthing running is a little strange . If you run the command

ps -aux |grep syncthing

you will be able to see which user each instance is running as.
It is recommended that syncthing not be run as root, but as a normal user(s). It can then be controlled with the @ service file. That is

sudo systemctl enable/start/status syncthing@<user>.service

You have actually checked the status of syncthing running as user ‘service’ and, predictably, drawn a blank.
So I suggest you check which user(s) are running syncthing per step 1 above, then check the status of the systemd service for each of those users per step 2 above.
Hope that helps.

Hello, thank you for your replies.

gdm       1701  0.5  0.8 631484 35080 ?        SNsl 15:51   0:04 /usr/bin/syncthing -no-browser -no-restart -logflags=0
huya      1943 12.5  1.6 659380 64252 ?        SNsl 15:51   1:33 /usr/bin/syncthing -no-browser -no-restart -logflags=0

It seems it is running both as user and as gdm.

In /etc I find no relevant script linked to syncthing, however when i look at /etc/init.d/rc5.d (openSUSE documentation says it covers GDM) i also find no files:

huya@huya:/etc/init.d> ls -Ra
.:
.  ..  boot.d  rc0.d  rc1.d  rc2.d  rc3.d  rc4.d  rc5.d  rc6.d  rcS.d

./boot.d:
.  ..

./rc0.d:
.  ..

./rc1.d:
.  ..

./rc2.d:
.  ..

./rc3.d:
.  ..

./rc4.d:
.  ..

./rc5.d:
.  ..

./rc6.d:
.  ..

./rcS.d:
.  ..

are these init directories in reality files? This systemd has got me confused since 2012. :\

I use rsync too on local networks, however syncthing can sync between various machines almost simultaneously without scripting and can solve the discovery of different machines on different networks easily.

I installed syncthing together with syncthikg-gtk and once mistakenly ran another instance by commandline. However syncthing does not allow for two instances by the same user. As of late syncthing-gtk is uninstalled because of these problems.

Should I blacklist the syncthing-resume? It is disabled and nothing changes.

There seems to be a strange bootup breakage in systemd bootup when i kill all the syncthing PIDs and disable all syncthing systemd instances, but after pressing Ctrl-D it then starts things as usual with 2 instances of syncthing once again.

Best,
zimci

Hello, thank you for your replies.

gdm       1701  0.5  0.8 631484 35080 ?        SNsl 15:51   0:04 /usr/bin/syncthing -no-browser -no-restart -logflags=0
huya      1943 12.5  1.6 659380 64252 ?        SNsl 15:51   1:33 /usr/bin/syncthing -no-browser -no-restart -logflags=0

It seems it is running both as user and as gdm.

Now check the status of the instance running as user ‘huya’.

sudo systemctl status syncthing@huya.service 

I presume you are using the Gnome desktop and the user ‘gdm’ is associated with that. I use KDE and have no useful experience with Gnome. But you could try running the above command again using

sudo systemctl status syncthing@gdm.service 

Another approach would be to run the command below. It should show any syncthing services that are enabled.

sudo systemctl -p Wants | grep syncthing

KDE users have a “~/.config/autostart/”. Does Gnome have an equivalent?
The other place that programs or scripts can be started early is in root’s crontab files with a “@reboot” time entry.

huya@huya:~> sudo systemctl status syncthing@huya.service
● syncthing@huya.service - Syncthing - Open Source Continuous File Synchronizati
   Loaded: loaded (/usr/lib/systemd/system/syncthing@.service; disabled; vendor 
   Active: inactive (dead)
     Docs: man:syncthing(1)
huya@huya:~> sudo systemctl status syncthing@gdm.service
● syncthing@gdm.service - Syncthing - Open Source Continuous File Synchronizatio
   Loaded: loaded (/usr/lib/systemd/system/syncthing@.service; disabled; vendor 
   Active: inactive (dead)
     Docs: man:syncthing(1)
huya@huya:~> sudo systemctl -p Wants |grep syncthing
  system-syncthing.slice                                                                   loaded    inactive dead      system-syncthing.slice    

All the same. It seems systemd does not run it at all. It must have been started by another instance before systemd can even step in.

GDM programs run at /etc/gdm/Init/Default:

#!/bin/sh

if test -x /etc/X11/xdm/Xsetup; then
    exec /etc/X11/xdm/Xsetup
fi

# Stolen from the debian kdm setup, aren't I sneaky
# Plus a lot of fun stuff added
#  -George

PATH="/usr/bin:$PATH"
OLD_IFS=$IFS

gdmwhich () {
  COMMAND="$1"
  OUTPUT=
  IFS=:
  for dir in $PATH
  do
    if test -x "$dir/$COMMAND" ; then
      if test "x$OUTPUT" = "x" ; then
        OUTPUT="$dir/$COMMAND"
      fi
    fi
  done
  IFS=$OLD_IFS
  echo "$OUTPUT"
}

sysresources=/etc/X11/Xresources

# merge in defaults
if  -f "$sysresources" ]; then
    xrdb -merge "$sysresources"
fi

sysmodmap=/etc/X11/Xmodmap

XMODMAP=`gdmwhich xmodmap`
if  "x$XMODMAP" != "x" ] ; then
  if  "x$GDM_PARENT_DISPLAY" = "x" ]; then
    if  -f $sysmodmap ]; then
      $XMODMAP $sysmodmap
    fi
  else
    ( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $XMODMAP -pke ) | $XMODMAP -
  fi

  #
  # Switch Sun's Alt and Meta mod mappings
  #

  UNAME=`gdmwhich uname`
  PROCESSOR=`$UNAME -p`
  if  "x$PROCESSOR" = "xsparc" ]; then
    if $XMODMAP | grep mod4 | grep Alt > /dev/null 2>/dev/null
    then
      $XMODMAP -e "clear Mod1" \
               -e "clear Mod4" \
               -e "add Mod1 = Alt_L" \
               -e "add Mod1 = Alt_R" \
               -e "add Mod4 = Meta_L" \
               -e "add Mod4 = Meta_R"
    fi
  fi
fi

SETXKBMAP=`gdmwhich setxkbmap`
if  "x$SETXKBMAP" != "x" ] ; then
  # FIXME: is this all right?  Is this completely on crack?
  # What this does is move the xkb configuration from the GDM_PARENT_DISPLAY
  # FIXME: This should be done in code.  Or there must be an easier way ...
  if  -n "$GDM_PARENT_DISPLAY" ]; then
    XKBSETUP=`( DISPLAY=$GDM_PARENT_DISPLAY XAUTHORITY=$GDM_PARENT_XAUTHORITY $SETXKBMAP -v )`
    if  -n "$XKBSETUP" ]; then
      XKBKEYMAP=`echo "$XKBSETUP" | grep '^keymap' | awk '{ print $2 }'`
      XKBTYPES=`echo "$XKBSETUP" | grep '^types' | awk '{ print $2 }'`
      XKBCOMPAT=`echo "$XKBSETUP" | grep '^compat' | awk '{ print $2 }'`
      XKBSYMBOLS=`echo "$XKBSETUP" | grep '^symbols' | awk '{ print $2 }'`
      XKBGEOMETRY=`echo "$XKBSETUP" | grep '^geometry' | awk '{ print $2 }'`
      if  -n "$XKBKEYMAP" ]; then
        $SETXKBMAP -keymap "$XKBKEYMAP"
      elif  -n "$XKBTYPES" -a -n "$XKBCOMPAT" -a -n "$XKBSYMBOLS" -a -n "$XKBGEOMETRY" ]; then
        $SETXKBMAP -types "$XKBTYPES" -compat "$XKBCOMPAT" -symbols "$XKBSYMBOLS" -geometry "$XKBGEOMETRY"
      elif  -n "$XKBTYPES" -a -n "$XKBCOMPAT" -a -n "$XKBSYMBOLS" ]; then
        $SETXKBMAP -types "$XKBTYPES" -compat "$XKBCOMPAT" -symbols "$XKBSYMBOLS"
      elif  -n "$XKBSYMBOLS" ]; then
        $SETXKBMAP -symbols "$XKBSYMBOLS"
      fi
    fi
  fi
fi

exit 0


I am not familiar with crontab but the command “crontab -l” and “sudo crontab -l” give me no entries.

Puzzling, I’m not quite sure what to suggest.
I had been fairly sure it was being started under systemd because the start command

/usr/bin/syncthing -no-browser -no-restart -logflags=0

is the same as the start command used in the systemd service file.
Is there any chance that you installed syncthing from the syncthing web-site rather than an openSUSE repo? A quick check with

sudo zypper se syncthing

would confirm.
I guess if all else fails you could remove the existing package and re-install it.
Sorry I couldn’t help more.

I’ve been using syncthing successfully for almost a year now, backing up 5 openSUSE boxes on my LAN. I’m not using a WAN facing server.

First attempts where difficult, mainly due to no package availability for 13.2

This was helpful to install under systemd:

https://docs.syncthing.net/users/autostart.html?highlight=systemd#linux

Installing the site package was reasonably successful, but depending on what permissions it was installed with (system-wide or local user), updating from the browser page would lock the program, requiring an stop-restart of the service on the command line.

After upgrading to LEAP 42.3 I could install from the updates repo (currently version 0.14.42, older than the developer site’s). I also installed qsyncthingtray from the OSS repo, which has some info and configuration options (autostart), and it’s own web-like interface, among other goodies.

You may want to disable syncthing autoupdate feature, to avoid installing a non-repo version.

syncthing-inotify is a great tool too, with instant instead of timed backups of modified files:

https://github.com/syncthing/syncthing-inotify

You may want to disable syncthing autoupdate feature, to avoid installing a non-repo version.

syncthing-inotify is a great tool too, with instant instead of timed backups of modified files:

Just to clarify.

  • Auto-update is disabled by default in versions of syncthing from the openSUSE repo.
  • inotify capability is now built into syncthing and can be enabled on a per folder basis from the GUI ( (check FS Watcher Enabled
    under Advanced Settings). The setting is due to be enabled by default, or maybe already is; either way syncthing-inotify is no longer required.

Didn’t know that, thanks. I had disabled it when using the site package, and I assumed the settings carried on when I switched to the repo package.
If you follow the threads in the syncthing fora you’ll see the option to disable is relatively recent. Curiously it still shows the “new version available” banner in some boxes, but not all.

Of course, since version .40. It says so in the github link I posted.

I find syncthingtray very useful, but it’s qt-based. Don’t know about the the -gtk version the OP is using. Also the OP is on Tumbleweed, it may make a difference (I’m running LEAP in all boxes).

I have this same annoying issue since I installed everything about a month ago. I have a work around but would like it permanently solved if possible.

Here is where we are so far,

lee@linux-6y72:~> ps -aux | grep syncthing
gdm       1821  0.8  0.1 1071076 29620 ?       SNsl 10:58   0:01 /usr/bin/syncthing -no-browser -no-restart -logflags=0
lee       3780  0.0  0.0   8688   928 pts/0    S+   11:02   0:00 grep --color=auto syncthing

lee@linux-6y72:~> sudo systemctl status syncthing@gdm.service
[sudo] password for root: 
● syncthing@gdm.service - Syncthing - Open Source Continuous File Synchronization for gdm
   Loaded: loaded (/usr/lib/systemd/system/syncthing@.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:syncthing(1)
lee@linux-6y72:~> sudo systemctl status syncthing@lee.service
● syncthing@lee.service - Syncthing - Open Source Continuous File Synchronization for lee
   Loaded: loaded (/usr/lib/systemd/system/syncthing@.service; disabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: man:syncthing(1)

lee@linux-6y72:~> sudo systemctl -p Wants | grep syncthing
  system-syncthing.slice                                                                         loaded    inactive   dead      system-syncthing.slice
 
lee@linux-6y72:~> sudo zypper se syncthing
Loading repository data...
Reading installed packages...

S  | Name               | Summary                                         | Type       
---+--------------------+-------------------------------------------------+------------
   | QSyncthingTray     | A cross-platform status bar for Syncthing in Qt | application
   | qsyncthingtray     | Qt-based Traybar Application for Syncthing      | package    
i+ | syncthing          | Continuous File Synchronisation                 | package    
   | syncthing          | Continuous File Synchronisation                 | srcpackage 
   | syncthing-gtk      | Syncthing Gtk-based graphical interface         | package    
   | syncthing-gtk-lang | Translations for package syncthing-gtk          | package    
lee@linux-6y72:~> 

I checked on autoupdate feature and it was already off per the package manager I suppose.

Unavailable/Disabled by administrator or maintainer

Any ideas would be most helpful, I am currently leaning towards removing every trace and start over but yuk.

Oh and what I have to do at each login is open the syncthing web access on local and stop the first instance. That instance is not really set up right (even has a different server name I remember some foul up at install) and then the real server config and syncthing is started and all is well.

Whoops just noticed, I am on regular openSUSE leap 15.

Following up on my post in this thread with Leap 15 with Gnome and all up to date from repos.

To stop the crazy behavior I had to remove all syncthing systemd links and just autostart the app from the Gnome tweaks app.

So the commands and probably overkill, you could just remove the links and reboot I believe.

lee@linux-6y72:~> sudo systemctl stop syncthing-resume.service
lee@linux-6y72:~> sudo systemctl disable syncthing-resume.service
lee@linux-6y72:~> sudo systemctl stop syncthing@gdm.service
lee@linux-6y72:~> sudo systemctl disable syncthing@gdm.service

lee@linux-6y72:~> sudo rm /usr/lib/systemd/system/syncthing-resume.service
lee@linux-6y72:~> sudo rm /usr/lib/systemd/system/syncthing@.service
lee@linux-6y72:~> sudo rm /usr/lib/systemd/user/syncthing.service


OK, harder than I thought. I guess I will make up a .desktop file and then somehow autostart that through Gnome???
Otherwise I am back to the systemd service, which I should totally be using but have a bad taste about right now because of the initial issues.

make a syncthing.desktop file

[Desktop Entry]
Name=Syncthing
GenericName=Syncthing file sync tool
Comment=syncthing is for continues file synchronization
Exec=/usr/bin/syncthing
Terminal=false
Type=Application
Categories=Network;FileTransfer;
StartupNotify=false

put it in /home/yourusername/.config/autostart.
I made mine executable but I am not sure that is needed.

Everything works fine now, I think this must be Gnome specific but have not tested any other desktop.