1

i have been running into this problem that makes me unable to use sudo for the past while on my raspberry pi 4 but when i look in the /etc/hosts folder i see this

192.168.0.22    localhost
::1             localhost ip6-localhost ip6-loopback
ff02::1         ip6-allnodes
ff02::2         ip6-allrouters

192.168.0.22    hostname

and the /etc/hostname says hostname

by the way my host name is ------------ but i'll replace it with hostname

Zax71
  • 21

1 Answers1

1

Have you manually edited your /etc/hosts file?

It should look more list this:

127.0.0.1   localhost
::1     localhost ip6-localhost ip6-loopback
ff02::1     ip6-allnodes
ff02::2     ip6-allrouters

Localhost is usually 127.0.0.1 and many services require this to function properly.

Restore it to default and add a line at the bottom 192.168.0.22 <your.hostname>

For a more detailed explanation of how address resolution works in Linux, start with man 5 nsswitch.conf

ThankYee
  • 604