Package: apt
Version: 0.6.46.3-0.2
Severity: grave

I had been posting to
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=401263 but it has
become clear from the patch posted yesterday that that bug is a
separate issue to the one I am seeing with the Debian Installer. Most
of the information in this bug report was previously posted to
#401263.

apt seems to be creating corrupt package cache files
(/var/cache/dpkg/*.bin) when it is first installed during installation
of Debian with the Debian Installer on an Linksys NSLU2 (arm). Below
are the last messages recorded in /var/log/syslog before the installer
stops.

Dec  6 03:27:45 base-installer: info: Found kernels
'linux-image-ixp4xx,linux-image-2.6.17-2-ixp4xx,linux-image-2.6-ixp4xx'
Dec  6 03:27:45 base-installer: info: arch_kernel candidates:
linux-image-2.6-ixp4xx
Dec  6 03:27:45 base-installer: info: arch_kernel:
linux-image-2.6-ixp4xx (present)
Dec  6 03:27:45 base-installer: info: Using kernel 'linux-image-2.6-ixp4xx'
Dec  6 03:27:45 base-installer: info: Setting do_initrd='yes'.
Dec  6 03:27:45 base-installer: info: Setting link_in_boot='yes'.
Dec  6 03:27:46 base-installer: info: Available initramfs
generator(s): 'initramfs-tools yaird'
Dec  6 03:27:47 apt-install: Reading package lists...
Dec  6 03:27:47 apt-install:
Dec  6 03:27:47 apt-install: Building dependency tree...
Dec  6 03:27:49 base-installer: error: exiting on error
base-installer/kernel/failed-package-install

Running 'apt-get -f install' manually shows that apt-get segfaults
while building the dependency tree.

~ # chroot /target/
sh-3.1# mount -t proc none /proc
sh-3.1# apt-get -f install
Reading package lists... Done
Segmentation faulty tree... 50%

A search of existing bugs filed against apt turned up
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=81829 and all of its
reincarnations. Historically, problem has been blamed on faulty lower
level functionality (kernel, filesystem, networking, hardware), but
two different people started seeing it at around the the same time
with Installer daily builds, so I doubt that it can be hardware. This
leaves kernel, filesystem, and networking issues.

I tried disabling TCP window scaling which can cause networking
issues, but apt-get still failed during the install in the same way.
I'm not sure how to test for filesystem or kernel problems.

I then started investigating whether this problem was due to corrupt
cache files in /var/cache/apt which has been mentioned as a cause to
#81829. With the original /var/cache/apt/*.bin files created when apt
is installed, apt-get seg faults.

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, [EMAIL PROTECTED]) 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, [EMAIL PROTECTED]) 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, [EMAIL PROTECTED])
   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, [EMAIL PROTECTED],
   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 ([EMAIL PROTECTED]) 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
start working, and when apt-get is run, 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 original 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 segfaults as
before.

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, [EMAIL PROTECTED]) 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, [EMAIL PROTECTED]) 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, [EMAIL PROTECTED])
   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, [EMAIL PROTECTED],
   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 ([EMAIL PROTECTED]) 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

So it is obviously the cache files that are created initially that are
causing the problem. But why does apt-get create corrupt cache files
during the installation process ? 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 if need be.

The only seemingly obvious problem that I have found so far that
Pkg.CurrentVer().VerStr() returns a pointer to a location that is not
addressable.

(gdb) directory
/root/apt-0.6.46.3/apt-pkg:/root/apt-0.6.46.3/apt-pkg/contrib:/root/apt-0.6.46.3/apt-pkg/deb:/root/apt-0.6.46.3/apt-inst:/root/apt-0.6.46.3/apt-inst/deb:/root/apt-0.6.46.3/cmdline
Source directories searched:
/root/apt-0.6.46.3/apt-pkg:/root/apt-0.6.46.3/apt-pkg/contrib:/root/apt-0.6.46.3/apt-pkg/deb:/root/apt-0.6.46.3/apt-inst:/root/apt-0.6.46.3/apt-inst/deb:/root/apt-0.6.46.3/cmdline:$cdir:$cwd
(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.
0x4008b310 in pkgDepCache::CheckDep (this=0x3fc60, Dep=
     {Dep = 0x409efa4c, Type = pkgCache::DepIterator::DepVer, Owner =
0x3ecb0}, Type=1, [EMAIL PROTECTED]) at depcache.cc:123
123                                      Dep.TargetVer()) == true)
(gdb) list 123
118        {
119           PkgIterator Pkg = Dep.TargetPkg();
120           // Check the base package
121           if (Type == NowVersion && Pkg->CurrentVer != 0)
122              if (VS().CheckDep(Pkg.CurrentVer().VerStr(),Dep->CompareOp,
123                                      Dep.TargetVer()) == true)
124                 return true;
125
126           if (Type == InstallVersion && PkgState[Pkg->ID].InstallVer != 0)
127              if
(VS().CheckDep(PkgState[Pkg->ID].InstVerIter(*this).VerStr(),
(gdb) print Pkg.CurrentVer().VerStr()
$1 = 0xd5323001 <Address 0xd5323001 out of bounds>

Any suggestions for things to try ?

Other information:

I am using Debian GNU/Linux 4.0, kernel 2.6.18-3-ixp4xx.

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


--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to