1

This is for Ubuntu 16.04 LTS I got a prompt:

Updated software is available for this computer. Do you want to install it now?

When I go ahead with update it gives me an error:

The package system is broken -
Check if you are using third party repositories. If so disable them, since they are a common source of problems.
Furthermore run the following command in a Terminal: apt-get install -f

How can I find out which third party repositories am I using?

Based on inputs provided below, I tried below commands. Also mentioned the output -

sudo apt -f install

dpkg: error: reading package info file '/var/lib/dpkg/status': Input/output error E: Sub-process /usr/bin/dpkg returned an error code (2)

sudo dpkg --configure -a

dpkg: error: reading package info file '/var/lib/dpkg/status': Input/output error

sudo apt update

Reading package lists... Error! E: Read error - read (5: Input/output error) W: You may want to run apt-get update to correct these problems E: The package cache file is corrupted

  • 1
    What is the output of sudo apt -f install and sudo dpkg --configure -a and sudo apt update? – Ali Razmdideh Aug 13 '17 at 14:38
  • @ali76 - Error for all 3 commands - sudo apt -f install >dpkg: error: reading package info file '/var/lib/dpkg/status': Input/output error E: Sub-process /usr/bin/dpkg returned an error code (2) sudo dpkg --configure -a >dpkg: error: reading package info file '/var/lib/dpkg/status': Input/output error sudo apt update >Reading package lists... Error! E: Read error - read (5: Input/output error) W: You may want to run apt-get update to correct these problems E: The package cache file is corrupted – ADhopate Aug 13 '17 at 15:19
  • Please edit your question and add those three commands output to it – Ali Razmdideh Aug 13 '17 at 16:26
1

if you have synaptic package manager it will open software sources

here you can disable/enable repositories enter image description here

1

Finally after much troubleshooting I found the issue and the solution to resolve it. Writing all findings here so that it can help others and may not need to do the lengthy troubleshooting that I had to do.

Root cause:

Issue, if I am not wrong, was with the disk space. During one of the recent upgrades my disk space got full and 0% was available for upgrades. Because of this /var/lib/dpkg/status is corrupted. And after that it just refuse to upgrade, install or remove any application and gave the error mentioned above.

Steps to resolve the issue:

  1. First, fix the reason behind mess. Cleaned up few old and unwanted files to free up disk space. Now I have almost 5% available disk space which should be sufficient for normal behaviour and complete the original upgrade which failed because of insufficient disk space.
  2. Now, repair the damage it caused. Correct file /var/lib/dpkg/status. Here, as usual, experts and their contribution on this forum helped me to get the previous known good status file from /var/backups. Every time you do an install or a update, the status file is saved to a gzipped backup under /var/backups. Refer here for complete details on this. Below are the commands that I used -

~$ sudo mv /var/lib/dpkg/status /var/lib/dpkg/status_bkup

~$ sudo cp /var/backups/dpkg.status.2.gz /var/lib/dpkg/

~$ sudo gunzip -d /var/lib/dpkg/dpkg.status.2.gz

~$ mv /var/lib/dpkg/dpkg.status.2 /var/lib/dpkg/status

~$ sudo apt-get update

voila!! it completed the update without errors faced earlier.

  1. Now, to complete the update and ensure that the problem is resolved; try update or installing a new application-

~$ sudo apt-get -f install

Fetched 14.3 MB in 15s (935 kB/s)
Extracting templates from packages: 100% Preconfiguring packages ... dpkg: error: parsing file '/var/lib/dpkg/status' near line 18299 package >'libgdk-pixbuf2.0-common': end of file during value of field 'Original-Maintainer' (missing final >newline) E: Sub-process /usr/bin/dpkg returned an error code (2)

  1. Somehow, status file was again modified and a new error was introduced. Since now I know what is status file and how to troubleshoot is, I understood that this is because of a syntax error in status file. It was easy to identify that '>' is missing for one of the packages at end. Corrected the status file to include '>' at end.

  2. Try again and it was successful this time!

Cheers,

Anirudha

0

At a command line (eg Gnome's terminal, or KDE's konsole) run this:

sudo rm -r /var/lib/apt/lists/* && sudo apt update

This will remove the package cache and then update to get the package lists from the external repos. Add && sudo apt dist-upgrade is you also want to do a full update afterwards.

Note the && simply means that if the first part completes without an error then run the next part.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.