I am unable to install updates. When I try to install using Terminal, I get the error "sudo: unable to lookup via gethostbyname()".

Asked by ratoncrispin

I just installed Ubuntu 6.06 on an old computer because Windows 98 updates would not download among other things, but now I still cannot download updates and I get the following error whenever I try to install anything using terminal:

sudo: unable to lookup via gethostbyname()

The automatic update feature does not seem to work. the cursor changes to the working symbol and then changes back to a cursor, but nothing else happens.

Any ideas?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
ratoncrispin
Solved:
Last query:
Last reply:
Revision history for this message
Ian Ace (iaculallad) said :
#1

Make sure that both hostname is the same for both files listed below:

/etc/hostname and /etc/hosts

and

/etc/hosts

You can edit the hostname by booting on Recovery Mode.

Example:

ian@web-server:~/Desktop$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 web-server

ian@web-server:~/Desktop$ cat /etc/hostname
web-server

Both files contain the same hostname which is web-server

HTH.

Regards,

Ian

Revision history for this message
ratoncrispin (chantrillj) said :
#2

Thanks for the rapid response.

I get the following response:

bash: /home/ratoncrispin/Desktop$: No such file or directory

when I change the filename from Desktop$ to one that I know is in the directory it states

bash: /home/ratoncrispin/setupff: Permission denied

Revision history for this message
Ian Ace (iaculallad) said :
#3

Are you booting from recovery mode?

Change the hostname by performing the commands below:

nano /etc/hosts

and

nano /etc/hostname

Revision history for this message
ratoncrispin (chantrillj) said :
#4

hosts has two servers and hostnames is empty. how do I fix this?

---------- Original Message ----------
From: Ian Ace Culallad <email address hidden>
To: <email address hidden>
Subject: Re: [Question #71309]: I am unable to install updates. When I try to install using Terminal, I get the error "sudo: unable to lookup via gethostbyname()".
Date: Sat, 16 May 2009 03:40:48 -0000

Your question #71309 on Ubuntu changed:
https://answers.launchpad.net/ubuntu/+question/71309

    Status: Open => Answered

Ian Ace Culallad proposed the following answer:
Are you booting from recovery mode?

Change the hostname by performing the commands below:

nano /etc/hosts

and

nano /etc/hostname

--
If this answers your question, please go to the following page to let us
know that it is solved:
https://answers.launchpad.net/ubuntu/+question/71309/+confirm?answer_id=2

If you still need help, you can reply to this email or go to the
following page to enter your feedback:
https://answers.launchpad.net/ubuntu/+question/71309

You received this question notification because you are a direct
subscriber of the question.

____________________________________________________________
Get a life insurance quote online. Click to compare rates and save.
http://thirdpartyoffers.juno.com/TGL2131/fc/BLSrjnsO5FvvvwHahwvZMl7fSa2MTIctvK7h7Y86lSrwuWPR3CEJEDNn1vS/

Revision history for this message
ratoncrispin (chantrillj) said :
#5

Thanks guys, that did it. You are geniouses.

I restarted in recovery mode and entered the commands:

cd /home/ratoncrispin/Desktop

cat /etc/hosts
cat /etc/hostname

since there was no host name I entered

cd /

nano /ect/hostname

This opened a text editer with no text. "localhost was the one you mentioned should be in there and it showed up under my hosts file, so I just typed "localhost". Then I presed CTRL+X to exit. finally I restarted my computer. Now it seems to be working fine.

Mahalo Nui Loa