From: Alex Sassmannshausen <alex.sassmannshau...@gmail.com>
Subject: Re: networkmanager hostname woes
Date: Wed, 13 Sep 2017 17:47:43 +0200
AFAIU, the cause is that networkmanager changes my hostname (after
DHCP?), in my case to “new-host2” or something similar, and this
seems to break the X session. When I manually restore the hostname
with “sudo hostname <original-hostname>”, the problem is solved.
Is
there anyway to disable this behaviour for networkmanager?
[...]
This makes me think that it might be a network configuration
derived issue — but I have not been able to get to the bottom of
this
yet…
I see that you might be based in Belgium — I am too, and my home
network
uses most of the defaults from Proximus' B-Box 2. If this is the
case
for you too, then perhaps it is a matter of the default settings in
that
router?
Yes, I'm using the same router, and I can agree it's not
“professional”-grade :-). Still, I don't think a bad router
configuration should be able to change my hostname.
Following Christopher Baines' suggestion, I created /etc/hostname by
adding the following to my system configuration:
(define etc-hostname-service-type
(service-type (name 'etc-hostname)
(extensions
(list (service-extension etc-service-type
(lambda (hostname)
(list `("hostname"
,(plain-file "hostname" hostname)))))))))
and in the (operating-system (services ...)) list:
(service etc-hostname-service-type host-name)
I don't know if this kind of extension should be added to an existing
service (networkmanager itself, perhaps?). Though I have the feeling
a more proper solution should exist.
From what I've read, it might also be a DHCP issue: some DHCP
clients are configured to take on the hostname offered by the
router, perhaps that could/should be changed? I see that wicd has
its own settings for these things (/etc/wicd/wireless-settings.conf
contains things like usedhcphostname = 0). I'm hoping someone with
more experience can give some advice here :)
Thomas