apt-get crashes with a segmentation fault

Bug #1117682 reported by msp3k
24
This bug affects 4 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

When trying to --reinstall multiple packages with apt-get, it crashes with a segmentation fault. The command line: apt-get --reinstall install <2-or-more-packages...>

Syslog shows:
kernel: [ 3322.059837] apt-get[14417]: segfault at 7fa5c24d65bc ip 00007fa5bb931329 sp 00007fffb0170528 error 4 in libapt-pkg.so.4.12.0[7fa5bb8e1000+121000]

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: apt 0.8.16~exp12ubuntu10.7
ProcVersionSignature: Ubuntu 3.2.0-37.58-generic 3.2.35
Uname: Linux 3.2.0-37-generic x86_64
ApportVersion: 2.0.1-0ubuntu17.1
Architecture: amd64
Date: Wed Feb 6 15:39:44 2013
InstallationMedia: Ubuntu-Server 12.04 LTS "Precise Pangolin" - Release amd64 (20120424.1)
MarkForUpload: True
ProcEnviron:
 TERM=xterm
 SHELL=/bin/bash
 PATH=(custom, no user)
 LANG=en_US.UTF-8
 LANGUAGE=en_US:
SourcePackage: apt
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
msp3k (peek-nimbios) wrote :
Revision history for this message
Daniel Hartwig (wigs) wrote : Re: [Bug 1117682] [NEW] apt-get crashes with a segmentation fault

On 7 February 2013 04:45, msp3k <email address hidden> wrote:
> When trying to --reinstall multiple packages with apt-get, it crashes
> with a segmentation fault. The command line: apt-get --reinstall
> install <2-or-more-packages...>

Provide a stacktrace and the complete output from the command,
including the full command line.

Have you tried using more than one set of packages, or has this only
failed while trying to install particular packages?

 status incomplete

Changed in apt (Ubuntu):
status: New → Incomplete
Revision history for this message
Leigh Simpson (simpleigh) wrote :
Download full text (3.1 KiB)

Hi there, I can reproduce similar symptoms here and reproduce as follows:
 1. Take a clean CD install of Ubuntu 12.0.2, and install in a VM.
 2. Update and upgrade to the latest versions of all packages
 3. Run the following:
dpkg --list | grep ^ii | awk '{ print($2) }' | xargs apt-get install --reinstall

What happens:
332 packages are downloaded as expected. xargs then fails with the message "xargs: apt-get: terminated by signal 11". Here's the tail of the output:

Get:330 http://gb.archive.ubuntu.com/ubuntu/ precise-updates/main wpasupplicant amd64 0.7.3-6ubuntu2.1 [490 kB]
Get:331 http://gb.archive.ubuntu.com/ubuntu/ precise/main libiw30 amd64 30~pre9-5ubuntu2 [20.3 kB]
Get:332 http://gb.archive.ubuntu.com/ubuntu/ precise/main python-zope.interface amd64 3.6.1-1ubuntu3 [114 kB]
Fetched 110 MB in 1min 13s (1,495 kB/s)
xargs: apt-get: terminated by signal 11

The same problem occurs when calling apt manually:

# apt-get install --reinstall accountsservice acpid [...] xz-utils zlib1g
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 398 reinstalled, 0 to remove and 0 not upgraded.
Need to get 0 B/212 MB of archives.
After this operation, 0 B of additional disk space will be used.
Segmentation fault (core dumped)

I think I was able to work around by reinstalling packages ten at a time using xargs -L 10 (it ran to completion, although I didn't check the entire output). This implies the problem is caused by the sheer number of packages rather than any particular packages.

I ran things again under gdb and got the following:
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7b03329 in pkgCache::DepIterator::IsIgnorable(pkgCache::PkgIterator const&) const () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12
(gdb) where
#0 0x00007ffff7b03329 in pkgCache::DepIterator::IsIgnorable(pkgCache::PkgIterator const&) const () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12
#1 0x00007ffff7b0355d in pkgCache::DepIterator::AllTargets() const () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12
#2 0x00007ffff7b1cc85 in pkgPackageManager::SmartUnPack(pkgCache::PkgIterator, bool, int) () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12
#3 0x00007ffff7b21add in pkgPackageManager::OrderInstall() () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12
#4 0x00007ffff7b21ff8 in pkgPackageManager::DoInstall(int) () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12
#5 0x000000000041354f in ?? ()
#6 0x000000000041e1a4 in ?? ()
#7 0x00007ffff7af2263 in CommandLine::DispatchArg(CommandLine::Dispatch*, bool) () from /usr/lib/x86_64-linux-gnu/libapt-pkg.so.4.12
#8 0x0000000000409ad4 in ?? ()
#9 0x00007ffff71ff76d in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#10 0x0000000000409df1 in ?? ()
#11 0x00007fffffffc778 in ?? ()
#12 0x000000000000001c in ?? ()
#13 0x0000000000000191 in ?? ()
#14 0x00007fffffffd625 in ?? ()
#15 0x00007fffffffd636 in ?? ()
[... 400 more entries pointing at random addresses]

This probably isn't terribly helpful. Is there a package containing debugging symbols for apt?

I've persuaded apport to produce the attached which provides a little more...

Read more...

Changed in apt (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Georg Seewald (schorse) wrote :

When I try to use the command I get the following error:

root@h2094244:~# apt-get dist-upgrade
Segmentation fault gelesen... 98%

Also with aptitude

root@h2094244:~# aptitude dist-upgrade
[100%] Paketlisten werden gelesenSegmentation fault

I user strace to check what happend:

These are the last lines of the outpunt

29724 open("/var/lib/apt/lists/de.archive.ubuntu.com_ubuntu_dists_precise-security_Release", O_RDONLY|O_LARGEFILE) = 6
29724 fcntl64(6, F_SETFD, FD_CLOEXEC) = 0
29724 dup(6) = 7
29724 fcntl64(7, F_GETFL) = 0x8000 (flags O_RDONLY|O_LARGEFILE)
29724 fstat64(7, {st_mode=S_IFREG|0644, st_size=49575, ...}) = 0
29724 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb53f7000
29724 _llseek(7, 0, [0], SEEK_CUR) = 0
29724 read(7, "Origin: Ubuntu\nLabel: Ubuntu\nSui"..., 4096) = 4096
29724 _llseek(4, 26214399, [26214399], SEEK_SET) = 0
29724 write(4, "\0", 1) = 1
29724 mremap(0xb53f8000, 25165824, 26214400, MREMAP_MAYMOVE) = 0xb3af7000
29724 --- SIGSEGV (Segmentation fault) @ 0 (0) ---
29724 +++ killed by SIGSEGV +++
root@h2094244:~#

I'm currently running the following version:

root@h2094244:~# uname -a
Linux h2094244.stratoserver.net 2.6.32-042stab076.8 #1 SMP Tue May 14 20:38:14 MSK 2013 i686 athlon i386 GNU/Linux

root@h2094244:/etc# cat lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.04
DISTRIB_CODENAME=precise
DISTRIB_DESCRIPTION="Ubuntu 12.04.2 LTS

My problem is that I do not know how I can apply a patch for apt-get without apt-get?

Revision history for this message
Ken Sharp (kennybobs) wrote :

Does setting the following help?
APT::Cache-start 200000000;
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1445436/comments/3

Revision history for this message
Julian Andres Klode (juliank) wrote :

Thanks for your bug report. This might be a broken cache and/or a problem fixed in the meantime. If you can still reproduce it in wily, please re-open.

Changed in apt (Ubuntu):
status: Confirmed → Invalid
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.