/etc/hostname is empty when RHEL9 is installed without hostname setting.
Issue
- In a newer installed RHEL9 system, /etc/hostname is empty when the system is installed without hostname setting.
# cat /etc/hostname
# hostname
localhost.localdomain
# hostnamectl
Static hostname: (unset)
Transient hostname: localhost
Icon name: computer-vm
Chassis: vm
Machine ID: 3fb65b43c78c40678a95ce7465f0041c
Boot ID: 28cc48f6d7d04a859c2af9b7c1cfbb61
Virtualization:
Operating System: Red Hat Enterprise Linux 9.3 (Plow)
CPE OS Name: cpe:/o:redhat:enterprise_linux:9::baseos
Kernel: Linux 5.14.0-362.8.1.el9_3.x86_64
Architecture: x86-64
- In past RHEL7 and RHEL8, /etc/hostname is set as "localhost.localdomain " when the system is installed without hostname setting.
# cat /etc/hostname
localhost.localdomain
# hostname
localhost.localdomain
# hostnamectl
Static hostname: localhost.localdomain
Icon name: computer-vm
Chassis: vm
Machine ID: 1b5c61eb3d904caba9a3ce019fb2ec9d
Boot ID: a39338d74de7489b82ea125cf55b88e2
Virtualization:
Operating System: Red Hat Enterprise Linux 8.10 (Ootpa)
CPE OS Name: cpe:/o:redhat:enterprise_linux:8::baseos
Kernel: Linux 4.18.0-553.el8_10.x86_64
Architecture: x86-64
Environment
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- systemd-hostnamed
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.