10

I cannot install any packages for Ubuntu 12.04. Even after clearing files under:

/var/lib/dpkg/lists/partial/* /var/lib/dpkg/lists/*
/var/cache/apt/*

Changed the repository and tried apt-get clean and all other resolutions provided by Ubuntu forums. Nothing worked, I had same issue before and reinstalled Ubuntu. But that is not the permanent solution.

:~$ sudo apt-get update
95% [1 Sources bzip2 0 B] [Waiting for headers] [Waiting for headers]bzip2: (stdin) is not a bzip2 file.
98% [2 Packages bzip2 0 B] [Connecting to archive.ubuntu.com (91.189.92.201)]bzip2: (stdin) is not a bzip2 file.
100% [6 Translation-en bzip2 0 B] [Waiting for headers]                                                                                                      154 B/s 0sbzip2: (stdin) is not a bzip2 file.
Fetched 5,722 B in 14s (403 B/s)
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_source_Sources  Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_main_binary-amd64_Packages  Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-amd64_Packages  Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages  Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_binary-i386_Packages  Hash Sum mismatch
W: Failed to fetch gzip:/var/lib/apt/lists/partial/archive.ubuntu.com_ubuntu_dists_precise_universe_i18n_Translation-en  Encountered a section with no Package: header
E: Some index files failed to download. They have been ignored, or old ones used instead.

Hope Ubuntu developers should definitely know the quick workaround to fix this. This is a very common issue for all Ubuntu users which is unsolvable. Kindly create a global FAQ answers to fix this issue.

  • I had this problem before, fixed it by changing the protocol to ftp. try a mirror that supports ftp access. and if you are already using ftp, try a http mirror. – Anam Ahmed Mar 07 '13 at 07:56
  • Can you please post me the apt sources list which you have used for it – Sivaprakash Mar 07 '13 at 09:11
  • I have tried with a changing the mirror to an ftp. but it fails, hope there could be some other work around – Sivaprakash Mar 07 '13 at 09:20
  • What modifications have you made to the OS? Your prompt looks a bit "different". Why are you trying to download both i386 and amd64 packages? Where did you get your .iso from? –  Mar 07 '13 at 09:36
  • apt-get failes due to the issue in wget. wget fails to download files. It downloads the files with 0 bytes. Anyone knows what could be the issue.. – Sivaprakash Mar 07 '13 at 10:03

1 Answers1

14

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

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

then run:

sudo apt-get update

Source: Lorem's answer on Trouble downloading packages list due to a “Hash sum mismatch” error