I got around it by changing the old hostname to the new one in these files.
Then doing this:
Finally it stopped automatically putting the old hostname in /etc/hosts
Changing the file in /var/lib/cloud/instance/ is probably not needed since it's a cached copy of /boot/firmware/user-data, but I had reboot fatigue by this point and wasn't taking any chances.![🥴]()
Code:
/boot/firmware/user-data/var/lib/cloud/instance/user-data.txt/etc/hostsCode:
sudo cloud-init cleansudo rebootChanging the file in /var/lib/cloud/instance/ is probably not needed since it's a cached copy of /boot/firmware/user-data, but I had reboot fatigue by this point and wasn't taking any chances.
Statistics: Posted by ljredux — Tue Jul 21, 2026 11:37 am







