Ubuntu Server 11.04 apt-get not functioning after several fresh installs

aptdellUbuntu

Apt-get update errors

I have been searching for hours to try and bring an end to these errors.

sudo apt-get update 
W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_natty_universe_source_Sources  Hash Sum mismatch

I burnt several CD's, verified them, used the install cd to check for memory issues, and even calculated the md5 of my download.

All of the usual suspects checked out.

I have done previous installs using this disk and they where running fine. Connected at the same location is another (i386) box that is able to run apt-get just fine. I have looked around and tried a myriad of different methods to clear the lists or change the source by I am nearly sure it's a local issue.

The box in question is a Dell Inspirion 530 with two attached nics. Sorry for not including more details but am not sure what log to dump or what info is useable but will upon any request to do so.

Thanks


Update

In response to suggestions that symptoms might be a result of downloading issue (I would have to agree) I have run the following tests.

steven@DellServer:~$ ping us.archive.ubuntu.com
PING us.archive.ubuntu.com (91.189.88.46) 56(84) bytes of data.
64 bytes from lithium.canonical.com (91.189.88.46): icmp_req=1 ttl=47 time=157 ms

It is resolving and can reach the host. I flushed the lists.

steven@DellServer:~$ sudo rm -rf /var/lib/apt/lists/*
steven@DellServer:~$ sudo mkdir -p /var/lib/apt/lists/partial

And tried again. I got similar errors for multiple lists.

bzip2: Data integrity error when decompressing.
W: Failed to fetch gzip: ... Hash Sum mismatch

I even put the box on my secondary ISP's line. Same result. I also checked and there is no file in /etc/apt/atp.conf.d/01proxy and I haven't set the environment variable for any proxy.

Downloading a package list manually with wget and decompressing bzip2 failed, returning the same bzip error. Using gzip on the .gz also failed. I sftp'd the .bz2 that the server had downloaded onto my where it also failed.

I downloaded it from the archive onto my workstation and I was able to decompress it. Same for the .gz. The problem must lie in the download but I am puzzled how this could be seeing as both my workstation and my server are on the same connection to my ISP and it's networking seems to be functioning well.

Since the interface in question is a PCI NIC I have decided to reinstall with them out and use the integrated NIC.

Solved

following nik's logic I removed the nic and used the integrated interface and I am no longer having problems except for the useless nic I wanted to use.

Thanks nik

Best Answer

Try this once,

Open a terminal and execute,

 sudo rm -rf /var/lib/apt/lists/partial/*   

While the 'rm -rf' command is dangerous, running it specifically for the above path is not going to harm your system. If there is a bad copy lying around there causing this hash-failure, it might fix your problem.

Retry the 'update' after that command is done cleaning up the partially downloaded lists.

You could also check for any partial files existing in that path when the command fails. You might find the file in your question hanging around when the command failed.

One theory is, the list download failed (you got an incomplete file) and the hash-check failed on it.


Update on your two comments.
I suspect that you have a problem with getting the list.
Removal of the list causes fetching it again and sometimes it reaches you properly.
When it does not, your update fails as you describe in your question.

I think moving away from the distro is a strong step for this -- try to figure out why your download does not work properly.