This was also suggested upstream[1], but it seems that this is the desired behavior from upstream's perspective.
[1] https://github.com/systemd/systemd/issues/12793 ** Bug watch added: github.com/systemd/systemd/issues #12793 https://github.com/systemd/systemd/issues/12793 ** Changed in: systemd (Ubuntu) Status: New => Won't Fix -- You received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to systemd in Ubuntu. https://bugs.launchpad.net/bugs/1934456 Title: The "hostnamectl" command does not modify the hosts file. Status in systemd package in Ubuntu: Won't Fix Bug description: When you want to change the name of the server with the "hostnamectl" command: The /etc/hostname file is changing as it should. However, the old name of the server remains in the /etc/hosts file. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1934456/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : [email protected] Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp

