Cannot reset a cloned system to use a new peer ID #2147

Open
opened 2025-11-20 07:04:46 -05:00 by saavagebueno · 6 comments
Owner

Originally created by @iandol on GitHub (Aug 2, 2025).

Describe the problem

I have netbird setup on a Ubuntu 24.04 system (lets call it {mother}). I do a netbird down then clone (clonezilla) the disk to 5 new systems. In the new systems I change the hostname with hostnamectl set-hostname $newname, edit /etc/hosts, remove /etc/machine-id and /var/lib/dbus/machine-id, regenerate the machine ID with sudo dbus-uuidgen --ensure=/etc/machine-id then reboot. The machine-id and hostname are new, then I do a netbird up --setup-key XXX -- but the {child} clone still shows the IP and domain name of the {mother}, thus each child appears as {mother} to netbird. I tried to do a sudo apt purge netbird and reinstall but whatever file netbird is using sticks around.

The only workaround is to create a new profile and select it then up it with the setup key and it finally gets a new IP and name. The broken default profile cannot be removed.

To Reproduce

Steps to reproduce the behavior:

  1. Install netbird on Ubuntu.
  2. Clone the system to a new device.
  3. Reset machine-id and hostname of the clone.
  4. Netbird keeps adding the new device as if it was the old one.

Expected behavior

Use the machine-id and/or hostname of the current device to check when it registers to the netbird network.

Are you using NetBird Cloud?

Yes

NetBird version

0.52.2

Is any other VPN software installed?

Clash Verge Rev https://github.com/clash-verge-rev/clash-verge-rev, though it is not running.

Debug output

Sorry my cloned systems are down, I can attach later...

Screenshots

Additional context

Have you tried these troubleshooting steps?

  • [X ] Reviewed client troubleshooting (if applicable)
  • [X ] Checked for newer NetBird versions
  • [X ] Searched for similar issues on GitHub (including closed ones)
  • [X ] Restarted the NetBird client
  • [X ] Disabled other VPN software
  • [X ] Checked firewall settings
Originally created by @iandol on GitHub (Aug 2, 2025). **Describe the problem** I have netbird setup on a Ubuntu 24.04 system (lets call it _{mother}_). I do a netbird down then clone (clonezilla) the disk to 5 new systems. In the new systems I change the hostname with `hostnamectl set-hostname $newname`, edit `/etc/hosts`, remove `/etc/machine-id` and `/var/lib/dbus/machine-id`, regenerate the machine ID with `sudo dbus-uuidgen --ensure=/etc/machine-id` then reboot. The machine-id and hostname are new, then I do a `netbird up --setup-key XXX` -- but the _{child}_ clone still shows the IP and domain name of the _{mother}_, thus each child appears as {mother} to netbird. I tried to do a `sudo apt purge netbird` and reinstall but whatever file netbird is using sticks around. The only workaround is to create a new profile and select it then `up` it with the setup key and it finally gets a new IP and name. The broken default profile cannot be removed. **To Reproduce** Steps to reproduce the behavior: 1. Install netbird on Ubuntu. 2. Clone the system to a new device. 3. Reset `machine-id` and `hostname` of the clone. 4. Netbird keeps adding the new device as if it was the old one. **Expected behavior** Use the machine-id and/or hostname of the current device to check when it registers to the netbird network. **Are you using NetBird Cloud?** Yes **NetBird version** 0.52.2 **Is any other VPN software installed?** Clash Verge Rev <https://github.com/clash-verge-rev/clash-verge-rev>, though it is not running. **Debug output** Sorry my cloned systems are down, I can attach later... **Screenshots** **Additional context** **Have you tried these troubleshooting steps?** - [X ] Reviewed [client troubleshooting](https://docs.netbird.io/how-to/troubleshooting-client) (if applicable) - [X ] Checked for newer NetBird versions - [X ] Searched for similar issues on GitHub (including closed ones) - [X ] Restarted the NetBird client - [X ] Disabled other VPN software - [X ] Checked firewall settings
saavagebueno added the triage-needed label 2025-11-20 07:04:46 -05:00
Author
Owner

@hakim89 commented on GitHub (Aug 13, 2025):

I am seeing the same behavior on multiple cloned RPIs with one setup key is installed on multiple of them. There's only one peer showing in the dashboard although all have different hostnames. Any solution?

@hakim89 commented on GitHub (Aug 13, 2025): I am seeing the same behavior on multiple cloned RPIs with one setup key is installed on multiple of them. There's only one peer showing in the dashboard although all have different hostnames. Any solution?
Author
Owner

@iandol commented on GitHub (Aug 13, 2025):

@hakim89 -- my only solution is to use netbird profile add [name] and then netbird profile select [name] then when you do a new netbird up --setup-key XXX it will use the clone's hostname and create a new peer properly. For some reason you cannot delete the default (broken) profile.

By the way for this to work you must ensure you give the clone a new hostname etc. before you do this. I use the following function to do this for me, it is written for the elvish shell so you'll need to tweak for zsh/bash etc. It also resets the MachineID and removes SSH keys as is recommended for a Linux clone...

692a28f6d1/shells/elvish/aliases.elv (L87)

@iandol commented on GitHub (Aug 13, 2025): @hakim89 -- my only solution is to use `netbird profile add [name]` and then `netbird profile select [name]` then when you do a new `netbird up --setup-key XXX` it will use the clone's hostname and create a new peer properly. For some reason you cannot delete the default (broken) profile. By the way for this to work you must ensure you give the clone a new hostname etc. before you do this. I use the following function to do this for me, it is written for the elvish shell so you'll need to tweak for zsh/bash etc. It also resets the MachineID and removes SSH keys as is recommended for a Linux clone... https://codeberg.org/iandol/dotfiles/src/commit/692a28f6d13165e061648424d11d6c041db1fc3e/shells/elvish/aliases.elv#L87
Author
Owner

@nazarewk commented on GitHub (Aug 14, 2025):

So far (might change in future) the identity of the Peer is tied solely to the WireGuard private key stored in config.json or the profile equivalent. You need to delete that file at the end of image baking/restoring step.

@nazarewk commented on GitHub (Aug 14, 2025): So far (might change in future) the identity of the Peer is tied solely to the WireGuard private key stored in `config.json` or the profile equivalent. You need to delete that file at the end of image baking/restoring step.
Author
Owner

@iandol commented on GitHub (Aug 14, 2025):

Would that be /var/lib/netbird/config.json and/or /etc/netbird/config.json? Or is it some global wireguard config separate from netbird?

@iandol commented on GitHub (Aug 14, 2025): Would that be `/var/lib/netbird/config.json` and/or `/etc/netbird/config.json`? Or is it some global wireguard config separate from netbird?
Author
Owner

@hakim89 commented on GitHub (Aug 14, 2025):

doing netbirtd down; then deleting /etc/netbird/config.json and then netbird up worked for me.

@hakim89 commented on GitHub (Aug 14, 2025): doing `netbirtd down`; then deleting `/etc/netbird/config.json` and then `netbird up `worked for me.
Author
Owner

@iandol commented on GitHub (Aug 15, 2025):

I'm using the latest netbird release 0.54.2 and there is no /etc/netbird/config.json file on my cloned system, there is an install.json there but it doesn't have any wireguard keys. It seems the new profile feature moved files into /var/lib/netbird -- there is no config.json but there are profile-related ones like default.json, I tried deleting the whole folder content but I got a netbird error that the profile can't be loaded. The workaround is to create a new profile, switch to it, then recreate default, then switch back, then netbird up. This is harder than just deleting a file...

@iandol commented on GitHub (Aug 15, 2025): I'm using the latest netbird release 0.54.2 and there is no `/etc/netbird/config.json` file on my cloned system, there is an `install.json` there but it doesn't have any wireguard keys. It seems the new profile feature moved files into `/var/lib/netbird` -- there is no `config.json` but there are profile-related ones like `default.json`, I tried deleting the whole folder content but I got a netbird error that the profile can't be loaded. The workaround is to create a new profile, switch to it, then recreate default, then switch back, then `netbird up`. This is harder than just deleting a file...
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#2147