0

I have a Pi 1 B running dnsmasq as name server for my home network. This setup works great for me and has been much more stable than letting my Asus router handle it.

Lately – however – I have noticed a problem: The pi can't resolve its own hostname unless I specify the full domain.

$ ping pihostname
ping: unknown host pihostname
$ ping pihostname.mydomain.lan
PING pihostname.mydomain.lan (xxx.xxx.xxx.xxx) 56(84) bytes of data.

It can find other computers on the network without the domain (but the domain is not expanded):

$ ping otherhostname
PING otherhostname (xxx.xxx.xxx.xxx) 56(84) bytes of data.
$ ping otherhostname.mydomain.lan
PING otherhostname.mydomain.lan (xxx.xxx.xxx.xxx) 56(84) bytes of data.

Other computers can find the pi without the domain (and here the domain is expanded):

$ ping pihostname
PING pihostname.mydomain.lan (xxx.xxx.xxx.xxx): 56 data bytes

This leads to an error message every time I use the sudo command on the pi:

$ sudo echo hello
sudo: unable to resolve host pihostname
[sudo] password for myusername: 
hello

Any tips on how to debug this?

  • I assume you changed the hostname, but the question is HOW? – Milliways Sep 10 '16 at 7:37
  • @Milliways In /etc/hostname. (Note: There was an error in the original question, the last output has been edited) – Jonatan Sep 10 '16 at 7:41
1

You only did half the job. If you had changed using raspi-config it would have worked. See https://raspberrypi.stackexchange.com/a/53893/8697 or edit /etc/hosts.

  • I was so sure this was dnsmasq related that I didn't even bother to look at /etc/hosts. – Jonatan Sep 10 '16 at 8:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.