Syncthing starts with different device IDs

I just upgraded from Debian wheezy to jessie. Had a backup of my .config/syncthing directory, but the upgrade process didn’t modify anything in it (.pem keys and config.xml are binary identical). Syncthing is run from the user’s LXDE autostart:

john@pc:~/.config/lxsession/LXDE$ cat autostart | grep syncthing
@/usr/bin/syncthing -no-browser -home="/home/john/.config/syncthing"

When I looked at the Syncthing GUI at https://127.0.0.1:8384/, the device ID has changed from LNTX to ZEH5 (IDs truncated).

I had this problem before on Windows, where the system-wide autostart launched Syncthing under a different user. But all running Syncthing processes use the user’s configuration:

$ ps aux | grep syncthing
john       1230  0.0  0.2 800832  7072 ?        Sl   13:06   0:00 /usr/bin/syncthing -no-browser -home="/home/john/.config/syncthing"
john       1248  0.5  0.7 801664 27688 ?        Sl   13:06   0:30 /usr/bin/syncthing -no-browser -home="/home/john/.config/syncthing"

And checking open files of the GUI process shows it to be listening at 127.0.0.1:8384:

$ lsof -p 1248 | grep LISTEN
syncthing 1248  john   12u  IPv6  18157      0t0     TCP *:22000 (LISTEN)
syncthing 1248  john   18u  IPv4  17370      0t0     TCP localhost:8384 (LISTEN)

Yet, when I check the device ID on the command line, I get:

$ syncthing -device-id
LNTX [truncated]

In the user’s config.xml, there is no tag containing ZEH5:

$ cat config.xml | grep ZEH5
john@pc:~/.config/syncthing$

But when I kill Syncthing and launch it manually with the same command as in the user’s autostart file, the GUI as well as the command line show device id LNTX.

How can I autostart Syncthing so the GUI shows device id LNTX? And where does the ZEH5 id come from?

As it looks like the command is fine, I would guess there is something funky going on with your home directory. Perhaps it’s encrypted and gets switched around when you log in and Syncthing starts before that, or something.

In the end, the device ID comes from the PEM files in the directory pointed to by -home (or the default, which is the same as your command). This is where you need to look.

I found the culprit, and it’s a bug (or the documentation has to be updated). I was sifting through the logs and found this in ~/.cache/lxsession/LXDE/run.log:

[monitor] 19:28:29 INFO: Starting syncthing
[start] 19:28:29 INFO: Generating ECDSA key and certificate for syncthing...
[ZEH5F] 19:28:31 INFO: syncthing v0.14.39 "Dysprosium Dragonfly" (go1.9 linux-386) deb@build.syncthing.net 2017-09-25 06:05:21 UTC [noupgrade]
[ZEH5F] 19:28:31 INFO: My ID: ZEH5 [truncated]
...
[ZEH5F] 19:28:32 INFO: Default folder created and/or linked to new config
[ZEH5F] 19:28:32 INFO: Defaults saved. Edit /home/john/"/home/john/.config/syncthing"/config.xml to taste or use the GUI

Look at the last line, that malformed directory name /home/john/"/home/john/.config/syncthing" actually exists:

$ ls -lad \"
drwx------ 3 john john 4096 Sep 11 02:13 "

And this is because of the following line in ~/.config/lxsession/LXDE/autostart:

$ cat autostart | grep syncthing
@/usr/bin/syncthing -no-browser -home="/home/john/.config/syncthing"

Change the line to @/usr/bin/syncthing -no-browser -home=/home/john/.config/syncthing (without quotation marks) and Syncthing will run normally again.

Right. So that autostart thing is not actually run by a shell of some sort, and should not have quotes then. Makes sense.

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