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

15 Answers 15

up vote 361 down vote accepted

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

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

then run:

sudo apt-get update
share|improve this answer
49  
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
6  
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
4  
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
6  
@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 '14 at 3:33
2  
We need prefix -rf, so it will look like sudo rm -rf /var/lib/apt/lists/* – oscar Feb 6 '15 at 0:45

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
4  
That blueprint is no longer accessible; here's an archived copy. – Eliah Kagan Apr 23 '15 at 15:13
7  
this bug also exists on ubuntu 16.04 – Scott Stensland Mar 31 '16 at 19:34
1  
The bug has been marked as "Fix Released". – Paranoid Panda Apr 5 '16 at 12:17
    
I just change my mirror default to the best server and its work for me. – habibun Jul 23 '17 at 15:28

The easiest way to fix this is:

sudo apt-get clean
sudo apt-get update
share|improve this answer
7  
After trying the accepted answer I still had the same errors, trying this immediately afterwards fixed the issue – Alex Oct 21 '15 at 10:50
12  
Doing sudo rm -rf /var/lib/apt/lists/* then sudo apto-get clean fixed the problem for me also. Neither worked in isolation. – Cam Oct 29 '15 at 23:27
1  
This should be the correct answer. – Clayton Dukes Jan 11 '16 at 18:07
2  
does not help on ubuntu 16.04 ... neither does the comment above help any – Scott Stensland Mar 31 '16 at 19:46
1  
For me, accepted answer did not work, but this one worked (Ubuntu 16.04). – JCasso Jun 2 '17 at 17:40

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 -re 's/\w+\.archive\.ubuntu\.com/archive.ubuntu.com/g' /etc/apt/sources.list

I don't know if this is the right way of fixing it...
I've found the solution here.

share|improve this answer
12  
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 '14 at 19:53

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
2  
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
3  
@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 '14 at 6:49
1  
Changing the mirror worked for me when none of the above answers did. – mango Mar 25 '16 at 16:16

The only solution that worked for me is from unix.stackexchange.

It happens because there's a known bug it apt, and the solution is to update with a different compression method, so the files load correctly and the checksum succeeds.

Give this a try:

sudo rm -rf /var/lib/apt/lists/partial
sudo apt-get update -o Acquire::CompressionTypes::Order::=gz

(thanks @brook_hong from the comments for the rm part)

share|improve this answer
1  
This is the only solution here that worked for me. Thanks. – Cerin Jun 21 '16 at 17:53
2  
It worked for me too. Note that you don't have to always run this command. Just run it once, and then you can run "apt-get update" without error. – dalf Jul 6 '16 at 1:35
1  
Before try with the option, we must clean the partial folder -- sudo rm -rf /var/lib/apt/lists/partial. I wrote an article for why. brookhong.github.io/2016/10/10/… – brook hong Oct 10 '16 at 10:17

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
3  
I just tried, and it did not work; The first apt-get update created files in the same place again in that directory. – Volker Siegel Jan 23 '15 at 11:17

If you're behind a proxy, then create a file named 99fixbadproxy in /etc/apt/apt.conf.d/:

sudo gedit /etc/apt/apt.conf.d/99fixbadproxy

Paste this into 99fixbadproxy and save it:

Acquire::http::Pipeline-Depth 0;
Acquire::http::No-Cache true;
Acquire::BrokenProxy    true;

Now run the update command:

sudo apt-get update
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
    
This does work yet it effectively blinds the machine from being able to install packages not part of the core build (until those checkboxes are re-activated later) ... yet necessary at times just to achieve an error free apt-get update which enables install of targeted packages – Scott Stensland Apr 6 '16 at 15:39

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
    
Yes, only thing that worked for me. Switzerland server seems broken. – Eric MORAND Sep 4 '17 at 14:26

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 → Ubuntu software: Download from: Change local to main server

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 14.04.4 LTS.

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

As follow @robie-basak, I used apt-cacher-ng as mirror caching. So I Remove the proxy and the problem solved.

I remove the proxy in file /etc/apt/apt.conf.d/01proxy:

#Acquire::http::Proxy "http://xxx.xx.xx.xx:4321";

Then need to:

sudo rm -rf /var/lib/apt/lists/*
sudo aptitude update
sudo aptitude upgrade
share|improve this answer

I had just recently install Ubuntu 17.10 and was getting the same error of Hash Sum Mismatch for a some repository.I went to Software and Checked Source as shown below and there were no problems further for downloading repository from the terminal.

My Software and Update Section

share|improve this answer

protected by Anwar May 22 '15 at 15:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

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.