3

I have been having an error trying to update my system. Currently I can't install/remove or update anything with apt-get...

Here is the error I get when running apt-get update

dpkg: unrecoverable fatal error, aborting:
 reading files list for package 'indicator-session': Input/output error
E: Sub-process /usr/bin/dpkg returned an error code (2)
Achu
  • 21,237
drumusician
  • 71
  • 1
  • 4

2 Answers2

4

Ok, I looked around some more and found a solution: It is in this post: Unable to install any updates through update manager/apt-get upgrade

There is a link in the answer to this page: http://ubuntuforums.org/archive/index.php/t-1232143.html

It comes down to editing the /var/lib/dpkg/status file and removing everything related to the broken package.

My system is up and running again!

drumusician
  • 71
  • 1
  • 4
  • I've been unable to fix this problem for such a long time and just not installed anything. This helped! – petur May 12 '16 at 06:56
3

Here is the output I got from apt-get:

dpkg: warning: files list file for package `libecryptfs0' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `libplexus-containers1.5-java' missing, assuming package has no files currently installed.
dpkg: warning: files list file for package `apport' missing, assuming package has no files currently installed.

And this is how I fixed it:

  1. Backup the dpkg status file:

    cp /var/lib/dpkg/status{,.backup}
    
  2. Edit the /var/lib/dpkg/status file¹ and remove the sections for the packages that apt-get printed warnings about. Make sure that you remove the whole section about these packages, i. e. starting with the line Package: libecryptfs0 down to the first blank line.

    Alternatively you can use sed to do the work for you:

    sed -i.backup -e '/^Package: \(libecryptfs0\|libplexus-containers1\.5-java\|apport\)$/,/^$/d' /var/lib/dpkg/status
    

    This command deletes all sections between and including the lines with Package: <PACKAGE_NAME> and the next empty line. You can place any valid package names between the parentheses \(…\), delimit them with \|, and escape the dots (.\.). The option -i.backup edits the file in place and creates a backup file suffixed with .backup (so you can skip step 1 if you use variant) instead of writing the result to stdout.

  3. Run sudo apt-get -f install to configure unconfigured packages and (re-)install missing package. The packages are missing because we removed them from the status file.

¹ See How do I get permissions to edit system configuration files? for how to that.

David Foerster
  • 36,264
  • 56
  • 94
  • 147