Linux更改machine-ID
用systemd-machine-id-setup
可以重新生成machine ID。
如果DBUS machine ID存在的话,会直接将其拷贝过来,所以可以先更新DBUS machine ID:
sudo bash -c "dbus-uuidgen > /var/lib/dbus/machine-id"
sudo rm /etc/machine-id
sudo systemd-machine-id-setup
Initializing machine ID from D-Bus machine ID.
也可以把/var/lib/dbus/machine-id
和/etc/machine-id
一起删除,再用systemd-machine-id-setup
重新生成/etc/machine-id
,然后再创建一个符号链接:
sudo rm /var/lib/dbus/machine-id /etc/machine-id
sudo systemd-machine-id-setup
sudo ln -s /etc/machine-id /var/lib/dbus/machine-id
ArchLinux的/var/lib/dbus/machine-id
默认就是一个指向/etc/machine-id
的符号链接。
参考: