Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I check for updates, I get a "Failed To Download Repository Information" error.

This is what comes up under details:

W: Failed to fetch gzip:/var/lib/apt/lists/partial/us.archive.ubuntu.com_ubuntu_dists_natty_main_source_Sources  Hash Sum mismatch, 
E: Some index files failed to download. They have been ignored, or old ones used instead.
share|improve this question

9 Answers 9

up vote 86 down vote accepted

Just remove the content of /var/lib/apt/lists directory:

sudo rm /var/lib/apt/lists/*

then run:

sudo apt-get update
share|improve this answer
11  
If you remove all files, you have to download them again. You can just remove the invalid file to make this process faster. –  Behrang Jul 28 '13 at 12:51
3  
I remember this happening with Debian, too. The solution was to switch repositories (eg, from us.ubuntu.com to XX.ubuntu.com where XX is your country code) or waiting. The best idea would be to wait a bit and retry later. Removing the lists might fix broken lists, but that's rarely the case. –  f.ardelian Jul 31 '13 at 10:58
2  
Old question, but on some distros (Like emdebian), after doing this you'll need to "mkdir /var/lib/apt/lists/partial" (As root, obviously.), or else you cannot "apt-get update" or otherwise use apt. –  Archenoth Dec 26 '13 at 3:48
1  
Provide some explanation of the why this happen –  Édouard Lopez Aug 2 at 21:06
1  
@AlyssaGono if it's a folder, you need to run rm with the recursive flag like so: sudo rm -R /var/lib/apt/lists/* however, even doing that didn't work for me. –  mchid Dec 11 at 3:33

This is a known issue, and is exacerbated for clients behind proxy caches. Some large organisations and ISPs (especially in remote parts of the world) have transparent caches of which you may not be aware.

The fundamental issue is that the apt repository format is subject to race conditions when a mirror is updated. This problem particularly affects repositories that change rapidly, such as the development release.

You can track progress on the fix for this in this bug (please mark yourself as "affects me too" in the bug) and this blueprint. But be aware that it is a complex issue and may take more than one release to resolve.

share|improve this answer

This can happen when your mirror is not up to date or serving errors from being overloaded. You can either wait a while and try again, or switch to another mirror:

share|improve this answer
1  
Why does a server not being up to date, or being overloaded, cause a file with the correct name to successfully download (in the sense that the connection doesn't terminate until all the bytes are sent and received), but be corrupted? (I'm not asserting that doesn't happen, I'm just hoping you might be able to explain why it does.) –  Eliah Kagan Aug 13 '12 at 21:30
2  
@EliahKagan The problem normally is not that the file itself is corrupted, but that there is a (I am simplifying but not too much) data file and an index file containing the hash (fingerprint) of the data file. When the repositories are updated (happens every hour) on the server one file after the other gets updated. Now it can happen that your client (apt-get or similar) accesses the server when the data file has been updated but the index file has not been updated (or vice versa), yet. Then the hash doesn't match the data file and the client (falsely) assumes that the data file is corrupted. –  Patrick Häcker Apr 14 at 6:49

I still had the problem after removing the directories and doing sudo apt-get update.
Only the following step solved my problem:

sudo sed -i 's/de.archive.ubuntu.com/archive.ubuntu.com/g' /etc/apt/sources.list

This should just fix the problem for German configured apt sourcelists I guess.
And I even don't know if this is the right way of fixing it...
I've found the solution here.

share|improve this answer
1  
One should note that de-part indicates a server for Germany and that this script replaces to local server with the main server. Going to Software Sources the GUI-way and switching the setting there would be safer and reversible for a lot of users. The following should work for almost every country: sudo sed -i 's/[a-z][a-z].archive.ubuntu.com/archive.ubuntu.com/g' /etc/apt/sources.list –  LiveWireBT Sep 10 at 19:53
    
works for me...thanks:) –  Alyssa Gono Nov 26 at 7:54

The following commands may solve your issue.

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

and then

sudo apt-get update && sudo apt-get upgrade

it will solve your problem. I also faced the same problem but the above commands solved the problem for me. So give them a try.

Solution reference

share|improve this answer

I don't know that it's proper solution or not, but I did the following and the error message's gone:

After typing sudo apt-get update in terminal, it gives me the names of some packages which cause the error then I did the following:

Update manager(software update) → Setting → Configure Software Sources → Other software[tab] → Uncheck the packages

After pressing the "close" bottom, update manager started to check for update automatically again and I saw this message:"the software on this computer is up to date. Last checked 2 seconds ago."

Kubuntu 12.04

share|improve this answer

I have resolved all the packages not being installed by running

sudo apt-get install PACKAGENAME

for each of the packages. They are now installed and the "Hash Sum mismatch" error has gone.

share|improve this answer

I had the exact same problem and all solutions provided using the terminal did not help.

For me, it was by going into:

Settings → Software & Updates → Other software: Uncheck all the boxes and press close.

It starts reloading the repos and updating. When I enter:

sudo apt-get update

After that, there was no problem at all. I'm using Ubuntu 13.10.

share|improve this answer

I had a similar problem and solved it by opening theh application "Software & Updates" and, in "Ubuntu Software" tab, changing the value of "Download from" (in that drop-down list, try to select, for example, Main Server if it was not like that).

share|improve this answer

protected by Braiam Nov 12 at 23:42

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.