hostnamectl --set-hostname doesn't update /etc/hosts

Bug #2067333 reported by Luke
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
systemd (Ubuntu)
Won't Fix
Undecided
Unassigned

Bug Description

hostnamectl is a System API that updates all important OS references to the hostname, so the operator does not need to know them.

Having to manually update /etc/hosts defeats the purpose of having the System API & leaves the OS in an inconsistent state

Revision history for this message
Nick Rosbrook (enr0n) wrote :

You could install libnss-myhostname (provided by systemd) instead of adding the hostname to /etc/hosts. libnss-myhostname takes care of mapping the local hostname to 127.0.0.1, so that listing the hostname explicitly in /etc/hosts is not necessary. See https://github.com/systemd/systemd/issues/12793 for more.

Ubuntu does not ship libnss-myhostname by default, so I see why one would end up adding their hostname to /etc/hosts manually. But, from the upstream perspective, it is not necessary for systemd-hostnamed to modify /etc/hosts, so I don't think there is anything to do here.

Changed in systemd (Ubuntu):
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.