Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
hostname incorrect (solved)
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
mcnutty
n00b
n00b


Joined: 29 Dec 2009
Posts: 13

PostPosted: Sun Feb 19, 2017 1:44 am    Post subject: hostname incorrect (solved) Reply with quote

Hi,

I was having problems with my system and booted into a Mint live cd I had lying around. After I got everything sorted out, I'm faced with a new issue. The live cd apparently made some change to my networking config because my hostname is set to 'mint'.

However, both /etc/hosts and /etc/conf.d/hostname show the correct hostname. I've basically done a full grep on my entire system looking for where the word mint even shows up and the only place I can find it is in /var/run/user/1000/KSMserver__0 (where 1000 is presumably my user id). If I edit this file things go back to normal, but it is reset back to mint when I reboot.

Can anyone help me fix this.

Thanks


Last edited by mcnutty on Sun Feb 19, 2017 11:55 pm; edited 1 time in total
Back to top
View user's profile Send private message
fcl
n00b
n00b


Joined: 31 Dec 2016
Posts: 71

PostPosted: Sun Feb 19, 2017 2:31 am    Post subject: Reply with quote

I've run into this once. You probably get Mint hostname from the DHCP server. Check your dhcp program's manual how to send Gentoo's hostname.
Back to top
View user's profile Send private message
mcnutty
n00b
n00b


Joined: 29 Dec 2009
Posts: 13

PostPosted: Sun Feb 19, 2017 5:01 pm    Post subject: Reply with quote

I don't know much about configuring dhcp, but there is a line in my /etc/dhcp/dhclient.conf that as far as I can tell should be sending the correct hostname
Code:

send host-name "mycorrecthostname"


Is there something else I need?
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


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

PostPosted: Sun Feb 19, 2017 6:19 pm    Post subject: Reply with quote

mcnutty,

I'm using dhclient as well, and I have the following in /etc/dhcp/dhclient.conf, and that works:

Code:
send host-name "myhostname";
supersede host-name "myhostname";

_________________
Clevo W230SS: amd64 OpenRC elogind nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 OpenRC elogind xf86-video-ati. Dual boot Win 7 Pro 64-bit.
KDE on both.

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


Joined: 29 Dec 2009
Posts: 13

PostPosted: Sun Feb 19, 2017 8:51 pm    Post subject: Reply with quote

I have a long running process going so I can't restart, but I tried adding the supersede line in my dhclient.conf and restarting dhcpcd. Unfortunately I'm still getting the incorrect hostname.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6228
Location: Room 101

PostPosted: Sun Feb 19, 2017 10:32 pm    Post subject: Reply with quote

mcnutty wrote:
I have a long running process going so I can't restart, but I tried adding the supersede line in my dhclient.conf and restarting dhcpcd. Unfortunately I'm still getting the incorrect hostname.

mcnutty ... it's quite possible hostname is bound up with the lease, and so the restart doesn't clear that (because the lease isn't renewed). I'm not sure about dhclient but you might find a lease under /var/lib/dhclient/ and if removed, and dhclient restarted, the lease should be renewed.

Personally I prefer not to send the hostname (at least for wireless networks outside of my control), and so have the following in /etc/conf.d/net

/etc/conf.d/net:
dhcp_wlan0="nosendhost"

HTH & best ... khay
Back to top
View user's profile Send private message
Logicien
Veteran
Veteran


Joined: 16 Sep 2005
Posts: 1361
Location: Montréal

PostPosted: Sun Feb 19, 2017 11:00 pm    Post subject: Reply with quote

After you boot into Linux Mint, change the hostname:
Code:
sudo sysctl -w kernel.hostname=desired-hostname

Than start or restart your Dhcp service. You should be able to have the good hostname without playing with the dhcp clients configuration files.

Note that when you modify /etc/dhcp/dhclient.conf, it apply only to dhclient and not to dhcpcd who use /etc/dhcpcd.conf as configuration file. The configuration file to modify depend on which dhcp client the dhcp service and you use.
_________________
Paul


Last edited by Logicien on Sun Feb 19, 2017 11:06 pm; edited 1 time in total
Back to top
View user's profile Send private message
Fitzcarraldo
Veteran
Veteran


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

PostPosted: Sun Feb 19, 2017 11:03 pm    Post subject: Reply with quote

mcnutty wrote:
I have a long running process going so I can't restart, but I tried adding the supersede line in my dhclient.conf and restarting dhcpcd. Unfortunately I'm still getting the incorrect hostname.

dhcpcd does not use dhclient.conf. In your second post you mentioned dhclient.conf (which is used by dhclient) but in your third post you mentioned dhcpcd. Which DHCP client are you actually using? dhclient or dhcpcd?
_________________
Clevo W230SS: amd64 OpenRC elogind nvidia-drivers & xf86-video-intel.
Compal NBLB2: ~amd64 OpenRC elogind xf86-video-ati. Dual boot Win 7 Pro 64-bit.
KDE on both.

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


Joined: 29 Dec 2009
Posts: 13

PostPosted: Sun Feb 19, 2017 11:25 pm    Post subject: Reply with quote

Quote:
dhcpcd does not use dhclient.conf. In your second post you mentioned dhclient.conf (which is used by dhclient) but in your third post you mentioned dhcpcd. Which DHCP client are you actually using? dhclient or dhcpcd?


Good question. I actually hadn't really thought about it since I installed my machine years ago. It's dhcpcd, but that leaves me a little confused why I'd have a dhclient.conf file at all. It does explain why changing that file didn't do anything :)

The lease file appears to be binary, but 'mint' was still visible in the garbled output.
It also appears that the bad hostname got baked into my router. I changed it there, removed the lease file and restarted dhcpcd and the lease file now shows the correct hostname, but the hostname command still shows the bad one.

Edit: Actually that seemed to do it. hostname does output the correct host name now.

Thanks for the help!
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