Ubuntu: Error message 'sudo: unable to resolve host (none)'

preview_player
Показать описание
Ubuntu: Error message "sudo: unable to resolve host (none)"

Question: When I run sudo the terminal is stuck for a few seconds and then outputs an
error message. My terminal looks like this:
ubuntu@(none):~$ sudo true
sudo: unable to resolve host (none)
What can I do to solve it?

Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful):

== This solution helped 10 people ==
In AWS, go to your vpc and turn on "DNS Hostnames".

== This solution helped 10 people ==
I was having the same issue even though the hostname in my /etc/hostname file
and /etc/hosts file matched.
My hostname was "staging_1". It turns out that you can't have an underscore in
your hostname, which is why I was getting this error. Changing the underscore
to a hyphen fixed my problem.

== This solution helped 16 people ==
I had this issue when I was using ubuntu on a VPS. I solved it editing /etc/
hosts file.
run this command:
sudo nano /etc/hosts
and then add:
127.0.1.1 ubuntu
I hope that will solve your issue :)
PS: Remember to reboot your computer!

== This solution helped 184 people ==
the 127.0.0.1 line (or create a new line if you prefer that).
Mine looks like:

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
Replace penguin in the above example by your new hostname as stated in the /
etc/hostname file.

== This solution helped 1 person ==
I had the same problem. I solved it by editing the /etc/hosts and /etc/hostname
files... on the /etc/hosts file, just edit the top part as shown below.
#vi /etc/hosts
127.0.0.1 localhost
127.0.1.1 localhost myhostname

#vi /etc/hostname
myhostname

== This solution helped 1 person ==
if you can't sudo you CAN log in as root via su. IE: su root (in an x-term).
then give the root password when prompted, then you can edit the files with
nano. The root password in 'buntu is the same as the password you would use for
sudo.

== This solution helped 1 person ==
If you are using Vagrant, then login into the guest and run apt-get --no-
install-recommends install virtualbox-guest-utils

== This solution helped 2 people ==
you might be getting an error if your hosts or hostname file contain illegal
characters. Only these symbols are permitted: a-z, A-Z, 0-9

== This solution helped 2 people ==
I had this same problem! I changed my VPS's name through the online admin
control panel which did not change the machine name in the hosts file All I did
was run:
sudo nano /etc/hosts
Then I edited it from this:
127.0.1.1 Megabyte Megabyte
127.0.0.1 localhost
To this:
127.0.1.1 Debian Debian
127.0.0.1 localhost
and that fixed my error! Hope this helped!

Рекомендации по теме