48

Everytime I sudo apt-get update it always not complete and will say in the end

E: Read error - read (5: Input/output error)
E: The package lists or status file could not be parsed or opened.

Same goes, when I try to install something and do sudo apt-get install <some app>

What should I do ? I admit, that my drive has bad sectors, could that be the reason? Is there anything else I can do?

Braiam
  • 67,791
  • 32
  • 179
  • 269
  • I am experiencing the same problem,even though i followed solution provided by Avinash Raj the error recurrs. is there any other way to approach this problem. thanks in advace – saikumarm May 09 '14 at 12:06
  • Could it be HDD problems? I have been having the same problems and my file system kept on falling back to a read-only system. – Dennis M. Mwebia Jun 29 '15 at 07:57

4 Answers4

51

This is old question, but just for archive purpose... the follow was what solve this problem in my case:

sudo rm /var/lib/apt/lists/* -vf
sudo apt-get clean
sudo apt-get update
leticia
  • 611
45

Try using an older status file,

sudo mv /var/lib/dpkg/status /var/lib/dpkg/status.bad
sudo cp /var/lib/dpkg/status-old /var/lib/dpkg/status
sudo apt-get update
Avinash Raj
  • 78,556
8

I was running into a similar error:

Reading package lists... Error!
E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/dpkg/status
E: The package lists or status file could not be parsed or opened.

I followed similar suggestions to copy status-old.

$ head /var/lib/dpkg/status
$ head /var/lib/dpkg/status-old

All of my status files were blank for some reason. Luckily, I found out there are backups of these files:

$ ls -l /var/backups/dpkg.status.*
-rw-r--r-- 1 root root 444620 Nov 15 06:33 /var/backups/dpkg.status.0
-rw-r--r-- 1 root root 444620 Nov 15 06:33 /var/backups/dpkg.status.1.gz
-rw-r--r-- 1 root root 128168 Sep 20  2013 /var/backups/dpkg.status.2.gz
-rw-r--r-- 1 root root 112545 Sep 16  2013 /var/backups/dpkg.status.3.gz
-rw-r--r-- 1 root root 107767 Sep 14  2013 /var/backups/dpkg.status.4.gz
-rw-r--r-- 1 root root 107766 Sep 11  2013 /var/backups/dpkg.status.5.gz
-rw-r--r-- 1 root root  94583 Sep 11  2013 /var/backups/dpkg.status.6.gz

I checked the latest backup...

$ head /var/backups/dpkg.status.0

...but it was still blank. So I unzipped an older one...

$ gunzip /var/backups/dpkg.status.1.gz
$ head /var/backups/dpkg.status.1

This time there was content. So I copied it...

$ cp /var/backups/dpkg.status.1 /var/lib/dpkg/status

Then apt-get update ran without problems.

Credit goes to this post.

Andrew
  • 299
0

I had a similar error, but the problem was not in dpkg.status, but in an apt listing.

To check the likely cause, run strace -efile apt install something. Then look for the last files accessed before the error message shows:

stat("/var/lib/apt/lists/linux.dropbox.com_ubuntu_dists_xenial_main_i18n_Translation-en%5fUS.uncompressed", 0x7fffd2f39d00) = -1 ENOENT (No such file or directory)
stat("/var/lib/apt/lists/linux.dropbox.com_ubuntu_dists_xenial_main_i18n_Translation-en%5fUS", 0x7fffd2f39e50) = -1 ENOENT (No such file or directory)
stat("/var/lib/apt/lists/www.fossology.org_releases_2.6.2_Ubuntu_dists_14.04_InRelease", 0x7fffd2f39d10) = -1 ENOENT (No such file or directory)
stat("/var/lib/apt/lists/www.fossology.org_releases_2.6.2_Ubuntu_dists_14.04_Release", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
stat("/var/lib/apt/lists/www.fossology.org_releases_2.6.2_Ubuntu_dists_14.04_InRelease", 0x7fffd2f396d0) = -1 ENOENT (No such file or directory)
stat("/var/lib/apt/lists/www.fossology.org_releases_2.6.2_Ubuntu_dists_14.04_Release", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
stat("/tmp", {st_mode=S_IFDIR|S_ISVTX|0777, st_size=57344, ...}) = 0
open("/tmp/fileutl.message.XlglFW", O_RDWR|O_CREAT|O_EXCL, 0600) = 5
unlink("/tmp/fileutl.message.XlglFW")   = 0
open("/var/lib/apt/lists/www.fossology.org_releases_2.6.2_Ubuntu_dists_14.04_Release", O_RDONLY) = 6
open("/var/lib/apt/lists/www.fossology.org_releases_2.6.2_Ubuntu_dists_14.04_Release", O_RDONLY) = 5
stat("/var/lib/apt/lists/www.fossology.org_releases_2.6.2_Ubuntu_dists_14.04_Release", {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
Reading package lists... Done
E: The package lists or status file could not be parsed or opened.
+++ exited with 100 +++

In my case, the last file (a Release file from fossology) turned out to be 0 bytes long. Removing that repository enabled apt to resume normal functionality

David Fraser
  • 1,717