Unable to parse package file /var/lib/dpkg/status (1)

Bug #50766 reported by Tom Haddon
2
Affects Status Importance Assigned to Milestone
APT
Fix Released
Unknown
apt (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: dpkg

Just dist-upgraded.

Get the following message from sudo apt-get update

Reading package lists... Error!
E: Unable to parse package file /var/lib/dpkg/status (1)
E: The package lists or status file could not be parsed or opened.

ls -l /var/lib/dpkg/status
-rw-r--r-- 1 root root 1452667 2006-06-23 10:44 /var/lib/dpkg/status

Revision history for this message
In , Adam Heath (doogie-debian) wrote : Re: Bug#276060: apt: Unable to parse package file /var/lib/dpkg/status (1)

On Mon, 11 Oct 2004, Andre Majorel wrote:

> Package: apt
> Version: 0.5.27
> Severity: normal
>
> Installing a certain package causes apt-get and apt-cache to
> become essentially non-functional.
>
> # apt-cache search x
> E: Unable to parse package file /var/lib/dpkg/status (1)
> # apt-get remove foobar
> Reading Package Lists... Error!
> E: Unable to parse package file /var/lib/dpkg/status (1)
> E: The package lists or status file could not be parsed or opened.
>
> Here is the /var/lib/dpkg/status entry for the package that
> triggers the bug (names mangled as they are irrelevant).

apt only supports paragraph sizes < 32k(or some such number, I forget what it
is).

Revision history for this message
In , Tomas Pospisek (tpo) wrote : just run into the same problem

Interestingly I've just run into the same problem. Aparently the
problematic paragraph size was overrun here by a "Depends:" section that
contains more data than apt-get can handle...
:-/
*t

--
--------------------------------------------------------
   Tomas Pospisek
   http://sourcepole.com - Linux & Open Source Solutions
--------------------------------------------------------

Revision history for this message
In , Helmut Toplitzer (helmut-ifit) wrote : apt problems: Maybe that helps

Hi!

I ran into the same problem on a clean (quite minimal) stable
system. (apt 0.5.4)
Heres what I've done to resolve the problem:

diff /var/lib/dpkg/status-old /var/lib/dpkg/status

to see what has changed during the last working apt-cycle.
Take a note somewhere. (In my case it was the removing of iptables
package which reproducible crashed my apt, even after reinstall
etc.)

cp status-old to status

undo the done by reinstalling the affected packages.

install another package (bzip2 or something else)

remove (bzip2 bzip2libs or sth. else) and iptables.
(the ones that caused the problems)

after that it wos working without problems....

Revision history for this message
In , Matt Zimmerman (mdz) wrote : Re: Bug#276060: apt problems: Maybe that helps

On Wed, Nov 03, 2004 at 08:31:17AM +0100, Helmut Toplitzer wrote:

> I ran into the same problem on a clean (quite minimal) stable
> system. (apt 0.5.4)
> Heres what I've done to resolve the problem:
>
> diff /var/lib/dpkg/status-old /var/lib/dpkg/status
>
> to see what has changed during the last working apt-cycle.
> Take a note somewhere. (In my case it was the removing of iptables
> package which reproducible crashed my apt, even after reinstall
> etc.)
>
> cp status-old to status
>
> undo the done by reinstalling the affected packages.

Can you send a copy of status-old, and the status file before and after the
reinstall?

--
 - mdz

Revision history for this message
In , Guillaume Pernot (gpernot) wrote : apt: fixed pkgTagFile buffer shortage

Package: apt
Version: 0.5.28.6praksys1
Followup-For: Bug #276060

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

xfree86 4.3.0.dfsg.1-12's hits the 32kb/section limitation found in tagfile.h

I was also getting the "Unable to parse package file
/var/lib/dpkg/status (1)" messagez and the following patch solved the
problem.

- -- Package-specific info:

- -- (/etc/apt/preferences present, but not submitted) --

- -- (/etc/apt/sources.list present, but not submitted) --

- -- System Information:
Debian Release: 3.0
Architecture: i386 (i686)
Kernel: Linux 2.4.28-k7
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)

Versions of packages apt depends on:
ii libc6 2.2.5-11.8 GNU C Library: Shared libraries an
ii libgcc1 1:3.0.4-7 GCC support library.
ii libstdc++3 1:3.0.4-7 The GNU stdc++ library version 3

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCQhQAUxjOUmTJDO8RAt8xAJ9BLy5hZ2d3BSQYq5uPiR+Dn2+/NwCfXfmm
R225PE5jrX26MOu4kPqzyLE=
=CdHV
-----END PGP SIGNATURE-----

Revision history for this message
In , Matt Zimmerman (mdz) wrote : Re: Bug#276060: apt: fixed pkgTagFile buffer shortage

On Thu, Mar 24, 2005 at 02:12:32AM +0100, guillaume pernot wrote:

> Package: apt
> Version: 0.5.28.6praksys1
> Followup-For: Bug #276060
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
>
> xfree86 4.3.0.dfsg.1-12's hits the 32kb/section limitation found in tagfile.h
>
> I was also getting the "Unable to parse package file
> /var/lib/dpkg/status (1)" messagez and the following patch solved the
> problem.

That's the current version in unstable; I'd expect to receive many more
reports if this were the case.

Can you send a copy of the relevant stanza in the status file? Which binary
package was affected?

--
 - mdz

Revision history for this message
In , Guillaume Pernot (gpernot) wrote :

yep,

Le Lundi 28 Mars 2005 07:17, Matt Zimmerman a écrit :
> On Thu, Mar 24, 2005 at 02:12:32AM +0100, guillaume pernot wrote:
>
> That's the current version in unstable; I'd expect to receive many more
> reports if this were the case.

ok, it was my home-brewed backports that actually hit the limit.
i am not able to tackle properly this static-size buffer thing :( but i think
this is definitely a bug.

a++

Revision history for this message
Tom Haddon (mthaddon) wrote :

Binary package hint: dpkg

Just dist-upgraded.

Get the following message from sudo apt-get update

Reading package lists... Error!
E: Unable to parse package file /var/lib/dpkg/status (1)
E: The package lists or status file could not be parsed or opened.

ls -l /var/lib/dpkg/status
-rw-r--r-- 1 root root 1452667 2006-06-23 10:44 /var/lib/dpkg/status

Revision history for this message
Tom Haddon (mthaddon) wrote :

Dist-upgraded from breezy i386 to dapper, that is.

Revision history for this message
Tom Haddon (mthaddon) wrote :

I've verified that if I copy the backup (/var/backup/dpkg.status.0) to /var/lib/dpkg/status and then run apt-get update it works fine. This would be doing a dist-upgrade again to get the file synced with what's on the system.

Please advise how to discover what it is in the existing status file that's causing the problem. I suspect it's related to this (http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=276060) but I don't know how to discover which is the offending package.

Revision history for this message
Jim Tarvid (tarvid) wrote :

root@faustus:/var/lib/dpkg# cat scan_status.php
#!/usr/bin/php
<?php
$handle = @fopen("/var/lib/dpkg/status", "r");
if ($handle)
  {
    $sz=0;
    $package='';
    while (!feof($handle))
      {
        $buffer = fgets($handle, 4096);
        if (substr($buffer,0,7)=='Package')
          {
            echo "$sz\t$package\n";
            $sz=strlen($buffer);
            $package=$buffer;
          }
        else {$sz+=strlen($buffer);};
     };
   echo "$sz\t$package\n";

   fclose($handle);
}
?>

then

root@faustus:/var/lib/dpkg# ./scan_status.php |sort -nr | less

my top entry was otrs at 37k bytes

chopping out a few hundred lines of conf files got apt running again

this is a bug in apt

Revision history for this message
Tom Haddon (mthaddon) wrote :

Thanks. It was the otrs package for me as well. Deleted some conf lines and it's all good.

Cheers, Tom

Changed in apt:
status: Unknown → Unconfirmed
Revision history for this message
Michael Vogt (mvo) wrote :

the current version of apt in edgy should not have this limit anymore

Changed in apt:
status: Unconfirmed → Fix Released
Revision history for this message
In , Michael Vogt (mvo) wrote : Fixed with recent apt

This limit should be fixed with apt versions >= 0.6.44
--
Linux is not The Answer. Yes is the answer. Linux is The Question. - Neo

Changed in apt:
status: Unconfirmed → Fix Released
Revision history for this message
In , Patrick Strasser (past) wrote : Workaround for upgrade to >=0.6.44

Hello!

Hit the problem with an "alien"ated package, that had nearly all it's
files marked as configfile.

When you can't use apt/dpkg with the discussed error, find the offending
status section:

# cd /var/lib/dpkg
# diff -u status-old status

Watch for space-intended lines after the "Conffiles:" line.
Look for an string, that matches many of the lines (probably the package
name).

# grep -v "^ /.*<matchstring>" status status.mod
where <matchstring> is the string unique for this package.

# cp status-old status-old.bak
# cp status.mod status
# apt-get remove --purge <offending-package>
# cp status-old.bak status

The last line is for making shure, that no packages where harmed that
grep maybe hit.

Now upgrade apt
# apt-get update
# apt-get install apt

The system should be in an usable and clean state. You can now try to
install your offending package again.

Patrick

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.