[Bug 2067333] Re: hostnamectl --set-hostname doesn't update /etc/hosts

Nick Rosbrook 2067333 at bugs.launchpad.net
Tue May 28 14:37:27 UTC 2024


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.

** 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
Foundations Bugs, which is subscribed to systemd in Ubuntu.
https://bugs.launchpad.net/bugs/2067333

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

Status in systemd package in Ubuntu:
  Won't Fix

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

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2067333/+subscriptions




More information about the foundations-bugs mailing list