Issue with apt-get on Debian Jessie

1

Last week our web host was DDOSed and in the aftermath, one of our servers is experiencing problems.

The server runs Debian Jessie, and every time I try to run apt-get update, I get the following 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.

Everything I've found suggests this can normally be resolved by either running sudo rm /var/lib/apt/lists/* -vf or sudo dpkg --configure -a beforehand, but neither is working for me. I've also tried switching to a different mirror, but that doesn't solve the problem.

Any suggestions, folks?

mattbd

Posted 2016-02-15T10:23:54.657

Reputation: 123

1Your error message simply means that your status file has been corrupted. You should first remove it, rm /var/lib/dpkg/status, then recreate it, touch /var/lib/dpkg/status, then do an update plus an upgrade. If this does not work, check the permissions and ownership of both status file and its directory tree. – MariusMatutiae – 2016-02-15T10:33:11.790

1And, sorry, I forgot, just make sure there is enough room left free on the disk, you never know.... – MariusMatutiae – 2016-02-15T10:47:58.183

@MariusMatutiae That resolved it. Thanks very much - stick it in an answer and I'll accept it. – mattbd – 2016-02-15T10:50:29.557

Answers

4

Your error message simply means that your status file has been corrupted.

You should first remove it,

rm /var/lib/dpkg/status

then recreate it,

touch /var/lib/dpkg/status

then do an update plus an upgrade.

If this does not work, check the permissions and ownership of both status file and its directory tree, and, possibly, check whether the disk is full, you never know...

MariusMatutiae

Posted 2016-02-15T10:23:54.657

Reputation: 41 321

0

  1. Clear out the local repository of retrieved package files. Open the terminal and type:

    sudo apt-get clean
    
  2. Tell your system to pull down the latest list of software from each archive it knows about.

    sudo apt-get update
    

karel

Posted 2016-02-15T10:23:54.657

Reputation: 11 374

0

Do you have backups? In any case, now start to backup into /root the content of /var/lib/dpkg (you can skip info/, so that you can restore the actual state in case of failed attempt.

Do you have enough disk free on /var? (DDOS tend to fill up /var, filling the logs).

After the above two checks, try to copy the -old files to the same file but without the suffix -old. (If you have backups, just copy these files from backup).

Giacomo Catenazzi

Posted 2016-02-15T10:23:54.657

Reputation: 636