I write tests for my company's application. One of these tests tries to upgrade the application from a previous version to a new version to make sure nothing breaks. When I am installing an old version of the application, some weird stuff starts to happen.

Sometimes everything goes Okay, and nothing is wrong, other times when trying to install I get this message (company app name censored):

E: Encountered a section with no Package: header
E: Problem with MergeList /var/lib/apt/lists/XXX-amd64_Packages
E: The package lists or status file could not be parsed or opened.

Using the solutions provided in the questions similar to this one (like this). Do not help, and the problem keeps repeating itself once it happens the first time.

This has led me to believe something is wrong on the apt server where the package is being created, but searching these errors yields no information on anything beyond the "fix" suggested in the question I linked, the only other source of information I could find also did not help (here):

So I am asking for information;

Edit: Thanks to this great answer by Florian Diesch I was able to solve my problem. By tracing back the reason to being an actual malformation in the package, I then started trying to find out why it was malformed. The reason was that as part of our vigorous testing, I was doing many simultaneous operations, and it seems the file was being written into twice which was causing it sometimes to have bad sections.

  • 1
    I have absolutely no idea what you are asking, but you have taken care to write and document your question well. +1
    – don.joey
    Oct 29 '13 at 16:28
  • 1
    I retitled the question to make it more obvious that it's not a duplicate. Oct 29 '13 at 19:51

The file /var/lib/apt/lists/XXX-amd64_Packages contains different sections separated by blank lines. Each sections consist of multiple fields that look like


If VALUE contains more than one line each line has to start with a whitespace character.

For example (I removed some lines here):

Package: rapid-photo-downloader
Priority: optional
Section: graphics
Description: Photo and video importer from cameras, memory cards and other devices
 Rapid Photo Downloader is written by a photographer for professional and
 amateur photographers. It can  download photos and videos from multiple
 cameras, memory cards and Portable Storage Devices simultaneously. It
 provides many flexible, user-defined options for subfolder creation,
 photo and video renaming, and backup.
Python-Version: 2.7

Each section describes a package and needs to have a Package: field that contains the package name.

You get this error because one of those sections doesn't have a Package: field.

Find this invalid section and try to find out why the field is missing:

  • Check the corresponding Packages.gz or Packages.bz2 file on your server
  • Check the debian/control file in the corresponding .deb package and its source

My first guess would be a Description: field in debian/control containing a blank line.

  • I checked the file in question, each section has a Package filed. But one section has a strange format, which includes a double blank line. Maybe this is being read as a new section and causing the problem. - Regardless, I can not find the debian/control file on the apt server. Nor can I find Packages.gz/bz2 files either. :S - Checking into possible fix for this strange section format.
    – Inbar Rose
    Oct 29 '13 at 16:24
  • Okay, thanks to you, the problem has been solved. It was not exactly this problem, I will add an explanation to my question - but you deserve the accept.
    – Inbar Rose
    Oct 29 '13 at 16:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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