You are not logged in.

#1 2017-11-19 18:39:04

horseBehindFirewall
Member
Registered: 2017-11-19
Posts: 4

[Solved] NetworkManager sets hostname without my intervention

So I have installed Arch Linux 2 days ago. I have configured hostname to be "localhost" in /etc/hostname file.
Yesterday I have noticed in my terminal that my hostname is set to "archlinux".
I did not set it to "archlinux". I have checked /etc/hostname file and it is still set to "localhost".
After that I have started looking at logs with journalctl and found that NetworkManager has set hostname to "archlinux".

https://imgur.com/uMWn2OC

Can someone explain how to force it to use hostname provided via /etc/hostname and why it was changed by itself in the first place.

Last edited by horseBehindFirewall (2017-11-20 12:31:22)

Offline

#2 2017-11-19 18:49:20

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,576
Website

Re: [Solved] NetworkManager sets hostname without my intervention

And what's in /etc/hosts?

Please post the content as text, not as a photo of text.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#3 2017-11-19 19:02:57

seth
Member
Registered: 2012-09-03
Posts: 51,905

Re: [Solved] NetworkManager sets hostname without my intervention

"localhost" is the default and conflictive hostname and networkmanager alters it for that reason.
solution: don't use networkmanager, but "localhost" is no reasonable choice for a hostname anyway.
Notice that "localhost" will still resolve 127.0.0.1 even if you configure your hostname to "stable"

Offline

#4 2017-11-19 19:35:09

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

Re: [Solved] NetworkManager sets hostname without my intervention

Moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2017-11-19 23:29:28

horseBehindFirewall
Member
Registered: 2017-11-19
Posts: 4

Re: [Solved] NetworkManager sets hostname without my intervention

Trilby wrote:

And what's in /etc/hosts?

Please post the content as text, not as a photo of text.

[nikola@archlinux ~]$ cat /etc/hosts
127.0.0.1    localhost.localdomain    localhost
::1        localhost.localdomain    localhost
127.0.1.1    localhost.localdomain    localhost
127.0.0.2    localhost.localdomain    localhost

Offline

#6 2017-11-20 07:44:02

seth
Member
Registered: 2012-09-03
Posts: 51,905

Re: [Solved] NetworkManager sets hostname without my intervention

Last try:
https://wiki.archlinux.org/index.php/Ne … e_hostname

A hostname is a unique name created to identify a machine on a network

Offline

#7 2017-11-20 07:53:35

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

Re: [Solved] NetworkManager sets hostname without my intervention

How did you install Arch?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2017-11-20 11:48:38

horseBehindFirewall
Member
Registered: 2017-11-19
Posts: 4

Re: [Solved] NetworkManager sets hostname without my intervention

seth wrote:

Last try:
https://wiki.archlinux.org/index.php/Ne … e_hostname

A hostname is a unique name created to identify a machine on a network

It is unique. It's only machine on my network with that name big_smile and I'm not even running DNS/mDNS or LLMNR.

Offline

#9 2017-11-20 12:04:24

phw
Member
Registered: 2013-05-27
Posts: 318

Re: [Solved] NetworkManager sets hostname without my intervention

As localhost is a reserved hostname with special meaning* using it as the hostname sounds like a bad idea calling for trouble. At least it is not surprising that it causes some issues. Networkmanager seems to fall back to its default in case it gets "localhost" as the host. Why not use a proper name then?

* https://tools.ietf.org/html/rfc6761#section-6.3

Offline

#10 2017-11-20 12:17:12

horseBehindFirewall
Member
Registered: 2017-11-19
Posts: 4

Re: [Solved] NetworkManager sets hostname without my intervention

phw wrote:

As localhost is a reserved hostname with special meaning* using it as the hostname sounds like a bad idea calling for trouble. At least it is not surprising that it causes some issues. Networkmanager seems to fall back to its default in case it gets "localhost" as the host. Why not use a proper name then?

* https://tools.ietf.org/html/rfc6761#section-6.3

Too lazy to be creative about hostnames. But yes I agree.

Btw how do I mark thread as solved? I was looking at forum for answer and just found to edit the name with "[Solved]" but I can't find edit buttons around thread name, only on comments.

Last edited by horseBehindFirewall (2017-11-20 12:17:29)

Offline

#11 2017-11-20 12:30:32

seth
Member
Registered: 2012-09-03
Posts: 51,905

Re: [Solved] NetworkManager sets hostname without my intervention

Edit your first post, you can alter the subject line there.

Offline

Board footer

Powered by FluxBB