On 27/10/2023 21:19, Greg Wooledge wrote:
More importantly, why on earth would this be recommended over editing the /etc/hostname file, which is *much* simpler, and which appears to be independent of the init system that's in use?

hostnamectl tries to prevent split brain /etc/hostname vs. kernel structures in RAM. "hostnamectl hostname --transient NAME" does not work if /etc/hostname is present. Notice diverged static and transient names in Gene's message

   Static hostname: coyote.home.arpa
Transient hostname: coyote

"hostnamectl hostname NAME" besides changing /etc/hosts calls sethostname(2) (or what libc provided instead of it), so it is less chance that a user will get inconsistent settings by forgetting another command.

I think, original intention was to provide D-Bus API for GUI and hostnamectl is just a CLI tool for that API.

Reply via email to