I have a message saying:"sudo: unable to resolve host (myhostname)" each time i write a command. My hostname do not contain any capital letter or number. thank you

  • 1
    Does /etc/hosts contain an entry like myhostname?
    – joan
    Apr 7, 2017 at 21:11
  • Thank you, i added myhostname in this file and the message went disappered.
    – Niz.Dam
    Apr 7, 2017 at 22:53
  • I have another problem it concerns the Wifi. i can't really connect to my router, i added my connection information in /etc/wpa_supplicant/wpa_supplicant.conf and changed /etc/network/interfaces.
    – Niz.Dam
    Apr 7, 2017 at 22:57
  • Also, the wifi icon mentions Wlan0 " No wifi interfaces found"
    – Niz.Dam
    Apr 7, 2017 at 22:58
  • "changed /etc/network/interfaces" is probably your problem DO NOT MODIFY See How do I set up networking/WiFi/Static IP Also if you changed your hostname using raspi-config you would not probably have had the problem you originally posted.
    – Milliways
    Apr 7, 2017 at 23:46

1 Answer 1


Sometimes, even if you've changed the host name via raspi-config, the settings don't stick. To make it permanent:

sudo nano /etc/hosts

and change the line that says       raspberrypi

to       myhostname

assuming that myhostname is the name you want to use. Save, exit and reboot, and the message will go away.

  • Isn't the localhost IP
    – Fergara
    May 25, 2020 at 12:41
  • 1
    It's complicated …. But this issue appears to be resolved in Raspbian.
    – scruss
    May 25, 2020 at 12:51
  • This fixed my issue! Thanks!
    – LtMuffin
    Nov 21, 2021 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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