Ubuntu主机名更改后失效,可能是以下原因及解决方法:
sudo systemctl restart networking
sudo netplan apply
127.0.1.1 oldname
127.0.1.1 newname
/etc/cloud/cloud.cfg
preserve_hostname
false
sudo systemctl restart nscd
sudo systemctl restart ssh