You are not logged in.

#1 2021-12-12 05:45:48

k395
Member
Registered: 2020-01-29
Posts: 37

[SOLVED] What's the purpose of hostname changing automatically?

Whenever I connect to some corporate Wi-Fi (I'm using the default NetworkManager), the machine hostname automatically changes, and that breaks X applications.

I already figure out

  • how to change the hostname back (temporarily)

  • how to fix the magic cookie to make apps work with the new hostname

  • how to avoid changing the hostname automatically (didn't test?)

But why would the default be changing hostname automatically, if it breaks every X apps?


-----

Update:

The default hostname is archlinux if there's no /etc/hostname. Indeed putting in any valid hostname (even the default archlinux, although it's obviously not recommended) will prevent the hostname from changing, even without hostname-mode=none.

Last edited by k395 (2021-12-26 08:35:27)

Offline

#2 2021-12-12 05:53:05

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: [SOLVED] What's the purpose of hostname changing automatically?

Correctly setting your hostname should prevent NM from using a transient one.

man networkmanager.conf wrote:

hostname-mode

Set the management mode of the hostname. This parameter will affect only the transient hostname. If a valid static hostname is set, NetworkManager will skip the update of the hostname despite the value of this option. An hostname empty or equal to 'localhost', 'localhost6', 'localhost.localdomain' or 'localhost6.localdomain' is considered invalid.

https://man.archlinux.org/man/extra/net … .conf.5.en


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2021-12-12 07:40:48

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,223

Re: [SOLVED] What's the purpose of hostname changing automatically?

But why would the default be changing hostname automatically

To answer the original question of "why is that" - the hostname is communicated to your dhcp server (your router) and can be used by a local dns server (your router) to resolve local network hostnames.
That doesn't work if every expert wants to use the  hostname "localhost".

If you had installed arfch following the wiki installation guide, you'd have come across https://wiki.archlinux.org/title/Networ … e_hostname

Offline

Board footer

Powered by FluxBB