when using the add and remove program it says it "could not resolve localhost". How can this be fixed so i can download programs?

Asked by acwhite

when i try to add programs using the add and remove program under the Applications button on the top bar of hardy version, it begins to download and then i get a message that says, An error has occured-- W:Failed to fetch http://us.archive.ubuntu.com/ubuntu/pool/main/pool/k/kdepim/a--------etc. Could not resolve 'localhost' i use a laptop with a wifi connection. How can i fix this?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
marcobra (Marco Braida)
Solved:
Last query:
Last reply:
Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#1

Into the /etc/hosts file there must be the computer name the terminal command:
lshw | head -1
it give me "ubuntu" is my computer name

and into my /etc/hosts i have:
127.0.0.1 localhost ubuntu
127.0.1.1 ubuntu

So please check your configuration,
Please open a Terminal from the menu Applications->Accessories->Terminal and type or better copy and paste:

lshw | head -1

you will get your computer name

Now edit your /etc/hosts file, type:

sudo gedit /etc/hosts

give your user password when requested, you don't see nothing when you type it, then press enter.

And check it and put your computer name if needed as the example of my conf.

Hope this helps

Revision history for this message
acwhite (acwhite2) said :
#2

i was able to do as suggested and recieved this new message, Could not connect to localhost:4001 (127.0.0.1). -connect (111 Connection refused) Thanks for the help yet i think i need a little more.

Revision history for this message
marcobra (Marco Braida) (marcobra) said :
#3

Please check if apt-get works, open a Terminal from the menu Applications->Accessories->Terminal and type:

sudo apt-get update
sudo apt-get upgrade

give your user password when requested, you don't see nothing when you type it, then press enter.

Please tell if you get same connection error.

Please tell/check if you have set some proxy setting... into System->Administration->Synaptic Package Manager options

Hope this helps

Revision history for this message
acwhite (acwhite2) said :
#4

yes i get the same connection error. have not set proxy settings. direct internet connection. i could download updates and programs until i was trying to get wireless to work. i was having trouble with this and at one point when i was somewhere in one of the network programs there was a window that had some info including a 4--- port with some kind of localhost loopback or something like that. i thought that might be causing the problem so i erased it and the wireless worked after that. i think it was coincidence. this is my first try with ubuntu, so i messed this up. i thank you, marcobra, for all the help. after getting some sleep i'm back at it, trying different localhost configurations in network settings with no luck so far. still open to other suggestions.
thank you.

Revision history for this message
Best marcobra (Marco Braida) (marcobra) said :
#5

Please don't touch localhost values.
Keep them as above.

I think you have to configure your wireless device better.
i suggest you to keep it as dhcp mode for it.
Please feel free to ask.

Thank you

Revision history for this message
acwhite (acwhite2) said :
#6

once again thank you for all the help. after trying this and more i took the easy way out and just reinstalled ubuntu. i held my breath as i deleated ubuntu's patition as i have two other os on this machine. ubuntu picked that up and added them to the boot menu and i'm back to work.