overengineering: hostnamectl

How do you set the hostname of a Linux machine? It used to be you just put it in the file /etc/hostname. Now, at least on CentOS, the SystemD way is to use the hostnamectl command. There are other ways (GUI and TUI) but I think hostnamectl is the real way. This lets you set the real, pretty, and transient name of the host. I didn't know those existed. In fact, there are lots of other options. The text space of the hostnamectld is 272K (40% larger than the text editor I use and 2.5 times the size of the hostname command). You can even change the hostname of other machines and hostnamectl will use ssh to accomplish this. I don't see why it is hostnamectl's job to know how to ssh. I will admit that the good old days were not that wonderful. The hostname(1) manpage lists: hostname - show or set the system's host name domainname - show or set the system's NIS/YP domain name ypdomainname - show or set the system's NIS/YP domain name nisdomainname - show or set the system's NIS/YP domain name dnsdomainname - show the system's DNS domain name and a lot of flags. And there's uname -n. I remember uuname but that is no longer standard -- you'd have to install uucp to get that. Every ethernet interface can have one or more DNS names. And plenty more that I don't remember. Kerberos? SMB? Hesiod? To be honest, what bothers me is that there seem to be several different models of what a hostname is. It would be nice if we actually could delete some of these interfaces, and merge some others, leaving behind only one model. Maybe the SystemD model is that one.

On Sun, Aug 28, 2016 at 8:41 PM, D. Hugh Redelmeier via talk <talk@gtalug.org> wrote:
How do you set the hostname of a Linux machine? It used to be you just put it in the file /etc/hostname. snip
To be honest, what bothers me is that there seem to be several different models of what a hostname is. It would be nice if we actually could delete some of these interfaces, and merge some others, leaving behind only one model. Maybe the SystemD model is that one.
Hmmmmmm - - - as it was explained to me systemd wants to be ALL things to all systems, covering every background detail - - - - that sounds like a recipe for disaster to me!!! Dee (relying on the reports of those with far more experience than I!!)

On Sun, 28 Aug 2016 21:33:29 -0500 o1bigtenor via talk <talk@gtalug.org> wrote:
How do you set the hostname of a Linux machine? It used to be you just put it in the file /etc/hostname. snip To be honest, what bothers me is that there seem to be several different models of what a hostname is. It would be nice if we actually could delete some of these interfaces, and merge some others, leaving behind only one model. Maybe the SystemD model is that one. Hmmmmmm - - - as it was explained to me systemd wants to be ALL things to all systems, covering every background detail - - - - that sounds
On Sun, Aug 28, 2016 at 8:41 PM, D. Hugh Redelmeier via talk <talk@gtalug.org> wrote: like a recipe for disaster to me!!!
my take is that the subject line says exactly what the problem is, that and that there is a "highlander" thing ongoing... 2c Andre

On Sun, Aug 28, 2016 at 09:41:24PM -0400, D. Hugh Redelmeier via talk wrote:
How do you set the hostname of a Linux machine? It used to be you just put it in the file /etc/hostname.
Now, at least on CentOS, the SystemD way is to use the hostnamectl command. There are other ways (GUI and TUI) but I think hostnamectl is the real way.
This lets you set the real, pretty, and transient name of the host. I didn't know those existed. In fact, there are lots of other options.
The text space of the hostnamectld is 272K (40% larger than the text editor I use and 2.5 times the size of the hostname command).
You can even change the hostname of other machines and hostnamectl will use ssh to accomplish this. I don't see why it is hostnamectl's job to know how to ssh.
Well given systemd has a lot of container and VM support, having a command that supports controlling those thigns the same as the other systemd tools can do makes sense. It also does a lot more than just the hostname, including setting system type, some kind of deployment options (sounds like container/vm stuff again), and other things. So as a replacement for hostname, it is large and overkill, but given that's a tiny part of what it does, it isn't quite that crazy. -- Len Sorensen
participants (4)
-
ac
-
D. Hugh Redelmeier
-
lsorense@csclub.uwaterloo.ca
-
o1bigtenor