unable to resolve host

Bug #195308 reported by dflipb
30
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linux-meta (Ubuntu)
Confirmed
Undecided
Unassigned
sudo (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: linux-backports-modules-hardy

After upgrading from Gutsy to Hardy, when I try to do anything in terminal, i get the error "unable to resolve host htpc" (htpc is the name of my computer). It usually does what I want it to do if i do sudo, but it seems to give me some trouble opening programs from the GUI, it won't open programs sometimes then I have to go into terminal and do sudo....[program]

Revision history for this message
Lunderhage (lunderhage) wrote :

After upgrade from Gutsy (x64) to Hardy, I also have exactly this problem.
I can see that my computers hostname is pointing on 127.0.1.1 in /etc/hosts.
I will try to modify this and se if it solves the problem.

Revision history for this message
jimijunk (jrogala) wrote :

I have similar problem with Hardy upgrade, but "unable to resolve host occurs WITH sudo. I am currently trying to repair 195551 python central bug but can't due to inability to use sudo

Revision history for this message
sancheztavo (sancheztavo) wrote :

I get this same error when using sudo, but not if I use gksudo. Also in Hardy, after upgrade from Gutsy

Revision history for this message
sancheztavo (sancheztavo) wrote :

I fixed this by adding the hostname in /etc/hosts beacuse it was missing. In the hosts file there was a line that showed:

127.0.1.1 hostname:DOMAIN hostname:DOMAIN

so I modified that line so that it reads:

127.0.1.1 hostname:DOMAIN hostname:DOMAIN hostname

where "hostname" is my computer's name and "DOMAIN" the Windows domain name of the LAN where I am

Changed in linux-meta:
status: New → Confirmed
Revision history for this message
Francesco Montorsi (f18m-cpp217828) wrote :

I've found the same problem in the Feisty->Hardy upgrade. I fixed it logging as root (using 'su' and not 'sudo'!) in a terminal and then adding the line:

 127.0.0.1 ubuntu

to /etc/hosts file (in my case the machine name is "ubuntu").

Revision history for this message
dflipb (motionblur) wrote :

sancheztavo - this worked perfectly for me. It no longer gives me host not found!

Thank you!

Revision history for this message
Mārtiņš Bruņenieks (papuass) wrote :

If you have forgot your root password, try "gksu gedit".
It worked for me.

Revision history for this message
Lunderhage (lunderhage) wrote :

gksu nano /etc/hosts did not work for me. I had to boot into recovery mode and edit /etc/hosts. Then it worked.

Revision history for this message
Bart Rose (jbrose3) wrote :

This happened to me after upgrading to Hardy Beta. I changed the domain using the Network Manager GUI and the entry "127.0.0.1 HOSTNAME.DOMAIN_NAME was added to /etc/hosts. When I deleted the .DOMAIN_NAME portion of the entry using the Network Manager GUI, the problem was resolved. Hope this helps.

Revision history for this message
JuanRobles (jurobles) wrote :

please help. i am having this same trouble. hardy alpha 06 --> hardy beta.. can not update anything and i do not understand how these other folks were able to resolve.

Revision history for this message
JP-NYC (jp-perreaux) wrote :

I had the same problem as above, because I could not do anything via a terminal window (unable to resolve host) or the terminal windows was just stuck and could not edit /etc/hosts.
 I resolved the problem by going to:

 system > Administration > Network

> unlock the widow with your password > go to the tab Host, on the second part of the the first line ( 127.0.0.1 ) type / replace the missing host by your host name, in my case that was jp-desktop the host given during the install.

Hope this help.
All the best to you all.
JP

Revision history for this message
hazzard (hazzard-star) wrote :

simplest solution i found for this was to boot into failsafe drop into root shell

type vi /etc/hosts

change the host to what ever it was befor then :wq

then reset problem solved

Revision history for this message
ChokingHazard (jvahtras) wrote :

Francesco Montorsi's solution worked perfectly for me, simply adding that one line

Revision history for this message
Obsessed Mikey (obsessedmikey-deactivatedaccount) wrote :

JP-NYC's solution worked fine, this should still be fixed for the final release.

Revision history for this message
Daniel Nylander (yeager) wrote :

+1

Tested with todays hardy and found the same problem.

I added the DNS domain using Network Manager Applet and after that sudo won't work.

Original:
127.0.1.1 ubuntu

After Network Manager:
127.0.1.1 ubuntu.test.com

sudo: unable to resolve host ubuntu

Revision history for this message
DarkDante (darkdante) wrote :

I did the update from 7.10 to Hardy and JP-NYC's solution works fine for me.

Revision history for this message
Rinaldus (pitersv) wrote :

I have the same problem and tried to edit my /etc/hosts but without any results.

rinaldus@Peter:~$ cat /etc/hosts
127.0.0.1 localhost Peter.DAVS

# 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
127.0.1.1 Peter.DAVS

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
Franzmaximilian (davini) wrote :

 Remember, this bug report is a duplicate. Comment here only if you think the duplicate status is wrong.

The above line is foolish I guess. The other bug (#32906) is from 2006 while this one only appears when one upgrades from 7.10 to 8.04
I never experienced any trouble with my /etc/hosts file since 6.10 Now, as soon as i reboot after upgarde it comes out that my /etc/hosts file has been incorrectly modified. THIS IS AN UPGRADE BUG.

Revision history for this message
James Westby (james-w) wrote : Re: [Bug 195308] Re: unable to resolve host

On Wed, 2008-04-30 at 22:59 +0000, Franzmaximilian wrote:
> *** This bug is a duplicate of bug 32906 ***
> https://bugs.launchpad.net/bugs/32906
>
> Remember, this bug report is a duplicate. Comment here only if you
> think the duplicate status is wrong.
>
> The above line is foolish I guess. The other bug (#32906) is from 2006 while this one only appears when one upgrades from 7.10 to 8.04
> I never experienced any trouble with my /etc/hosts file since 6.10 Now, as soon as i reboot after upgarde it comes out that my /etc/hosts file has been incorrectly modified. THIS IS AN UPGRADE BUG.
>

That line appears to be correct to me, the bug is marked as a duplicate.
It is telling you to comment here if you think this bug is not
a duplicate, which it appears you do.

Note that when the bug this is marked a duplicate of is fixed it should
allow you to at least use sudo, which is very important. We are aware
that some upgrades cause the /etc/hosts file to become incorrect,
however I have not seen any explanations of what could be causing
that, if you have one that would be greatly appreciated. In the meantime
making sudo usable for people hit by this is a very important thing
to do.

Thanks,

James

Revision history for this message
Serenity (neumonic) wrote :

OK, I have found another Fix for this:

go to the System Control Panel in the GUI:
->Admin
-->Network
---> UNLOCK
----General: Remove Domain Name
Go to Hosts (Under Network) - delete 127.0.1.1
Add 127.0.1.1
Add Hostname only, no domain entry
->
should work immediatly

Revision history for this message
Hubert (hpereira) wrote :

I cant even upgrade to to Hardy
The update manager gives too many errors
The Gedit will not allow me to save the /etc/hosts
but going via GKSUDO does allow....
I am destined to the 7.10 version (gutsy)

unless someone wants to tell me how to upgrade.
I even downloaded the 700MB file and burned the CD
still wont work!

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

Hello,

Hope fine, also experience the same issue when upgrading.

1. Try run sudo dpkg --configure -a from the terminal.
2. Check out the Local Host File as it is a known bug /etc/hosts.

We can change the Local Host file From Network-> Unlock -Remove the Domain
and add the name of the your computer like vikas-desktop, in may case it is
name of the Computer.

Hope it will work, you will be able to go to Hardy.

Thanks,

On Sat, May 10, 2008 at 12:19 AM, Hubert <email address hidden> wrote:

> *** This bug is a duplicate of bug 32906 ***
> https://bugs.launchpad.net/bugs/32906
>
> I cant even upgrade to to Hardy
> The update manager gives too many errors
> The Gedit will not allow me to save the /etc/hosts
> but going via GKSUDO does allow....
> I am destined to the 7.10 version (gutsy)
>
> unless someone wants to tell me how to upgrade.
> I even downloaded the 700MB file and burned the CD
> still wont work!
>
> --
> unable to resolve host
> https://bugs.launchpad.net/bugs/195308
> You received this bug notification because you are a direct subscriber
> of the bug.
>

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

Revision history for this message
Ernesto Perez (epga) wrote : The right solution

Serenity solution wrote on 2008-05-01 was the right solution to me.
Congratulations
Ernesto

Revision history for this message
PeterH (hoco) wrote :

I had this problem on a new install of Ubuntu 8.04 The default workgroup name had to be adjusted which gave me access from the windows machines on the network but then I could not install GStreamer codecs. I chanced upon this page and learned a lot. Thanks.

JP-NYCs fix worked for me 'though I was a bit perplexed by the / before the hostname. I left it out and it appears to work fine now.

Revision history for this message
Anant Khaitan (anantkhaitan) wrote :

@sancheztavo
The trick worked as a charm.. The problem was solved after I removed the DOMAIN from /etc/hosts

Revision history for this message
Vikas Bhasin (vikasb) wrote : Re: [Bug 195308] Re: unable to resolve host

Thats good

Best wishes,

On Wed, Jul 30, 2008 at 10:50 PM, Anant Khaitan <email address hidden>wrote:

> *** This bug is a duplicate of bug 32906 ***
> https://bugs.launchpad.net/bugs/32906
>
> @sancheztavo
> The trick worked as a charm.. The problem was solved after I removed the
> DOMAIN from /etc/hosts
>
> --
> unable to resolve host
> https://bugs.launchpad.net/bugs/195308
> You received this bug notification because you are a direct subscriber
> of the bug.
>

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

Revision history for this message
Pablo Estigarribia (pablodav) wrote :

I'm still can't fix this.... I tried lot of changes on hosts file but without any result. Also it breaks my zonemider server!

Somebody know how I can fix it from console?

I want to know only the exactly way how this hosts file should look, and if there are something else to do.

Revision history for this message
Pablo Estigarribia (pablodav) wrote :

I fixed this when I put on hosts file:

127.0.0.1 localhost hostname
127.0.1.1 hostname

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 :

127.0.0.1 scotty

I don't know what the reason is that you're still getting this message (probably a mismatch between your hostname and the names configured with /etc/hosts - check the output of 'hostname' to be sure), but this line is definitely wrong. 127.0.0.1 should always be localhost.

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

Strange, typing in:

scotty@:~$ hostname

returns nothing. A blank line. I originally had localhost as the 127.0.0.1 and changed it as per one of the suggested "fixes". Changing it back to localhost produces no positive results. Any idea how to change the blank return for a call of the hostname (as I am assuming that is part of the problem).

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

On Sat, Aug 23, 2008 at 12:02:26AM -0000, Scotty wrote:
> Strange, typing in:

> scotty@:~$ hostname

> returns nothing. A blank line. I originally had localhost as the
> 127.0.0.1 and changed it as per one of the suggested "fixes". Changing
> it back to localhost produces no positive results. Any idea how to
> change the blank return for a call of the hostname (as I am assuming
> that is part of the problem).

You can set your hostname by running 'sudo hostname scotty-laptop'. To fix
this permanently (i.e., across reboots), set this name in the /etc/hostname
file.

Revision history for this message
tutankamon (turevus) wrote :

Guys

1. Although I had all configuration for network (ip adress, dns, gateway etc...) done correctly, I could not access network for some reason (via ethernet) Later I found out that there were too many entries in "hosts" tab of network manager. I cleaned all of them, reboot the machine, and finally I managed to access internet but this time I hit this problem you have been discussing. sudo or su does not work in such a case, I tried gksu gedit and it worked, so first of all thanks for the tip!

2. Another possible solution is "open system -> administration -> network", first unlock by your password, and click on the hosts tab. then enter "127.0.0.1" and as for alias enter the name of your machine. Close- it also works that way.

Gokhan

Revision history for this message
rambitious (rambitious) wrote :

@Serenity
your method worked perfectly with me , thank you

Revision history for this message
gerstrong (gerstrong) wrote :

Worked for me, too, but since Ubuntu still has that problem, I think it should be fixed. That Problem is known since february. Hope in Interpid it will be fixed

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
Adnan Abd Rahim (adnan-nexusbox) wrote :

to solve this problem I think it is simple problem accured after upgrading release.

edit your /etc/hosts

make the following change

127.0.0.1 localhost
127.0.0.1 yourhostname
192.168.1.100(depend what is your ip address) yourhostname localhost

then run the hostname with --boot option

# hostname -b yourhostname

# hostname -v
yourhostname

to recheck exit console/terminal and relogin

Revision history for this message
techjacker (andy-techjacking) wrote :

below is how I fixed the problem:

>Edit your /etc/hosts file to resemble the following example, replacing "12.34.56.78" with your Linode's IP address, "plato.bambookites.com" with your fully qualified domain name, and "plato" with your short hostname.

sudo nano /etc/hosts
127.0.0.1 localhost.localdomain localhost
12.34.56.78 plato.bambookites.com plato

> THEN make sure that /etc/hostname is the same:

sudo nano /etc/hostname
127.0.0.1 localhost.localdomain localhost
12.34.56.78 plato.bambookites.com plato

> THEN Set your hostname by issuing the following commands, replacing "plato" with your short hostname.
echo "plato" > /etc/hostname
hostname -F /etc/hostname

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Bug attachments

Remote bug watches

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