I'm running an arch system with KDE4/Plasma, wpa_supplicant, networkmanager, systemd ...
# cat /proc/version
Linux version 5.0.0-arch1-1-ARCH (builduser@heftig-18825) (gcc version 8.2.1 20181127 (GCC)) #1 SMP PREEMPT Mon Mar 4 14:11:43 UTC 2019
The content of my /etc/hostname
reads localhost
.
After boot, the shell command hostname
now outputs localhost
. More precisely:
# hostnamectl
Static hostname: localhost
Transient hostname: localhost.localdomain
Icon name: computer-laptop
Chassis: laptop
Machine ID: 7e0a101cd2f0406497a6e4354fc9b3b7
Boot ID: a1424a0995da4e84b1e55b7f79df957e
Operating System: Arch Linux
Kernel: Linux 5.0.0-arch1-1-ARCH
Architecture: x86-64
When I turn on WiFi, networkmanager connects to a WiFi network and then the hostname changes. For instance:
# hostnamectl
Static hostname: localhost
Transient hostname: localhost.localdomain
Icon name: computer-laptop
Chassis: laptop
Machine ID: 7e0a101cd2f0406497a6e4354fc9b3b7
Boot ID: a1424a0995da4e84b1e55b7f79df957e
Operating System: Arch Linux
Kernel: Linux 5.0.0-arch1-1-ARCH
Architecture: x86-64
The shell command hostname
now outputs localhost.localdomain
instead of localhost
.
As a consequence, the KDE lock-screen cannot be unlocked and I cannot start any X applications from the terminal in KDE (or any other desktop). A typical error message is this:
$ gvim
Invalid MIT-MAGIC-COOKIE-1 keyE233: cannot open display
When I issue hostnamectl set-hostname localhost
as root, the behavior resumes to normal.
In some other WiFis, the hostname after connect is not localhost.localdomain
but something even more random (it seems to be a hostname determined by the WiFi provider, mostly in big corporate networks). Why does a WiFi provider have the power to set my hostname?
Can this be changed somehow?