Broken apt-get

I'm having a problem with my debian-based linode. It seems that my /var/lib/dpkg/status file has become too big for apt-get/apt-cache.

When I try to apt-get update or apt-get install anything, I get the following error:

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.

Sure I can revert to a backup status file (like the ones in /var/backups), but the problem will re-surface. The problem is that the /var/lib/dpkg/status file isn't corrupted, it's just too big for apt-cache!

For instance: if I remove (manually) some text from /var/lib/dpkg/status (to bring it down a few kB), it will allow me to install a new package. However after that the problem will resurface. Similarly, if I delete some text from the status file and run apt-cache, it works fine, but when the status file get just a little bit bigger, I get the following:

# apt-cache stats
Segmentation fault

So it seems that apt-cache is dying when my status file gets over a certain size.

I have the 32MB Linnode – not large, but I have more than enough swap memory. What can I do about this? /var/lib/dpkg/status is not that big:

# wc -l status
   3404 status

Does anybody know what I can do to get apt-get/apt-cache to stop crashing on my >3,400-line status file?

7 Replies

Hi,

Just to be picky, last time I check there was no Linode 32 on the products page.

But anyway my status file is 3945 lines long and I do not have a problem downloading stuff with apt-get.

So it appears that it could be another problem.

Have you tried to reboot your linode after you get the apt-get error just to ensure that it is not been locked by anything.

Adam

@jslaughter:

I have the 32MB Linnode – not large, but I have more than enough swap memory.

The other folks here are smart enough to ask the insightful questions…leaving me to ask the "is it plugged in" questions…

How big is your swap? Are you using the stock /etc/apt/sources.list or have you added a bunch of mirrors?

I'm using Debian on a Linode 64, and have no problems, at least of the kind you're describing.

Known problem with woody apt. Try adding a line like

APT::Cache-Limit "241943904";

to your /etc/apt/apt.conf (creating the file if necessary).

> Just to be picky, last time I check there was no Linode 32 on the products page.

That's because I came to Linode from GlobalRAID.net. Linode took all of GlobalRAID's customers when they closed shop and GlobalRAID did have a 32MB virtual server.

> Known problem with woody apt. Try adding a line like

Unfortunately that didn't do it. I have searched the 'net and found that this option is sometimes added to /etc/apt/apt.conf.d/70debconf as well, but putting the "APT::Cache-Limit" line in either or both of /etc/apt/apt.conf or /etc/apt/apt.conf/d/70debconf does not work. I'm still getting (for exampe):

# apt-get upgrade
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.

and apt-cache is still segfaulting. Of course if I bring the status file down a few K it works fine until it grows too big again.

> How big is your swap? Are you using the stock /etc/apt/sources.list or have you added a bunch of mirrors?

I was running with some mirrors in there, but it doesn't seem to help if I revert back to the defaults. I'm running with the defaults now. My swap is 256MB. See below:

# cat /proc/meminfo
        total:    used:    free:  shared: buffers:  cached:
Mem:  27889664 27086848   802816        0  1937408 20221952
Swap: 269475840 46616576 222859264
MemTotal:        27236 kB
MemFree:           784 kB
MemShared:           0 kB
Buffers:          1892 kB
Cached:           8292 kB
SwapCached:      11456 kB
Active:           3520 kB
Inactive:        18224 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:        27236 kB
LowFree:           784 kB
SwapTotal:      263160 kB
SwapFree:       217636 kB

sigh. I looks like there may not be a good solution to this. It could be related to memory (32 MB of real RAM is not a lot) but I'm hesitant to upgrade as the 32MB Linode price I have carried over from GlobalRAID is a great deal. I guess it's time to head over to the Debian developer's list and fight the barrage of RTFM!! mail responses. If only the debian lists could be as friendly as the Gentoo forum! :) But there's no way Gentoo would work on a 32MB box–it would take 9 years to compile libc6.

Thanks for your help guys! If anybody else has any suggestions I would love to hear them!

Hmmm. You might try running 'strace -o strace.out apt-cache whatever' to see what the last system call iswhere it's segfaulting. If you're running out of memory, it shouldn't segfault…if it does, it's a bug. Hmmm, instead of debian-devel, you might try debian-deity…Jason Gunthorpe can be impatient, but you won't get all the random hangers' on.

Oh, and you might try running 'vmstat 1' in one session while running

the apt-* commands in the other. to see if the VM is under pressure.

[Edit: had once again confused dpkg maintainer with apt maintainer]

just for reference, i'm using debian on a laptop with 16M ram, and it runs fine with a 25246 line status file (486 DX/4, if you must know)

I've noticed lots of things segfaulting with 2.4.23 – not sure if this is UML related or straight 2.4.23's fault. I do know that they removed the OOM killer, and has something to do with page_alloc messages appearing in console.

It might be worth rebooting into the latest 2.4.23-linode18-7um kernel and giving that a try.

-Chris

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct