Ahoj,
when I reboot my computer, it (sometimes? -- at least in interactive startup the hostname was set correctly at least once) fails to set the correct hostname, and instead has "archlinux" set as hostname.
I use OpenRC as init system.
In /etc/hostname I have my desired hostname, and doing a /etc/init.d/hostname restart does set my hostname.
The init script hostname is started automatically at boot.
The output of rc-update:
NetworkManager | boot
acpid | boot
agetty.tty1 | default
agetty.tty2 | default
agetty.tty3 | default
agetty.tty4 | default
agetty.tty5 | default
agetty.tty6 | default
alsasound | boot
binfmt | boot
bootmisc | boot
cgroups | sysinit
cupsd | default
dbus | default
devfs | sysinit
dmesg | sysinit
dovecot | default
dropbear | default
elogind | boot
fcron | default
fsck | boot
gpm | boot
hostname | boot
hwclock | boot
keymaps | boot
killprocs | shutdown
kmod-static-nodes | sysinit
local | default nonetwork
localmount | boot
loopback | boot
metalog | boot
modules | boot
mount-ro | shutdown
mtab | boot
net.lo | boot
netmount | default
opensysusers | boot
opentmpfiles-dev | sysinit
opentmpfiles-setup | boot
postfix | default
procfs | boot
root | boot
save-keymaps | boot
save-termencoding | boot
savecache | shutdown
sddm | default
seedrng | boot
swap | boot
sysctl | boot
sysfs | sysinit
termencoding | boot
udev | sysinit
udev-trigger | sysinit
uksmd | default
grep . /etc/rc.conf | grep -v '^#' (i.e. lines that have non-commented out content):
rc_parallel="NO"
rc_interactive="YES"
rc_shell=/usr/bin/sulogin
rc_depend_strict="NO"
rc_logger="NO"
rc_log_path="/var/log/rc.log"
rc_verbose=no
rc_start_wait=0
rc_crashed_stop=NO
rc_crashed_start=YES
rc_nocolor=NO
unicode="YES"
rc_tty_number=12
After I discovered this, I also tried to set hostname already in the initcpio; for this I added the hostdata hook, but it did not resolve the issue, the hostname after system boot is not my desired hostname but archlinux.
I did a grep -r archlinux /etc | grep -v pacman.d/mirrorlist-arch, and it does not show anything suspicious.
I discovered that there is also a file /etc/conf.d/hostname, it contains
# Hostname fallback if /etc/hostname does not exist
hostname="localhost"
and should not play a role since /etc/hostname exists.
What might be the issue here?
Regards!