BBB: different hostname on ssh via USB and Ethernet cable

Foreword: This is a story about a BeagleBone Black with Amstrong distribution.

Connecting to the BBB with ssh, when the BBB is connected via USB cable, I get this:

root@beaglebone.local's password:
root@beaglebone:~# hostname
beaglebone
root@beaglebone:~# cat /etc/hostname
beaglebone
root@beaglebone:~#

This is correct and bash gives me the right prompt, I'm happy.

when the BBB is connected with an ethernet cable (on a router with DHCP)
I get this:
root@beaglebone.local's password:
root@host-192-168-1-3:~# hostname
host-192-168-1-3
root@host-192-168-1-3:~# cat /etc/hostname
beaglebone

Hei! But, the hostname should be beaglebone, not his IP address!!!

note: the router says that at IP 192.168.1.3 there is a computer named beaglebone.

Maybe there is a name resolution problem but, sincerely, I never find an understandable explanation about how it works on a LAN.

Is there someone here that can explain why this happens???

Another minor thing I observed:

when the BBB is connected via USB cable

root@beaglebone:~# shutdown now
Connection to beaglebone.local closed by remote host.
Connection to beaglebone.local closed.
tiziano@eeepc1011:~$

while, when the BBB is connected on an etheret cable (on a router with DHCP)

root@host-192-168-1-3:~# shutdown now
and the terminal hangs here...

Yes, I know that I can type ~. and live happy,
but I wuold like very very much to know why...

Maybe there is a relation between these two things?

TYA

Hi Tiziano,

Not sure why you are getting different host names between USB and Ethernet. I attached 2 screen shots one was from inside my home network and the other was from outside the network through a port forward. As you can see both show beaglebone as the host name.

I believe the reason for the hang is due to the difference between USB and Ethernet. If you have a flash drive connected to you computer and remove it the computer immediately detects that it was removed. If you have a flash drive connected to another computer on your network your computer will not know if it was removed until you try to access it. So essentially you are disconnecting the beaglebone from your computers USB when you issue the shutdown command and the computer doesn’t know that the “ethernet cable was remove” until the connection times out when using Ethernet port.

-Wil

Local.png

Remote.png

check for modifications in bashrc to your PS seems like it might be
coming from that on either your box or the remote box.

Will, that's not the case, because I changed cable connections after turning off all the devices (client PC, BBB, router).

I tried with another PC to ssh with the BBB with the same result.

Since nobody has this same problem, it's clear that there is something in my LAN that interferes with the resolution of the BBB hostname, thanks.

regards

Don, I looked about this subject, but there is no ~/.bashrc, neither /etc/profile in the BBB, anyway $PS value is:

# echo $PS1
\u@\h:\w\$

in both cases \h inserts the hostname from the command hostname, wich is wrong.

I could fake the prompt using this line in .bashrc:

PS1="\u@"$(cat /etc/hostname)":\w\$"

but there are better workarounds and this doesn't explain why this happens, thanks.

regards