Apt crashes with SIGSEGV in pkgCache::FindPkg() on corrupted pkgcache.bin

Bug #119707 reported by Gioele Barabucci
702
This bug affects 263 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
High
Unassigned
aptitude (Ubuntu)
Invalid
Undecided
Unassigned
synaptic (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Apt, aptitude and synaptic crash soon after accessing /var/lib/dpkg/status. Here is the strace output from apt-get install foo

stat("/var/lib/dpkg/status", {st_mode=S_IFREG|0644, st_size=1528590, ...}) = 0
msync(0x2aefaadb5000, 8704, MS_SYNC) = 0
stat("/var/lib/dpkg/status", {st_mode=S_IFREG|0644, st_size=1528590, ...}) = 0
open("/var/lib/dpkg/status", O_RDONLY) = 7
fcntl(7, F_SETFD, FD_CLOEXEC) = 0
read(7, "Package: python-bittorrent\nStatu"..., 32768) = 32768
) = 29g package lists... 0% lists... 0%\r", 29
stat("/var/lib/dpkg/status", {st_mode=S_IFREG|0644, st_size=1528590, ...}) = 0
fstat(7, {st_mode=S_IFREG|0644, st_size=1528590, ...}) = 0
--- SIGSEGV (Segmentation fault) @ 0 (0) ---
+++ killed by SIGSEGV +++

Revision history for this message
Gioele Barabucci (gioele) wrote :
Revision history for this message
Soul-Sing (soulzing) wrote :

apt and synaptic problems often occur after installing: googleearth, sun java, etc, programs which needs a license-agreement.
not signing these programs results in broken packages and apt/synaptic problems.
/var/lib/dpkg/info shows the broken packages.

Revision history for this message
Gioele Barabucci (gioele) wrote :

I haven't installed anything in the last days except gnome-bluetooth. At the same time I updated my system to the last version of linux-image available for feisty in the official repo.

dpkg -C shows no broken packages.

Revision history for this message
Soul-Sing (soulzing) wrote :

and: sudo dpkg --configure -a && sudo apt-get -f install

Revision history for this message
Soul-Sing (soulzing) wrote :

the earlier image is working correct?

Revision history for this message
Gioele Barabucci (gioele) wrote :

dpkg --configure -a shows nothing.
apt-get -f install ... crashes with the same SIGSEGV that I already reported.

Revision history for this message
Gioele Barabucci (gioele) wrote :

Same crash with the old linux 2.6.20-15-generic

Revision history for this message
Gioele Barabucci (gioele) wrote :

Backtrace from gdb

Reading package lists... 0%
Program received signal SIGSEGV, Segmentation fault.
0x00002ab0a8e22b24 in pkgCache::FindPkg ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
(gdb) bt
#0 0x00002ab0a8e22b24 in pkgCache::FindPkg ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#1 0x00002ab0a8e4e9b8 in pkgCacheGenerator::NewPackage ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#2 0x00002ab0a8e4f920 in pkgCacheGenerator::MergeList ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#3 0x00002ab0a8e817c4 in debStatusIndex::Merge ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#4 0x00002ab0a8e50a1b in ?? () from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#5 0x00002ab0a8e523f5 in pkgMakeStatusCache ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#6 0x00002ab0a8e48de9 in pkgCacheFile::BuildCaches ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#7 0x00002ab0a8e48f06 in pkgCacheFile::Open ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#8 0x00000000004176a6 in ?? ()
#9 0x00002ab0a8e17fda in CommandLine::DispatchArg ()
   from /usr/lib/libapt-pkg-libc6.4-6.so.3.53
#10 0x0000000000407fcb in ?? ()
#11 0x00002ab0a98608e4 in __libc_start_main () from /lib/libc.so.6
#12 0x0000000000406119 in ?? ()
#13 0x00007fff01ee64b8 in ?? ()
#14 0x0000000000000000 in ?? ()

Revision history for this message
Gioele Barabucci (gioele) wrote : Re: Apt crashes with SIGSEGV in pkgCache::FindPkg()

Workaround:

$ sudo rm /var/cache/apt/*.bin

Revision history for this message
Sebastien Bacher (seb128) wrote :

bug #286267 seems to be a similar crash and has a debug stacktrace

Revision history for this message
xteejx (xteejx) wrote :

Thank you for taking the time to report this bug and helping to make Ubuntu better. You reported this bug a while ago and there hasn't been any activity in it recently. We were wondering if this is still an issue for you. Can you try with the latest Ubuntu release? Thanks in advance.

Changed in synaptic (Ubuntu):
status: New → Incomplete
Changed in aptitude (Ubuntu):
status: New → Incomplete
Changed in apt (Ubuntu):
status: New → Incomplete
Revision history for this message
bi-abba (l-epa-m-inonda) wrote :

Affected again, after last update:

$ uname -a
Linux Kubuntu904 2.6.28-14-generic #46-Ubuntu SMP Wed Jul 8 07:21:34 UTC 2009 i686 GNU/Linux

How You can see, after upgrade from 2.6.28-11 to 2.6.28-14 kernel release it comes back!

Same description of "Gioele Barabucci"...

Revision history for this message
bi-abba (l-epa-m-inonda) wrote :

And, after all day trouble, check dpkg -C, etc., rm /var/cache/apt/*.bin and the content of related subfolders, plus a reboot, the service has restarted itself!
Really strange...

Revision history for this message
bi-abba (l-epa-m-inonda) wrote :

But sometimes happen this message (also if updates finish correctly!).

Changed in apt (Ubuntu):
status: Incomplete → Invalid
status: Invalid → Confirmed
Changed in aptitude (Ubuntu):
status: Incomplete → Invalid
Changed in synaptic (Ubuntu):
status: Incomplete → Invalid
Changed in apt (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Jonathan Thomas (echidnaman) wrote :

I'm wondering if all the new dupes aren't caused by ext4 being a bit more prone to corruption. It's a theory, anyway.

Changed in apt (Ubuntu):
importance: Medium → High
Revision history for this message
Felix_55 (lccflc) wrote : Re: [Bug 119707] Re: Apt crashes with SIGSEGV in pkgCache::FindPkg() on corrupted pkgcache.bin

Jonathan Thomas ha scritto:
> I'm wondering if all the new dupes aren't caused by ext4 being a bit
> more prone to corruption. It's a theory, anyway.
>
> ** Changed in: apt (Ubuntu)
> Importance: Medium => High

It's possible... I have very little experience on... I have our bug
reports only to be useful to the community, but are very ignorant.
Regards,
Felice Liccardi

Revision history for this message
Felix_55 (lccflc) wrote :

Jonathan Thomas ha scritto:
> I'm wondering if all the new dupes aren't caused by ext4 being a bit
> more prone to corruption. It's a theory, anyway.
>
> ** Changed in: apt (Ubuntu)
> Importance: Medium => High

It's possible... I have very little experience on... I have our bug
reports only to be useful to the community, but are very ignorant.
Regards,
Felice Liccardi

Revision history for this message
Gioele Barabucci (gioele) wrote :

Basically the problem here is that apt and aptitude cannot deal with malformed cached files.

In my case these cached files have become corrupted because I had a power failure while updating my system. Probably the ext3 file system did not restore everything correctly.

Could the next person that find this bug report attach the corrupted *.bin files before removing them?

Revision history for this message
Felix_55 (lccflc) wrote :

Gioele Barabucci ha scritto:
> Basically the problem here is that apt and aptitude cannot deal with
> malformed cached files.
>
> In my case these cached files have become corrupted because I had a
> power failure while updating my system. Probably the ext3 file system
> did not restore everything correctly.
>
> Could the next person that find this bug report attach the corrupted
> *.bin files before removing them?

Certainly, I'll be more careful and just had to recheck the situation, I
shall be pleased to report also indicted files.
Thanks for your kind attention,
Felice Liccardi

Changed in aptitude (Ubuntu):
status: Invalid → Confirmed
Changed in synaptic (Ubuntu):
status: Invalid → Confirmed
Changed in apt (Ubuntu):
assignee: nobody → Benjamin (mastermindbird)
Changed in aptitude (Ubuntu):
assignee: nobody → Benjamin (mastermindbird)
Changed in synaptic (Ubuntu):
assignee: nobody → Benjamin (mastermindbird)
Revision history for this message
xteejx (xteejx) wrote :

Benjamin, are you working on this, as I don't see you as a member of any teams. You should only set yourself if you are a developer working on this.

Changed in aptitude (Ubuntu):
assignee: Benjamin (mastermindbird) → nobody
Changed in apt (Ubuntu):
assignee: Benjamin (mastermindbird) → nobody
Changed in synaptic (Ubuntu):
assignee: Benjamin (mastermindbird) → nobody
Revision history for this message
Benjamin (mastermindbird) wrote : Re: [Bug 119707] Re: Apt crashes with SIGSEGV in pkgCache::FindPkg() on corrupted pkgcache.bin

Good evening,

No, I'm just a user of "Ubuntu Linux 9.10", and I had several bugs on my
current version, so I sent reports so you can repair them. And I thought he
was giving his identity to send the various bug reports.

Bonsoir,

Non, je suis un simple utilisateur de "Ubuntu Linux 9.10", et j'ai eu
plusieurs bugs sur ma version actuelle, j'ai donc envoyé des rapports afin
que vous puissiez les réparer. Et je pensais qu'il fallait donner son
identité pour envoyer les différents rapports de Bug.

2009/11/3 Teej <email address hidden>

> Benjamin, are you working on this, as I don't see you as a member of any
> teams. You should only set yourself if you are a developer working on
> this.
>
> ** Changed in: aptitude (Ubuntu)
> Assignee: Benjamin (mastermindbird) => (unassigned)
>
> ** Changed in: apt (Ubuntu)
> Assignee: Benjamin (mastermindbird) => (unassigned)
>
> ** Changed in: synaptic (Ubuntu)
> Assignee: Benjamin (mastermindbird) => (unassigned)
>
> --
> Apt crashes with SIGSEGV in pkgCache::FindPkg() on corrupted pkgcache.bin
> https://bugs.launchpad.net/bugs/119707
> You received this bug notification because you are a bug assignee.
>
> Status in “apt” package in Ubuntu: Confirmed
> Status in “aptitude” package in Ubuntu: Confirmed
> Status in “synaptic” package in Ubuntu: Confirmed
>
> Bug description:
> Apt, aptitude and synaptic crash soon after accessing /var/lib/dpkg/status.
> Here is the strace output from apt-get install foo
>
> stat("/var/lib/dpkg/status", {st_mode=S_IFREG|0644, st_size=1528590, ...})
> = 0
> msync(0x2aefaadb5000, 8704, MS_SYNC) = 0
> stat("/var/lib/dpkg/status", {st_mode=S_IFREG|0644, st_size=1528590, ...})
> = 0
> open("/var/lib/dpkg/status", O_RDONLY) = 7
> fcntl(7, F_SETFD, FD_CLOEXEC) = 0
> read(7, "Package: python-bittorrent\nStatu"..., 32768) = 32768
> ) = 29g package lists... 0% lists... 0%\r", 29
> stat("/var/lib/dpkg/status", {st_mode=S_IFREG|0644, st_size=1528590, ...})
> = 0
> fstat(7, {st_mode=S_IFREG|0644, st_size=1528590, ...}) = 0
> --- SIGSEGV (Segmentation fault) @ 0 (0) ---
> +++ killed by SIGSEGV +++
>

Revision history for this message
jpfle (jpfle) wrote :

Jonathan Thomas wrote:
>I'm wondering if all the new dupes aren't caused by ext4 being a bit more prone to corruption. It's a theory, anyway.

Personally, I'm using ext4.

Revision history for this message
xteejx (xteejx) wrote :

There should be more than enough information here, and with the apport crashes in the duplicates for a developer to begin working on this bug, so I am marking this Triaged and will let them handle it from here. Thanks again everyone for reporting this to us.

tags: added: metabug
Changed in apt (Ubuntu):
status: Confirmed → Triaged
xteejx (xteejx)
tags: added: karmic
Revision history for this message
Phill Whiteside (phillw) wrote :

Also in Lucid as of today ...

Phill.

Revision history for this message
Gioele Barabucci (gioele) wrote :

Phill, could you please attach your /var/cache/apt/{pkgcache,srcpkgcache}.bin files before deleting them?

Revision history for this message
Phill Whiteside (phillw) wrote :

Your wish is my command :-)

Revision history for this message
Phill Whiteside (phillw) wrote :

and the other one ...

xteejx (xteejx)
tags: added: lucid
Revision history for this message
Jonathan Thomas (echidnaman) wrote :

This is a problem with apt, not its frontends.

Changed in aptitude (Ubuntu):
status: Confirmed → Invalid
Changed in synaptic (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Julian Andres Klode (juliank) wrote :

APT cannot check every single bit of the cache file for correctness, this would defeat the purpose of the cache. There are some checks for this, but it fails to notice every single possible error (no such check exists).

Changed in apt (Ubuntu):
status: Triaged → Invalid
Revision history for this message
tdn (spam-thomasdamgaard) wrote :

If the cause of the crash is an invalid cache file, then this is still a valid bug. Maybe it should just be fixed elsewhere. I see two possible places:
1: The root cause is that the cache file has become corrupt -- so whatever made it corrupt should be fixed.
2: There should be some functionality (either manually or automatically) to clear the cache so that the crash does not occur. Appearently there were no way for the user to clear the cache and thus stop apt from crashing. apt-get clean did not do the trick.

Revision history for this message
BugsBuggy (bugsbuggy) wrote : Re: hello!!

<p>Start your own profitable import business from home<br><a href="http://mayasdressage.com/alternativedesk/waynewright38/">http://mayasdressage.com/alternativedesk/waynewright38/</a></p>

To post a comment you must log in.