[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#401263: apt-get segfaults when building dependency tree



I tested the daily build of the Debian Installer dated 2006-12-04 on
the NSLU2 with TCP window scaling disabled, and apt-get still fails
during the install in the same way as I mentioned earlier in this
thread.

I haven't been able to test the new apt version (0.6.46.3-0.2) that
has been uploaded, because it hadn't been uploaded to the mirrors at
the time, so the installer was not able to download it.

As an experiment, I tried removing the cache files in /var/cache/apt
which has been mentioned as the fix to this problem. With corrupt
/var/cache/apt/*.bin files, apt-get seg faults as before.

sh-3.1# ls -l /var/cache/apt
total 12516
drwxr-xr-x 3 root root   12288 Dec  1 07:25 archives
-rw-r--r-- 1 root root 6424232 Dec  6 04:27 pkgcache.bin
-rw-r--r-- 1 root root 6423706 Dec  6 04:27 srcpkgcache.bin
sh-3.1# gdb apt-get
GNU gdb 6.5-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "arm-linux-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".

(gdb) run -f install
Starting program: /usr/bin/apt-get -f install
Reading package lists... Done
Building dependency tree... 50%
Program received signal SIGSEGV, Segmentation fault.
0x4008b2dc in pkgDepCache::CheckDep (this=0x3fc60, Dep=
     {Dep = 0x409efa4c, Type = pkgCache::DepIterator::DepVer, Owner =
0x3ecb0}, Type=1, Res=@0xbee68040) at depcache.cc:123
123     depcache.cc: No such file or directory.
       in depcache.cc
(gdb) backtrace
#0  0x4008b2dc in pkgDepCache::CheckDep (this=0x3fc60, Dep=
     {Dep = 0x409efa4c, Type = pkgCache::DepIterator::DepVer, Owner =
0x3ecb0}, Type=1, Res=@0xbee68040) at depcache.cc:123
#1  0x40090fb0 in pkgDepCache::CheckDep (this=0x3fc60, Dep=
     {Dep = 0x409efa4c, Type = pkgCache::DepIterator::DepVer, Owner =
0x3ecb0}, Type=1) at ../build/include/apt-pkg/depcache.h:142
#2  0x4008be58 in pkgDepCache::DependencyState (this=0x3fc60, D=@0xbee68098)
   at depcache.cc:360
#3  0x4008f74c in pkgDepCache::Update (this=0x3fc60, Prog=0xbee68350)
   at depcache.cc:431
#4  0x400902b8 in pkgDepCache::Init (this=0x3fc60, Prog=0xbee68350)
   at depcache.cc:91
#5  0x400c9284 in pkgCacheFile::Open (this=0xbee688d8, Progress=@0xbee68350,
   WithLock=true) at cachefile.cc:101
#6  0x0002e39c in CacheFile::Open (this=0xbee688d8, WithLock=true)
   at apt-get.cc:96
#7  0x0002e4e4 in CacheFile::OpenForInstall (this=0xbee688d8) at apt-get.cc:107
#8  0x00023114 in DoInstall (CmdL=@0xbee68e04) at apt-get.cc:1415
#9  0x40072e80 in CommandLine::DispatchArg (this=0xbee68e04, Map=0xbee68d94,
   NoMatch=true) at contrib/cmndline.cc:337
#10 0x00011050 in main (argc=3, argv=0xbee68e84) at apt-get.cc:2606

Removing the cache files (/var/cache/apt/*.bin) causes apt-get to work
again, and the cache file are recreated.

sh-3.1# cp -p /var/cache/apt/*.bin cache-files-broken/
sh-3.1# rm /var/cache/apt/*.bin
sh-3.1# gdb apt-get
GNU gdb 6.5-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "arm-linux-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".

(gdb) run -f install
Starting program: /usr/bin/apt-get -f install
Reading package lists... Done
Building dependency tree... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Program exited normally.
(gdb) quit
sh-3.1# ls -l /var/cache/apt
total 12520
drwxr-xr-x 3 root root   12288 Dec  1 07:25 archives
-rw-r--r-- 1 root root 6423756 Dec  6 05:15 pkgcache.bin
-rw-r--r-- 1 root root 6423706 Dec  6 05:15 srcpkgcache.bin

Note that the size of pkgcache.bin has changed, i.e. there is
difference in size between the corrupted and recreated pkgcache.bin
files.

Then, just to check that it was actually the cache files that were
causing the apt-get to seg fault, I copied the original pkgcache.bin
and srcpkgcache.bin back to /var/cache/apt, and apt-get seg faults as
expected.

sh-3.1# cp -p /var/cache/apt/*.bin cache-files-fixed/
sh-3.1# rm /var/cache/apt/*.bin
sh-3.1# cp -p cache-files-broken/*.bin /var/cache/apt/
sh-3.1# gdb apt-get
GNU gdb 6.5-debian
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "arm-linux-gnu"...Using host libthread_db
library "/lib/libthread_db.so.1".

(gdb) run -f install
Starting program: /usr/bin/apt-get -f install
Reading package lists... Done
Building dependency tree... 50%
Program received signal SIGSEGV, Segmentation fault.
0x4008b2dc in pkgDepCache::CheckDep (this=0x3fc60, Dep=
     {Dep = 0x409efa4c, Type = pkgCache::DepIterator::DepVer, Owner =
0x3ecb0}, Type=1, Res=@0xbef25040) at depcache.cc:123
123     depcache.cc: No such file or directory.
       in depcache.cc
(gdb) backtrace
#0  0x4008b2dc in pkgDepCache::CheckDep (this=0x3fc60, Dep=
     {Dep = 0x409efa4c, Type = pkgCache::DepIterator::DepVer, Owner =
0x3ecb0}, Type=1, Res=@0xbef25040) at depcache.cc:123
#1  0x40090fb0 in pkgDepCache::CheckDep (this=0x3fc60, Dep=
     {Dep = 0x409efa4c, Type = pkgCache::DepIterator::DepVer, Owner =
0x3ecb0}, Type=1) at ../build/include/apt-pkg/depcache.h:142
#2  0x4008be58 in pkgDepCache::DependencyState (this=0x3fc60, D=@0xbef25098)
   at depcache.cc:360
#3  0x4008f74c in pkgDepCache::Update (this=0x3fc60, Prog=0xbef25350)
   at depcache.cc:431
#4  0x400902b8 in pkgDepCache::Init (this=0x3fc60, Prog=0xbef25350)
   at depcache.cc:91
#5  0x400c9284 in pkgCacheFile::Open (this=0xbef258d8, Progress=@0xbef25350,
   WithLock=true) at cachefile.cc:101
#6  0x0002e39c in CacheFile::Open (this=0xbef258d8, WithLock=true)
   at apt-get.cc:96
#7  0x0002e4e4 in CacheFile::OpenForInstall (this=0xbef258d8) at apt-get.cc:107
#8  0x00023114 in DoInstall (CmdL=@0xbef25e04) at apt-get.cc:1415
#9  0x40072e80 in CommandLine::DispatchArg (this=0xbef25e04, Map=0xbef25d94,
   NoMatch=true) at contrib/cmndline.cc:337
#10 0x00011050 in main (argc=3, argv=0xbef25e84) at apt-get.cc:2606
(gdb)

The offending lines in depcache.cc is

       if (Type == InstallVersion && PkgState[Pkg->ID].InstallVer != 0)

This is in apt version

sh-3.1# apt-get -V
apt 0.6.46.3 for linux arm compiled on Nov 30 2006 23:11:20

which, as I mentioned before, I recompiled with debugging information.
The debugging information does not make a difference to the behaviour
of apt-get.

Now, why does apt-get create corrupt cache files the first time it is
run ? This seems to be the heart of the problem. I have copies of both
the corrupt and recreated cache files that I can send to somebody for
analysis.

For reference, there is a thread about this problem in debian-boot [1]
since it causes the installer to fail on the Linksys NSLU2.

Gordon

[1] http://lists.debian.org/debian-boot/2006/11/msg01207.html

--
Gordon Farquharson



Reply to: