Fedora 31 Hostname Query

I’ve installed a fresh installation of Fedora 31 on my PC. Its the only distribution on the machine.

The installation does not seem to ask me to choose a hostname (I’m coming from an Ubuntu background where they do). Anyway, when I reboot after installation and open a terminal the command prompt is ‘peter@ubuntu’

Where is the ubuntu hostname coming from? I know I can change it, but I was just wondering.

If i do a cat /etc/hostname it says localhost.localdomain

echo $PS1 gives [\u@\h \W]

I do have another PC on the same network with the hostname ubuntu.

Thanks
Peter

1 Like

Is this what are you trying to achieve?

Regards.,

3 Likes

Thanks for the quick reply.

I’m trying to work out why when I open a terminal it says peter@ubuntu

What makes the system use ‘ubuntu’

Thanks

type in terminal:

hostnamectl 
   Static hostname: hhlp
         Icon name: computer-desktop
           Chassis: desktop
        Machine ID: f889443450894f8eb4c76295c9861c03
           Boot ID: 7517b65cc275407398b2df7c06d1bd1c
  Operating System: Fedora 31 (Workstation Edition)
       CPE OS Name: cpe:/o:fedoraproject:fedora:31
            Kernel: Linux 5.3.13-300.fc31.x86_64
      Architecture: x86-64

explanation:

1. Display username, hostname and current working directory in the prompt

The PS1 in this example displays the following three information in the prompt:

  • \u – Username
  • \h – Hostname
  • \w – Full path of the current working directory

Regards.,

1 Like

Thank you for the reply. I’m away with work until Thursday evening, but will try then.

I don’t think I’m getting my qyestion across correctly. This is a clean install of Fedora 31. I have not changed anything at all From a clean install I have just gone into the terminal and the prompt is peter@ubuntu and my question is why is the hostname being displayed as ubuntu? If I need to explain in any other way please let me know.

in some place in anaconda installing process, i don’t remember well right now, the default is:

user@localhost

[hhlp@localhost ~]$ hostnamectl
   Static hostname: localhost.localdomain
         Icon name: computer-vm
           Chassis: vm
        Machine ID: a59a46698df4451192468985825f14e0
           Boot ID: 05ffe0dd2ab1446f98cc6e1eb95f32ae
    Virtualization: kvm
  Operating Fedora 31 (Workstation Edition)
       CPE OS Name: cpe:/o:fedoraproject:fedora:31
            Kernel: 5.3.11-300.fc31.x86_64
      Architecture: x86-64
[hhlp@localhost ~]$ 

hostnamectl set-hostname ubuntu
[hhlp@ubuntu ~]$ hostnamectl status
   Static hostname: ubuntu
         Icon name: computer-vm
           Chassis: vm
        Machine ID: a2052679730a4f9aa24d06616a65b929
           Boot ID: 9d01e9f28fb84a2f9242dea0786c37f9
    Virtualization: kvm
  Operating System: Fedora 31 (Workstation Edition)
       CPE OS Name: cpe:/o:fedoraproject:fedora:31
            Kernel: Linux 5.3.11-300.fc31.x86_64
      Architecture: x86-64
[hhlp@ubuntu ~]$ 

You can change it or view it in configuration → details

Regards.,

Thank you. I did not change it during the anaconda install (There is no place to do this), and the username I chose was ‘peter’ so I still don’t know where it got ubuntu from.

Anyway, I’m back on Thursday. All I can think is it is somehow reading it from the other machine on my network.

Peter

If you did not explicitly set a hostname, it is possible that the DHCP server on your router is confused, and serving out the same hostname because it thinks it’s the same machine, or the machine used to be called ‘ubuntu’ and some cache is still giving the name out.

1 Like

Thank you @qulogic

That was the issue. I installed it again with the ethernet unplugged and the install just set the hostname as localhost.

It must as you say be something on the router getting confused.

Thank you also @hhlp for trying to help.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.