sudo: unable to resolve host HOSTNAME

Bug #203593 reported by Rob Adornato
26
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Ubuntu
Confirmed
Undecided
Unassigned
Nominated for Lucid by Cazacu Bogdan
Nominated for Maverick by Cazacu Bogdan

Bug Description

this issue is similar to bug report #195308, but in the reports subsequent manual fix, the /etc/hosts file doesn't apear to be the same layout.

Context:
HP Pavilion 7965, basically stock, with ATI All-In-Wonder 7500
I did "Update-Manager -d" Upgrade from Gutsy to Hardy last night, appeared to run smoothly at a GUI level.

Initial appearance of error:
ran 'sudo lshw' to see if the report would be different than under Gutsy.

instead of asking for my password, it returned:
sudo: unable to resolve host HP7965

on researching the bug, It most similarly looks like #195308, but the fix isn't clear to me.

Revision history for this message
Thomas Butter (tbutter) wrote :

Thanks for the report. Could you please attach your /etc/hosts file?

Revision history for this message
Rob Adornato (radornato) wrote :

Sorry, delayed by real life.

Contents of /etc/hosts:

127.0.0.1 localhost
127.0.1.1 HP7965.phub.net.cable.rogers.com HP7965.AdornatoHome

# 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
ff02::3 ip6-allhosts

Additional challenge: When I tried to edit this file as per the comments on bug #195308, I discovered that I'd need to run nano with sudo to save the changes. No matter what command I run under sudo, I get the "sudo: unable to resolve host ..." Forgive my newb's Captain Obvious-ness, but a non-functioning sudo is a bad thing I don't know how to deal with.

Revision history for this message
Thomas Butter (tbutter) wrote :

This is the same problem as in bug #195308.

Does it work to edit the file with "gksu nano /etc/hosts"?

Otherwise you would have to boot into recovery mode and then edit the file.

Revision history for this message
Jose (jbellido) wrote :

I just had this same problem,

  sudo was working fine until I clicked on the icon for "Wired network connection" and the manual configuration, then I edited the domain. This had upset sudo. When I reset back the domain (in a similar way) sudo started to work again.

Revision history for this message
Franzmaximilian (davini) wrote :

I had this same problem after upgrading Kubuntu 7.10 to 8.04 LTS (only minutes ago...)
In my /etc/hosts it was
127.0.1.1 franz-laptop-new instead of
127.0.1.1 laptop-new

I could not find any other solution but to boot in recovery mode and start as root, then edit /etc/hosts file.
No way to become root otherwise.

This is really a nasty bug, specially for non experienced users! I reccomend giving it high priority.

Revision history for this message
Martin Pitt (pitti) wrote : Re: [Bug 203593] Re: sudo: unable to resolve host HOSTNAME

Hi Franz,

Franzmaximilian [2008-04-30 22:43 -0000]:
> This is really a nasty bug, specially for non experienced users! I
> reccomend giving it high priority.

Please help testing the version in hardy-proposed, where this is
fixed. See https://bugs.launchpad.net/bugs/32906 for the original bug. Thank you!

Revision history for this message
João Rico (joaorico) wrote :

guxo@guxo-laptop:~$ sudo -i
sudo: unable to resolve host guxo-laptop
root@guxo-laptop:~#

i've updated the system and now it has asked for once the password.. but the message still there...

Revision history for this message
Vikas Bhasin (vikasb) wrote :

Hello,

In that scenrio, one has to change the local host file /etc/hosts setting.
1. One can change the local host by going to the Network.
Sytem ---> Network

2. We can also go for udo dpkg -- configure -a

 Thanks,

On Thu, May 8, 2008 at 5:06 PM, João Rico <email address hidden> wrote:

> *** This bug is a duplicate of bug 32906 ***
> https://bugs.launchpad.net/bugs/32906
>
> guxo@guxo-laptop:~$ sudo -i
> sudo: unable to resolve host guxo-laptop
> root@guxo-laptop:~#
>
> i've updated the system and now it has asked for once the password.. but
> the message still there...
>
> --
> sudo: unable to resolve host HOSTNAME
> https://bugs.launchpad.net/bugs/203593
> You received this bug notification because you are a direct subscriber
> of a duplicate bug (via bug 32906).
>

--
Vikas
Govt. College of Teacher Education,
Dharamsala HP

Revision history for this message
yesak (yesakmac) wrote :

I figured out what i did wrong on this, and it may help others so here it is..... When trying to connect my ubuntu box to my workgroup I edited the domain in which it was trying to log on. Here's my screenshot as an attachment. When it returns the error sudo: unable to resolve host <username> it was trying to query my PDC, not the local machine. easy fix is take out the domain changes, and check to make sure your loopback is configured to your machine name (the 127.0.1.1 entry in SYSTEM>ADMINISTRATION>NETWORK>(HOST TAB)).

Revision history for this message
Vikas Bhasin (vikasb) wrote :

Thanks a lot, me also experiencing the same issue, and get over it by
making changies in the Host Tab.

On 5/31/08, yesak <email address hidden> wrote:
> *** This bug is a duplicate of bug 32906 ***
> https://bugs.launchpad.net/bugs/32906
>
> I figured out what i did wrong on this, and it may help others so here
> it is..... When trying to connect my ubuntu box to my workgroup I edited
> the domain in which it was trying to log on. Here's my screenshot as an
> attachment. When it returns the error sudo: unable to resolve host
> <username> it was trying to query my PDC, not the local machine. easy
> fix is take out the domain changes, and check to make sure your loopback
> is configured to your machine name (the 127.0.1.1 entry in
> SYSTEM>ADMINISTRATION>NETWORK>(HOST TAB)).
>
> ** Attachment added: "Screenshot-1.png"
> http://launchpadlibrarian.net/14866505/Screenshot-1.png
>
> --
> sudo: unable to resolve host HOSTNAME
> https://bugs.launchpad.net/bugs/203593
> You received this bug notification because you are a direct subscriber
> of a duplicate bug (via bug 32906).
>

--
Vikas
Govt. College of Teacher Education,
Dharamsala HP

Revision history for this message
Allan Registos (allan-registos-smpc) wrote :

I don't know if this is really a bug? I'm no expert, but I think I solve the problem by removing domain names after your computer name:

127.0.1.1 HP7965.phub.net.cable.rogers.com HP7965.AdornatoHome

remove .phub.net.cable.rogers.com i.e., after HP7965
and it works for me, no more unable to resolve error.

if this will not work, try to remove the rest: HP7965.AdornatoHome save, then try with sudo commands...

_AllanRegistos_

Revision history for this message
Jerok (jerok01) wrote :

Hi I'm still fairly new to Ubuntu I have been using it for about a year now off and on. I have just recently upgraded to 8.04 and have had successful results so far minus a few issues. I logged in today to try and figure out an email issue that I have been having and when I went to use the sudo command I received the same unable to resolve error that is described in this thread, I have looked over all of my files that have been described as being the offending files but all of mine seem to be alright. Here is a copy of my /etc/hosts file:

127.0.0.1 localhost
127.0.1.1 jerok-desktop

# 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
ff02::3 ip6-allhosts

and I have looked over the system->administration->network hosts tab and 127.0.1.1 alias jerok-desktop is listed there as well. I am not sure where else to look to see what might be causing this error to occur. I still have full use of the sudo command but everytime I use it that error pops up and I would like to find a way to keep this from happening. Any help on this matter would be greatly appreciated. Thanks in advance.

Revision history for this message
Steve Langasek (vorlon) wrote :

Jerok,

What does 'hostname' report on the commandline? It's possible that your hostname no longer matches the value that was set up in /etc/hosts.

Revision history for this message
Scotty (miller-scott-j) wrote :

So I've followed just about all tips, and none prove fruitful to me. The following is a copy of my /etc/hosts file:

127.0.0.1 scotty
127.0.1.1 scotty-laptop

# 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
ff02::3 ip6-allhosts

Now when I try to run sudo commands from the shell, they produce the typical:

sudo: unable to resolve host

But I can still edit files. In fact, it produced that when I did a:

sudo nano /etc/hosts

yet I was able to modify it, and save it (and yes, it did save). Yet I still cannot run GUI administrator tools (change the time, system settings, etc...). Any ideas?

Revision history for this message
Steve Langasek (vorlon) wrote :

Scotty,

Please don't follow up to bugs that are marked as duplicates; your message will be hidden from the view of most people who may be able to help you.

Revision history for this message
Vikas Bhasin (vikasb) wrote : Help Request

Hello,

 How are you doing? hope all is well with you and family,I am sorry I
didn't inform you about my traveling to England for a Seminar..

I need a favor from you because I misplaced my wallet on my way to the
hotel where my money,and other valuable things were kept I will like you to
assist me with a soft loan urgently with the sum of £2000 pounds to sort-out
my hotel bills and get myself back home.

I will appreciate whatever you can afford and i'll pay you back as soon as I
return,Kindly let me know if you can help me out so I can send you the
Details to use in sending the money through Western Union.

Thanks so much and sorry to bother you.

With best regards

--
Thanks,
Vikas

Revision history for this message
Cazacu Bogdan (cazacub) wrote :

Hey everyone...sorry to bardge in like this, but aparently i'm having the same problem.

I'm trying to set up a ftp server with internet access behind a router. The router's all set up, the os (ubuntu 10.4 x86 bit os installed)...

To be mentioned that, i've managed to figure out WHEN this error occurs: right after setting up dyndns client on the server... (at least that when it happened to me). I'm guessing this is a dns problem? :-/

Issue?
"bogo@(none):~$ sudo nano /etc/hosts
sudo: unable to resolve host (none)"

This is my copy of the hosts file...

"127.0.0.1 localhost localhost
127.0.1.1 lafemme lafemme
192.168.30.200 lafemme lafemme

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts"

Revision history for this message
Darren Leung (deeleung) wrote :

(Not sure where to add this, but the title of this bug sounds appropriate enough):

I have been using OpenVPN and though I was not connected to my VPN during update from 9 to 10.04, I was not able to resolve hostnames. The conditions were

-wireless showing great signal and proper DNS
-able to connect to IP of router providing DHCP
-unable to ping openDNS or google DNS directly (e.g. 8.8.8.8 did not work)
-restart did not work
-/etc/hosts was clean

I did notice during pinging that it tried to resolve addresses via 10.x.x.x, which is what my VPN uses, despite not having started the service.

Resolved by finding the process with ps and then killing it. All is well.
cheers

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.