I’m reinstalling my server and would like to keep my Tailscale installation for the new setup. I assume I can just copy my installation files over and as long as the machine uses the same hostname, it should be fine? Which files do I need to move to the new machine?
The most important thing is that I need to keep the existing Tailscale hostname and IP address for the machine.
I really tried to search for this, but only got unrelated results, so I’m sorry if this was asked multiple times already…
I actually tried it today and was hoping that moving /var/lib/tailscale/ to the new machine would be sufficient. Unfortunately it did not work. Running tailscale up still asked me to authenticate (and actually overwrote the files I had moved to /var/lib/tailscale/ I think), and it was seen as a new device. Since it was not that big a deal, I set it up as a new machine and removed the old one.
However, I would still like to know if it should have been possible to move the installation, and if yes, how. It might be helpful in the future and also to other people having the same issue. Thanks!
Moving the data to a new machine is not recommended because /var/lib/tailscale contains private keys and those should generally not be copied or moved between machines because it is hard to do so securely and since those keys are proof of identity, the client can not operate correctly if its keys have been duplicated.
Having said that, shutting down tailscale on the old device, moving the contents of /var/lib/tailscale and starting it on the new device should currently work as long as the permissions are preserved. This will likely stop working at some point in the future as additional security is added (e.g. key storage in a device’s TPM or operating system’s secret store).
If you can accept the Tailscale IP address changing but the hostname remaining the same, that is much simpler: rename or delete the old device, then set up the new device with the desired hostname (either by setting its hostname in the operating system, configuring it from the command line, or renaming it from the admin panel).
Having said that, shutting down tailscale on the old device, moving the contents of /var/lib/tailscale and starting it on the new device should currently work as long as the permissions are preserved.
It didn’t work for me, but to be honest, I didn’t look into it in detail. Probably a permission issue, even though the Restic backup should have preserved all owners and permissions.
rename or delete the old device, then set up the new device with the desired hostname
That’s exactly how I did it in the end. I only had to adjust the Tailscale IP in some config files on the server, but when accessing the device, I always use the hostname, so no changes necessary there.