missing raspberry hostname

Talk about other linux distributions, or even other OSes.
Post Reply
User avatar
mimosa
Salix Warrior
Posts: 3096
Joined: 25. May 2010, 17:02
Contact:

missing raspberry hostname

Post by mimosa » 8. Jun 2019, 06:19

I don't know if this is a Salix glitch or a Pi one. I have a Raspberry Pi running headless attached to my router, with the following in /etc/hosts:

Code: Select all

pi@raspberrypi:~ $ cat /etc/hosts
127.0.0.1       localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

127.0.1.1       raspberrypi
My router recognises 'raspberrypi' as a connected dhpc client, but I can no longer ssh into the pi using that name rather than the assigned IP address:

Code: Select all

mimosa[~]$ ssh pi@raspberrypi
ssh: Could not resolve hostname raspberrypi: Name or service not known
It was working fine a day or two ago. I have tried rebooting with no effect.

I'm not sure why the pi's /etc/hosts has that entry ending 1.1 rather than 0.1, as on Salix; but I think there was some reason for it, and in any case, it was working before, and the router still registers the name.

User avatar
gapan
Salix Wizard
Posts: 5528
Joined: 6. Jun 2009, 17:40

Re: missing raspberry hostname

Post by gapan » 8. Jun 2019, 10:19

The 127.0.1.1 address is a debian thing. It's essentially a workaround for a bug. See https://www.debian.org/doc/manuals/debi ... resolution

Now, if you Salix PC can't see the pi, while it did in the past, maybe avahi has something to do with it?

In any case, you could add an entry in your salix /etc/hosts file and it will work.
Image
Image

User avatar
mimosa
Salix Warrior
Posts: 3096
Joined: 25. May 2010, 17:02
Contact:

Re: missing raspberry hostname

Post by mimosa » 8. Jun 2019, 17:52

I guess that would solve the problem (though in that case, I had better give the Pi a static IP); but then it must be something I did, and it niggles. This avahi thing is new to me. There is an "avahidaemon" service, which was not running, and I started it and rebooted - no difference. Anyway it is not the end of the world, and maybe if I don't fiddle with it too much, it will just come back.

Wikipedia tells me that:
Avahi was developed by Lennart Poettering and Trent Lloyd.
[...]
The name Avahi is the Malagasy native name and scientific Latin name of a genus of woolly lemur, a family of primates indigenous to Madagascar.
:evil:

User avatar
gapan
Salix Wizard
Posts: 5528
Joined: 6. Jun 2009, 17:40

Re: missing raspberry hostname

Post by gapan » 8. Jun 2019, 18:05

Did you by any chance change the DNS settings in Salix?

What is your /etc/resolv.conf ?
Image
Image

User avatar
mimosa
Salix Warrior
Posts: 3096
Joined: 25. May 2010, 17:02
Contact:

Re: missing raspberry hostname

Post by mimosa » 8. Jun 2019, 19:27

That's it! :D I was having trouble with my VPN and made /etc/resolv.conf immutable, so DNS queries are routed to somewhere other than the router. I will try undoing that and see if I can find a better solution if still needed for the VPN troubles.

raspberry is back! Thanks gapan.

Post Reply