[ubuntu-za] Failed to update repository information

Lloyd Reijers lloyd.reijers at gmail.com
Mon May 30 14:56:51 UTC 2011


On Sun, 2011-05-29 at 17:11 +0200, Robin Bownes wrote:
> When I try to update repository information, I get the following error
> message:
> W:Failed to fetch
> gzip:/var/lib/apt/lists/partial/za.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.


Firstly, what does the error mean?
A "hash sum" is often used when files are made available for download by
an organisation. An algorithm (the hashing function) is run against the
content of a file at the server side, which produces a hash sum. The
file is made available for download, as well as its hash sum. A client
may download the main file, and run the same hashing function on the
downloaded file. If the client-side hash sum matches the server-side
hash sum, then it's a fair assumption that the file that was downloaded
matches the downloadable version on the server (and wasn't mangled in
the download).

Try it... Create a simple text file in your home directory with some
content. Then drop to a command prompt (terminal). Run the program 
   you at pc:~$ md5sum ~/yourfile.txt
This will output something along the lines of 
   62b6830c7a131d6a54c728a95f6dcb30  /home/you/yourfile.txt
Now modify yourfile.txt (adding a simple new line character is enough to
make it different enough to generate a completely different hash sum),
and run the md5sum program again. 
   1a0a9976e3fd3e46c3bca3df60861fb4  /home/you/yourfile.txt

So why _does_ the Hash Sum mismatch occur in your example?
A few reasons, each with different fixes.
1. The organisation has just published the content for download, but
they have not published the correct hash sum yet, as there may be a few
moments between the main file and the hash sum file being made public.
(Especially where mirror servers are involved).
Solution: wait a while, and try again.
Solution, corollary: switch server set (e.g. from south africa to main),
update, switch back a few days later.
2. A proxy server _somewhere between you and the download host_ has
cached the hash sum of an older version of the file, and though you're
requesting the hash sum for the new file, you're being served the older
one.
Solution: execute
   you at pc:~$ sudo apt-get update -o Acquire::http::No-Cache=True
   you at pc:~$ sudo apt-get upgrade
This -o flag instructs apt-get to send appropriate headers through in
the http request telling cacheing proxy servers to mind their own
business.
3. Your apt-get is confused (probably because of a bug, or disk
corruption, or worse). You can remove all of the locally cached versions
of the package files, gpg keys and hashes by removing the contents of
the /var/lib/apt/lists folder. This will require a fresh download (via
apt-get upgrade) of ALL of your package source information.
NOTE: NEVER execute 'sudo rm -Rf /xxx' without understanding the
command.
Solution: execute 
   you at pc:~$ sudo rm -fR /var/lib/apt/lists/*
   you at pc:~$ sudo apt-get upgrade
4. Double check the content of all the files in /etc/apt/sources.list.d/
and the content of /etc/apt/sources.list and check for non-sequiturs.
There may be archives you're requesting to check, but are old and
outdated. Purge them (make a backup first in a different directory if
you're nervous). If you're using natty, all your sources.list entries
should be natty. If you're using maverick, all your sources.list entries
should be maverick. You get the picture. (P.S. I've never seen this
reason causing the warning you posted about though - It's just a last
resort effort to solve the problem)

> I often find the solutions to Ubuntu issues by Googling. In this
> instance, I did not find a solution that I understood. I therefore
> came to this list looking for assistance that I, as an ex-Windows, and
> relatively inexperienced Ubuntu user could understand and use. I was
> not looking for sarcasm or to be spoken to as if I am an idiot. There
> are often impassioned discussions on this, and other Ubuntu lists,
> regarding how to attract people to Ubuntu. I'm afraid that the general
> tone, and lack of helpfulness of your reply are not what is needed in
> this regard, and certainly not what I was looking for.

Sigh. Step away from the drama triangle.

The thing that you really should try to take from Raoul's email is the
bit about 'maybe no-one has replied because it was not obvious that
you'd done _any_ research', nor that you're a relatively inexperienced
Ubuntu user. In general, pleas for help should be accompanied by a list
of things you've attempted, as it helps those who're going to attempt to
help you, and serves as a record for those who come after you and find
your question (and hopefully result) via google etc. Further to that: If
your issue is actually fixed by a mailing list query, it's useful to
reply to the list that the issue is fixed and what you did.

Anyway - I'm betting 2 or 3 will fix your issue. Good luck.

regards
L




More information about the ubuntu-za mailing list