[systemd-devel] hostnamectl reapplying the same hostname

Thomas HUMMEL thomas.hummel at pasteur.fr
Mon May 25 14:19:37 UTC 2020


Hello,

the point below has been buried at the end one of a previous thread. So 
feel free to ignore it if you find it irrelevant.

With systemd-239 on linux 4.18.0 (CentOS 8.1), why does hostnamectl 
--static set-hostname <name> instantly sets the transient hostname to 
<name> *only* when <name> is not the current static hostname ?

Seems to me different from the caching mecanism which explained name 
sync delays the other way around, no ?

Example:


# cat /proc/sys/kernel/hostname
foobar
# hostnamectl
    Static hostname: toto
Transient hostname: foobar
          Icon name: computer-server
            Chassis: server
         Machine ID: 40c61e5c178b444598b68284b02d4148
            Boot ID: efd28246f1dd4a069db77e3f8f1399dc
   Operating System: CentOS Linux 8 (Core)
        CPE OS Name: cpe:/o:centos:centos:8
             Kernel: Linux 4.18.0-147.5.1.el8_1.x86_64
       Architecture: x86-64
# hostnamectl --static set-hostname toto
# cat /proc/sys/kernel/hostname
foobar

whereas

# hostnamectl --static set-hostname titi
# cat /proc/sys/kernel/hostname
titi


Thanks

--
TH.


More information about the systemd-devel mailing list