terminal host name changed

General support questions
bonedome
Posts: 201
Joined: 2017/04/22 08:11:04

terminal host name changed

Post by bonedome » 2020/03/17 22:54:40

Hello
I installed puppy linux on a memory stick earlier (using dd) booted from it, set it up, rebooted to make sure settings saved, rebooted back into CentOS and now my terminal host name is puppypc31420, very confused.

Code: Select all

[user1@puppypc31420 ~]$ su -
Password: 
Last login: Tue Mar 17 22:41:24 GMT 2020 on pts/0
[root@puppypc31420 ~]# 
both root and user, how to set it back and how did it happen in the first place ?

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: terminal host name changed

Post by jlehtone » 2020/03/17 23:03:24

What do you get with:

Code: Select all

hostnamectl

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

Re: terminal host name changed

Post by tunk » 2020/03/18 10:50:41

It might have been provided by the DHCP server.

bonedome
Posts: 201
Joined: 2017/04/22 08:11:04

Re: terminal host name changed

Post by bonedome » 2020/03/18 17:50:49

Thanks for the replies.
I've fixed the host name but am still confused as to how a live os that runs entirely in ram has made a change to the installed os, especially as none of the HD partitions was ever mounted.
I thought DHCP just assigns an ip address.
The only thing I can think of is that I did a reboot not shutdown and restart, and that ram wasn't completely wiped, which if true is a bit of a security risk albeit a bit of a long shot.
I might boot puppy up later and see if it does it again.

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: terminal host name changed

Post by desertcat » 2020/03/18 19:00:05

bonedome wrote:
2020/03/18 17:50:49
Thanks for the replies.
I've fixed the host name but am still confused as to how a live os that runs entirely in ram has made a change to the installed os, especially as none of the HD partitions was ever mounted.
I thought DHCP just assigns an ip address.
The only thing I can think of is that I did a reboot not shutdown and restart, and that ram wasn't completely wiped, which if true is a bit of a security risk albeit a bit of a long shot.
I might boot puppy up later and see if it does it again.
I like your attitude: EXPERIMENT!! See if you can reproduce the result. Please keep us posted.

bonedome
Posts: 201
Joined: 2017/04/22 08:11:04

Re: terminal host name changed

Post by bonedome » 2020/03/19 20:38:42

Well it's done it again, I did a shutdown of puppy, removed usb stick and restarted CentOS after a few seconds.
One thing I did remember is that I have put the pupsave (persistence file) in the ntfs windows partition (on the HD), I can't see how this could be relevant though.
The output of hostnamectl

Code: Select all

[user1@puppypc31420 ~]$ hostnamectl 
   Static hostname: localhost
Transient hostname: puppypc31420
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: b13a34e6cf029a0a4657261457
           Boot ID: 67d6359dbcd43b197da4e55d78
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1062.12.1.el7.x86_64
      Architecture: x86-64
The terminal window top bar shows the static hostname, Ctrl Alt F2 shows puppypc31420
Still baffled

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: terminal host name changed

Post by TrevorH » 2020/03/19 20:48:21

What does host $youripaddress say?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

desertcat
Posts: 843
Joined: 2014/08/07 02:17:29
Location: Tucson, AZ

Re: terminal host name changed

Post by desertcat » 2020/03/20 13:34:55

bonedome wrote:
2020/03/19 20:38:42
Well it's done it again, I did a shutdown of puppy, removed usb stick and restarted CentOS after a few seconds.
One thing I did remember is that I have put the pupsave (persistence file) in the ntfs windows partition (on the HD), I can't see how this could be relevant though.
The output of hostnamectl

Code: Select all

[user1@puppypc31420 ~]$ hostnamectl 
   Static hostname: localhost
Transient hostname: puppypc31420
         Icon name: computer-laptop
           Chassis: laptop
        Machine ID: b13a34e6cf029a0a4657261457
           Boot ID: 67d6359dbcd43b197da4e55d78
  Operating System: CentOS Linux 7 (Core)
       CPE OS Name: cpe:/o:centos:centos:7
            Kernel: Linux 3.10.0-1062.12.1.el7.x86_64
      Architecture: x86-64
The terminal window top bar shows the static hostname, Ctrl Alt F2 shows puppypc31420
Still baffled
Well there is always the Brute Force Way: Open up your favorite file editor such as Midnight Commander (mc) GoTo => /etc/hostname Remove the line that say something about localhost at local domain and Edit to Read MyHostName (and local domain if you have one) => Save => Exit => Reboot.

It will then come up with whatever host name you gave the machine. I've done this before and it works. You just need to make sure you save the file.

The ONLY way I can see your problem happening is if 1) /etc/hostname still reads localhost.localdomain in which case it simply substitutes puppypc31420 for localhost.localdomain. 2) During the initial install phase there is the section where you set up the network there is in the bottom left hand corner something that reads localhost.localdomain which is where you would erase and insert MyHostName.MyLocalDomain name. It is very easy to overlook (ask me how I know).

Worth a shot.

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: terminal host name changed

Post by pjsr2 » 2020/03/20 14:34:41

I thought DHCP just assigns an ip address.
DHCP, does not just assign an IP address. It can also assign a host name (simple host name or fully qualified domain name). Actually, that is a very handy capability when you think of X-terminals and thin clients/zero-clients in your network.

DHCP may also assign network mask, gateways, routing information and metric for your internet device(s).

The host name is a weird property. A computer may have different host names on different devices. And to add more confusion, a host can have alias names added in DNS.

When you read the details of man hostname and other man pages referenced in there, you start to realize that Shakespeare was right to ask "What's in a name?"

tunk
Posts: 1205
Joined: 2017/02/22 15:08:17

Re: terminal host name changed

Post by tunk » 2020/03/20 14:41:32

My CentOS 7 desktop PC gets an IP address from a DHCP server,
and terminal host name is set to user@dhcp-028053 where 028 and
053 is the last two numbers of the IP address. It is not set
locally, so I guess it must be given by the DHCP server. Just
speculating: I don't know how DHCP works, but it could be that
puppy communicates with the server and the name is stored. When
you start CentOS, the DHCP server may think it's the same PC
(same MAC address?) and it gives out that name.

Post Reply