LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   I'm getting a wrong hostname in the terminal (https://www.linuxquestions.org/questions/debian-26/im-getting-a-wrong-hostname-in-the-terminal-4175472720/)

jjrojaspy 08-08-2013 09:16 PM

I'm getting a wrong hostname in the terminal
 
Hi everybody. A week ago I upgraded my Debian install from squeeze to wheezy. From time to time I get a funny bug on my terminal. I get random hostname. When I first installed Debian on my PC, I named my computer Anardil, so usually my command line looks like this

My user account -> jjrojaspy@Anardil:~$
root account -> root@Anardil:~#

But today i got this in my terminal:

jjrojaspy@be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01:~$
root@be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01:~#

just for the record, my current linux kernel is 3.2.0-4-amd64. Before upgrade it was 2.6.x.x-amd64.

Those anybody has a clue? Is this a Debian bug or something else? Thanks in advance!!!

frankbell 08-08-2013 09:28 PM

All I can say is that I have not run into that here on my Wheezy box. My terminal prompt still says

Quote:

[username]@tuna
My kernel is 3.2.0-4-686-pae.

(I name all my computers after sea creatures. There's tuna, hammerhead, narwhal, pickerel, and minnow--the netbook)

jjrojaspy 08-08-2013 09:42 PM

Thanks Frankbell. I know that this doesn't make any sense at all, but I didn't realize this was happening until i opened my terminal the day before yesterday; today I could observe the same anomaly. As I said, this happens from time to time.

itlb 08-09-2013 02:20 AM

I'm getting a wrong hostname in the terminal
 
Are you sure its the hostname and not just the prompt? what does 'hostname' report when your prompt changes?

jjrojaspy 08-09-2013 07:54 AM

Yes, I'm sure it's not only the command line prompt. In fact, when i turned my computer on today, I checked the terminal once more and this is what i got ---and still get:

jjrojaspy@be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01:~$ hostname
be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01
jjrojaspy@be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01:~$ uname -a
Linux be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux
jjrojaspy@be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01:~$

and if i turn into root

root@be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01:~# hostname
be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01
root@be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01:~# uname -a
Linux be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1 x86_64 GNU/Linux
root@be4f4c87-dslam-172-17-193-239-269-660-mil-bras-01:~#

it's just the same.

Nevertheless, if i reboot my pc and go into Debian again, the terminal shows the correct prompt and hostname.

scratchyrat 08-09-2013 08:11 AM

What does it say in your /etc/hostname and /etc/hosts files?

widget 08-09-2013 05:46 PM

Your problem should have shown up in Squeeze. You are really not supposed to use upper case letters in the host name.

EDDY1 08-10-2013 01:00 AM

I have had similar problems but I think that they were related to the installation cd's. I had an installation that said unknown as hostname

jjrojaspy 08-10-2013 05:42 PM

Thanks to all who have answered my question, but a i have a few more:

a hostname isn't supposed to use uppercase letters? Is this a *nix naming convention? or just a de facto rule among Linux users and administrators? I have two pc's in my office, one running Ubuntu and the other Xubuntu (12.04 in both cases), and they are call Local1 and Local2. As you can see, each hostname begins with an uppercase letter. On the other hand, before I upgraded my Debian installation I never got other hostname than the one a set up during the installation process.

I will check the hostname and hosts files on my PC and then I will be back to you. Thanks again!!

descendant_command 08-11-2013 12:20 AM

Is your debian directly connected to the net? (i.e. not through a router).
That looks like the ISP assigned rDNS of your connection.
Maybe your DHCP client is set to accept a hostname as well as ip/dns etc.

jjrojaspy 08-12-2013 06:49 PM

Hi everyone. I finally could check my hostname and hosts files in /etc

jjrojaspy@Anardil:/etc$ cat hostname
Anardil
jjrojaspy@Anardil:/etc$ cat hosts
127.0.0.1 localhost
127.0.1.1 Anardil.cantv.net Anardil

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
jjrojaspy@Anardil:/etc$

Any hint?

frankbell 08-12-2013 08:40 PM

I think you are making this more complicated than it is.

This article may help: http://www.cyberciti.biz/faq/debian-...e-permanently/

Here's the contents of my /etc/hostname:

Code:

~$ cat /etc/hostname
tuna

The following is from my /etc/hosts. It's similar to yours. Since I don't use ipv6, the ipv6 portion is irrelevant.

Code:

cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 tuna.bell.org tuna.bell.org

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


evo2 08-16-2013 11:48 AM

Hi,

as already suggested by descendant_command the host name you see is being provided by the dhcp server and is being set by dhclient. You should be able to disable this behaviour in /etc/dhcp/dhclient.conf

Try removing the "host-name" option from the "request" line.

Evo2.

jjrojaspy 08-21-2013 06:35 PM

Hi everybody. I finally could solve the hostname issue. As I was suggested by evo2 and descendat_command, I commented the host-name option in the request line of my dhclient.conf file. This solved the problem. Thanks to all for helping me!!!


All times are GMT -5. The time now is 12:01 AM.