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

Bug#1030627: debootstrap: Causes dpkg segfault in "chroot /… dpkg --force-depends --install /var/cache/apt/archives/base-passwd_3.5.26_amd64.deb" when trying to bootstrap Wheezy or earlier



Package: debootstrap
Version: 1.0.128+nmu2
Severity: normal
Control: affects -1 xen-tools

Running "debootstrap --verbose --arch amd64
--keyring=/usr/share/keyrings/debian-archive-removed-keys.gpg wheezy
/tmp/hH11H2NR4o http://archive.debian.org/debian"; (or Debian or Ubuntu
releases older than that) on Sid/Bookworm ends up like this:

[…]
I: Extracting tar...
I: Extracting tzdata...
I: Extracting util-linux...
I: Extracting xz-utils...
I: Extracting zlib1g...
I: Installing core packages...
W: Failure trying to run: chroot "/tmp/hH11H2NR4o" dpkg --force-depends --install /var/cache/apt/archives/base-passwd_3.5.26_amd64.deb
W: See /tmp/hH11H2NR4o/debootstrap/debootstrap.log for details

Looking into /tmp/hH11H2NR4o/debootstrap/debootstrap.log I find this
dpkg segfault at the end:

[…]
2023-02-05 21:13:42 (1.72 MB/s) - '/tmp/hH11H2NR4o//var/cache/apt/archives/partial/zlib1g_1%3a1.2.7.dfsg-13_amd64.deb' saved [87392/87392]

dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
 missing description
dpkg: warning: parsing file '/var/lib/dpkg/status' near line 5 package 'dpkg':
 missing architecture
Segmentation fault (core dumped)

The segfault seems to have beein in the dpkg inside the chroot, not in
debootstrap:

[1395173.551147] dpkg[17643] vsyscall attempted with vsyscall=none ip:ffffffffff600400 cs:33 sp:7ffcc14c1118 ax:ffffffffff600400 si:428720 di:7ffcc14c1130
[1395173.551155] dpkg[17643]: segfault at ffffffffff600400 ip ffffffffff600400 sp 00007ffcc14c1118 error 15 likely on CPU 6 (core 6, socket 0)
[1395173.551160] Code: Unable to access opcode bytes at 0xffffffffff6003d6.

/tmp/hH11H2NR4o/var/lib/dpkg/status looks like this afterwards:

Package: dpkg
Status: install ok installed
Maintainer: unknown
Version: 1.16.18

This file seems to have been generated by scripts/debian-common.

Not sure if something changed in the way debootstrap generates initial
files like this, but to me this seems a regression in deboostrap
compared to Bullseye where this still worked. Could have other reasons,
though, too.

Here's end of an "strace -f" of that chrooted dpkg call:

9440  stat("/sbin/start-stop-daemon", {st_mode=S_IFREG|0755, st_size=28152, ...}) = 0
9440  open("/var/lib/dpkg/info/format", O_RDONLY) = 6
9440  fstat(6, {st_mode=S_IFREG|0644, st_size=2, ...}) = 0
9440  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbf38160000
9440  read(6, "1\n", 4096)              = 2
9440  close(6)                          = 0
9440  munmap(0x7fbf38160000, 4096)      = 0
9440  stat("/var/lib/dpkg/info/format-new", 0x7ffe47838f90) = -1 ENOENT (No such file or directory)
9440  open("/var/log/dpkg.log", O_WRONLY|O_CREAT|O_APPEND, 0666) = 6
9440  fstat(6, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
9440  mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fbf38160000
9440  fstat(6, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
9440  lseek(6, 0, SEEK_SET)             = 0
9440  fcntl(6, F_GETFD)                 = 0
9440  fcntl(6, F_SETFD, FD_CLOEXEC)     = 0
9440  --- SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0xffffffffff600400} ---
9440  +++ killed by SIGSEGV (core dumped) +++

I must admit, I currently don't see which system call caused the
segfault. Full strace log attached.

Attachment: dpkg-segfault-inside-wheezy-chroot.xz
Description: Result of 'strace -f -o dpkg-segfault-inside-wheezy-chroot -s 65536 chroot /tmp/hH11H2NR4o dpkg --force-depends --install /var/cache/apt/archives/base-passwd_3.5.26_amd64.deb'

This issue seems to affect these Debian and Ubuntu releases: precise,
oneiric, natty, maverick, lucid, karmic, jaunty, intrepid, hardy, gutsy,
feisty, edgy, dapper, wheezy, squeeze, lenny, etch and sarge.

As wheezy was the most recent Debian release of them, I looked into that
closer as an example to what went wrong.

This issue has been found by running
https://github.com/xen-tools/xen-tools/blob/master/examples/release-testing
on a Bookworm amd64 host with LVM as storage. It bootstraps all releases
listed in
https://github.com/xen-tools/xen-tools/blob/master/etc/distributions.conf
without the "dont-test" tag.

(Bug report written on a different host.)

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (600, 'testing'), (500, 'unstable-debug'), (500, 'buildd-unstable'), (110, 'experimental'), (1, 'experimental-debug'), (1, 'buildd-experimental')
merged-usr: no
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-1-amd64 (SMP w/8 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages debootstrap depends on:
ii  wget  1.21.3-1+b2

Versions of packages debootstrap recommends:
ii  arch-test               0.20-1
ii  debian-archive-keyring  2021.1.1
ii  gnupg                   2.2.40-1

Versions of packages debootstrap suggests:
ii  binutils                                 2.40-2
pn  squid-deb-proxy-client                   <none>
ii  ubuntu-archive-keyring                   2020.06.17.1-1
ii  ubuntu-keyring [ubuntu-archive-keyring]  2020.06.17.1-1
ii  xz-utils                                 5.4.1-0.1
ii  zstd                                     1.5.2+dfsg2-3

-- no debconf information

Reply to: