Recreate Device Id

I’ve got Syncthing running on some servers keeping builds, config files etc in sync between them. Today I needed to clone a server, so I took an image and span up a couple of new instances.

Obviously, this meant there was a copy of the syncthing installation - with the same device id, and they aren’t syncing (I assume that there’s something that detects when several nodes all claiming to have the same device id show up), so what I need to do is give them new device Ids.

Today, that means I backup the config file, delete the config and keys, run syncthing -generate (or just restart the service), and then open the newly created config file and merge my old config back in with it. Which is a bit of a pain.

Is there (or can there be) any way of telling syncthing -generate “yes, I do want you to overwrite the keys please”?

Sadly no, and it’s not an often task you have to perform, so I feel the way it works is correct.

Ah well, guess when I get round to scripting it I’ll just have to work around the way it is. Pointing -generate at a new empty folder, copying key files in, and then deleting the new folder isn’t too bad.

And I’m a long way off having a single script to get a whole new server up and running without any manual intervention anyway =)

Simpler is to just delete the keys and restart Syncthing. New keys are generated on startup. The config will still refer to the old device ID as a remote device, which you can then delete or ignore.

1 Like

Oh! Perfect! I thought that the Config file had to match the keys, and it would choke if its “own” device id wasn’t present in the config. If that’s not the case then there’s not a problem. Picking up the old device id as a remote device is exactly how I’d want it to work.

1 Like

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