Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] hostname is changed
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
murrcoss
n00b
n00b


Joined: 09 Jun 2021
Posts: 4
Location: Germany

PostPosted: Wed Jun 09, 2021 6:14 am    Post subject: [SOLVED] hostname is changed Reply with quote

Hi everyone,

when I boot in gentoo my hostname is changed to something like: username@2001... (ipv6-adress)

i think this happens, when i login to my wired network.

when i log in to kde, i can start programms (like my browser), but after some minutes i can't start any programms.

i have to change to a terminal, type in "sudo hostname gentoo", and then log out and log in. and then everything works as it should

can someone help me with this?


Last edited by murrcoss on Sun Jun 13, 2021 5:27 pm; edited 1 time in total
Back to top
View user's profile Send private message
wwdev16
n00b
n00b


Joined: 29 Aug 2018
Posts: 52

PostPosted: Wed Jun 09, 2021 8:31 am    Post subject: Reply with quote

Is the interface address being changed too? Use the ip addr command.
If the address changes I would suspect some kind of automatic network
configuration service is running and then breaking things, perhaps a
dhcp client.
Back to top
View user's profile Send private message
murrcoss
n00b
n00b


Joined: 09 Jun 2021
Posts: 4
Location: Germany

PostPosted: Wed Jun 09, 2021 8:38 am    Post subject: Reply with quote

i have a dhcp client. it is working and i get a local ipv4 and ipv6 address. but something is making the dhcp-client to set the hostname.

i am using the kde-networkmanager
Back to top
View user's profile Send private message
spica
Apprentice
Apprentice


Joined: 04 Jun 2021
Posts: 284

PostPosted: Wed Jun 09, 2021 11:15 am    Post subject: Reply with quote

murrcoss,
This is how to tell NetworkManager to ignore hostname provided via DHCP (restart required):
/etc/NetworkManager/NetworkManager.conf

Code:
[main]
plugins=keyfile

[keyfile]
hostname=gentoo
Back to top
View user's profile Send private message
murrcoss
n00b
n00b


Joined: 09 Jun 2021
Posts: 4
Location: Germany

PostPosted: Wed Jun 09, 2021 1:09 pm    Post subject: Reply with quote

spica,

sorry, this did not work, i did a restart:

I had to create that file:

Code:
murrcoss@200116b8(...) ~ $ cat /etc/NetworkManager/NetworkManager.conf
[main]
plugins=keyfile

[keyfile]
hostname=gentoo
Back to top
View user's profile Send private message
Fitzcarraldo
Advocate
Advocate


Joined: 30 Aug 2008
Posts: 2034
Location: United Kingdom

PostPosted: Wed Jun 09, 2021 1:57 pm    Post subject: Reply with quote

In earlier days it was necessary to specify the hostname in /etc/NetworkManager/NetworkManager.conf but that is no longer required and has no effect. According to NetworkManager.conf(5) man page: ‘This key is deprecated and has no effect since the hostname is now stored in /etc/hostname or other system configuration files according to build options.’

If NetworkManager was merged with the dhclient USE flag set then specify the hostname in /etc/hosts, /etc/conf.d/hostname, /etc/hostname and /etc/dhcp/dhclient.conf:

Code:
# grep -v "^#\|^$" /etc/dhcp/dhclient.conf
send host-name "gentoo";
supersede host-name "gentoo";


The purpose of the ‘supersede‘ statement in dhclient.conf is explained in man dhclient.conf(5):

Quote:
supersede [ option declaration ] ;

If for some option the client should always use a locally-configured value or values rather than whatever is supplied by the server, these values can be defined in the supersede statement.


How I install and configure NetworkManager in Gentoo Linux: Using NetworkManager in Gentoo Linux
_________________
Clevo W230SS: amd64, VIDEO_CARDS="intel modesetting nvidia".
Compal NBLB2: ~amd64, xf86-video-ati. Dual boot Win 7 Pro 64-bit.
OpenRC udev elogind & KDE on both.

Fitzcarraldo's blog
Back to top
View user's profile Send private message
murrcoss
n00b
n00b


Joined: 09 Jun 2021
Posts: 4
Location: Germany

PostPosted: Sun Jun 13, 2021 5:27 pm    Post subject: Reply with quote

Fitzcarraldo: Thanks, that helped! :)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum