2

Today I reinstalled Fedora and saw a strange name on the command line

[ekkl@37L4247F27-25 ~]$ uname -a
Linux 37L4247F27-25 4.16.15-300.fc28.x86_64 #1 SMP Tue Jun 12 00:42:35 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

What is "37L4247F27-25"? How can I change it?

I tryed this:

]# hostnamectl set-hostname --static localhost

#OR

]# hostname `cat /etc/hostname`  # in /etc/hostname is localhost

]# cat /etc/hostname
localhost

All this has change this name, but has effect before reboot.

2
  • Yes, that's the hostname which is set during an OS install and should be change-able with the commands you've used, but you will need to run them as root. Could you make your question more clear as to whether or not you've solved this issue? If you have, create an answer below instead of updating you question.
    – baelx
    Commented Jun 16, 2018 at 17:27
  • @baelx, of course, I ran on behalf of the root. See "#" in cmd? Commented Jun 16, 2018 at 18:07

1 Answer 1

1

If neither of the two commands have been able to make the modified hostname persist after reboot, you can try to add hostname declaration in your /etc/sysconfig/network file:

First, make a backup of the original file:

cp -pr /etc/sysconfig/network /etc/sysconfig/network.bak

then open the original file in a text editor and append the line:

HOSTNAME=localhost

Save, exit and hopefully that should do it.


Alternatively, this could be a case of your router(with its DHCP server) assigning your Fedora machine a hostname. If that's so then you can try to adjust some network config files.

Make a backup of /etc/sysconfig/network-scripts/ifcfg-eth0 then open it in a text editor and append:

DHCP_HOSTNAME=yourhostname

Lastly, to try to solve the suspected DHCP hostname assignment problem, you can try using NetworkManager service(if you're using it rather than the network service) to send the hostname to the DHCP server. This wiki page gives some detail as to how to view if this is setup, i.e. make a backup of /etc/NetworkManager/system-connections/your_connection_file then open it in a text editor and append the following:

...
[ipv4]
dhcp-send-hostname=true
...
[ipv6]
dhcp-send-hostname=true
...

Hope this helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .