Changing hostname does not update hosts file

When changing the hostname on Debian 9 the hosts file is not updated. There is an entry in /etc/hosts for the 127.0.1.1 ip number:

127.0.1.1 name.domainname.com name

This is correctly set when first installing the server, but not updated when changing the hostname from webmin. I haven't found any impact on my server, but is probably best to make sure the hostname in in the hosts file is updated correctly.

See also Debian documentation: https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_ho...

Status: 
Active

Comments

Although the documentation says that with a fixed ip number that number should be in the hosts instead of the 127.0.1.1. I am a bit confused what is the best practice here. Maybe this should not be a bug rapport, but an forum question instead.

Actually, as long as you have the box checked on the Hostname and DNS Options page to update the hosts file entry, and the hosts file has a line for the old hostname, it should be updated.