unexpected prompt

Under YaST2 I set my machine’s hostname to Monza65, and this is what appears in /etc/hostname, /etc/HOSTNAME and /etc/hosts. However prompts identify the machine as linux-dkk9, i.e. if I don’t reset the prompt in my .bashrc then a bash terminal has prompt

username@linux-dkk9:~>
.

I have a suspicion that the disjunction (Monza65 versus linux-dkk9) is causing problems with a program I am trying to run, and I don’t know where the ``linux-dkk9’’ came from and how to alter it. Thanks for any suggestions. JDW

Did you reboot? /etc/hostname gets only sourced on boot…

Thanks. I believe I had rebooted, but just in case not I did so just now… but this has not changed the prompt, which still identifies the hostname as linux-dkk9.

Could it be a problem that in /etc/hosts I had replaced the line

#nnn.n.n.1 localhost
with
nnn.n.n.1 Monza65
?

Yast > system > network settings
Hostname tab

This is bizarre. I had made that setting last week after installing Leap… and I can’t think how it could have been changed, but indeed it had been. Thanks. I’ll post again if needbe. JDW

Well it’s not only bizarre, it’s also maddening. I go into YaST, I reset hostname to Monza65, I accept that, YaST closes, I reopen it, and I find it has reverted to linux-dkk9 (this, admittedly, without having rebooted). I did by the way uncheck “Change Hostname via DHCP”.

I’m not sure to understand what you’re trying to do, or what you actually did.
Opening a new terminal after you effectively changed hostname should yield something like:


bruno@LT_B:~> printenv HOST
LT_B
bruno@LT_B:~> cat /etc/hostname
LT_B

with the same result for prompt, environment variable HOST and file /etc/hostname, since they are sourced from each other.

If you change it by Yast > system > network settings > Hostname tab as caf4926 suggested, you even don’t have to reboot.
If you directly edit /etc/hostname you have to reboot, or otherwise change the environment.

BTW, linux-dkk9 seems a typical random name assigned by the installer, so did you revert your changes somehow, e.g. by booting a previous system snapshot?

Thanks. I don’t know what was happening. Last time round (after I wrote my previous post) the hostname I entered in YaST has finally taken hold, so to speak… correct hostname in prompt etc. (Perhaps because I unchecked “Change Hostname via DHCP”?)