hostname issues...

Issues Related to Networking (Wired and Wireless)

Moderator: Moderators

Post Reply
bluesfreak72
Baby Hen
Posts: 1
Joined: Sat Jan 06, 2018 19:18

hostname issues...

Post by bluesfreak72 » Fri Apr 20, 2018 0:41

Please forgive me if this has been addressed in other posts. I'm attempting to change my hostname and following the wiki page on how to do it. For some reason after I reboot, uname -a and all the hostname commands still gives the old name. This is a relatively new install - not more than a month old. The machine is an HP 4600 Workstation. It's a Core 2 duo. The host drive is /dev/sdb. I did not format the /home directory during this install. This drive has had multiple other OSs on it: Arch, Mint, Antergos, and probably a few others. I've racked my brain and have asked fellow LUG members with no joy.

User avatar
Fitzcarraldo
Sagely Hen
Posts: 8091
Joined: Sat Mar 10, 2007 5:40
Location: United Kingdom
Contact:

Re: hostname issues...

Post by Fitzcarraldo » Sat Apr 21, 2018 18:22

Try the following:

I'll call the hostname 'myhostname' here. Substitute 'myhostname' with yours.

First, use the following command as root user:

Code: Select all

# hostnamectl set-hostname myhostname
(^No quotation marks)

Then also create/edit the following files:

/etc/hosts

Code: Select all

127.0.0.1 myhostname localhost
::1 myhostname localhost
(^No quotation marks)

/etc/hostname

Code: Select all

myhostname
(^No quotation marks)

/etc/dhcp/dhclient.conf

Code: Select all

send host-name "myhostname";
supersede host-name "myhostname";
(^Double quotation marks)

In earlier days it was necessary to specify the hostname in /etc/NetworkManager/NetworkManager.conf but that is no longer required. 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.'

Post Reply