-   Linux - Newbie (
-   -   debian shell prompt does not reflect changed hostname (

Luminaro 10-27-2012 05:16 AM

debian shell prompt does not reflect changed hostname
When I change the hostname in /etc/hostname and reeboot the machine, the shell prompt still shows the old hostname.

Command hostname shows the correct, newly set name.

Shell prompt is defined as:
PS1 = ${debian_chroot:+($debian_chroot)}\u@\h:\w\$

I have already checked /etc/init.d/, tried it manually with start parameter, and it correctly echoed the new name.

So, the value of \h in PS1 seems to be resolved from somewhere else - any ideas?


jlinkels 10-27-2012 06:31 AM

I don't know what exactly is the problem. But changing the host name is routine in Debian. In /etc grep for the old host name. This should turn up 4 files. Probably less in your case because you already commenced the change. Anyway, edit all the files that you find replacing the host name.

I did this in Squeeze most recently. Will do this week in Wheezy. Maybe there is something moved to a subdir in the conf.d style which becomes more current.

Try the grep first and please reort back.


Luminaro 10-27-2012 09:22 AM

grep 'newname' /etc/* returns one file: /etc/hostname

grep 'oldname' /etc/* does NOT return any file, still the prompt says root@oldname, also -R option did not find any relevant files

Thanks, Luminaro

PS: just realized that I had found earlier the oldname in the /etc/hosts file, last line, own IP. Changing this entry did not have any effect. It explains though that the hosts file did not come up with grep.

jlinkels 10-27-2012 04:15 PM

Strange, that never happened to me before. Something must be different and non-vanilla in that Debian installation.

Check this where about every possibility of wrong prompts is described: And I am out of ideas, sorry.


EDDY1 10-27-2012 04:56 PM

Luminaro 10-28-2012 04:25 AM

jlinkels: thanks for the link, the only new point was a possible interference of DHCP which (as far as I can tell) is not active on this host. Also out of ideas for now. Will leave this open and document the solution as soon as any comes up.

All times are GMT -5. The time now is 03:42 PM.