[Pkg-sysvinit-devel] Bug#720584: initscripts.postinst: wrong --compare-versions checks (causing debootstrap fakechroot failure)

Andreas Mohr andi at lisas.de
Fri Aug 23 14:22:45 UTC 2013


Package: initscripts
Version: 2.88dsf-43
Severity: important
Tags: d-i patch

Dear Maintainer,

I'm unsuccessfully trying to use debirf to create a Debian testing initrd,
i.e. using debootstrap in fakechroot mode.

   * What led up to the situation?

debootstrap fails, with an sh -ex enabled debootstrap.log containing:

+ info CONFIGURING Configuring %s... initscripts
+ local name=CONFIGURING
+ local fmt=Configuring %s...
+ shift
+ shift
+ [  ]
+ printf I: Configuring %s...\n initscripts
+ expect=installed
+ read status pkg qstate
sed: couldn't open temporary file /etc/default/sedUlNpID: Permission denied
dpkg: error processing initscripts (--configure):
 subprocess installed post-installation script returned error exit status 4
+ [ status: = EXITCODE ]
+ [ : error : subprocess installed post-installation script returned error exit
status 4 = installed ]


I then did
debirf enter <config> (enter chroot)
and there did a manual
dpkg -D777 --configure initscripts
and then
sh -x /var/lib/dpkg/info/initscripts.postinst configure
which both successfully exhibited the sed failure above.

Narrowing it down some more via a
strace -f sed -i 's:foobar:foobaz:' /etc/default/rcS|less
showed

open("/etc/default/sedO6lzxA", O_RDWR|O_CREAT|O_EXCL|O_LARGEFILE, 0600) = -1 EACCES (Permission denied)
umask(022)                              = 0700
write(2, "sed: ", 5sed: )                    = 5
write(2, "couldn't open temporary file /et"..., 70couldn't open temporary file /etc/default/sedO6lzxA: Permission denied) = 70
write(2, "\n", 1

   * What exactly did you do (or not do) that was effective (or
     ineffective)?

Nothing.

   * What was the outcome of this action?

Complete debirf (debootstrap) failure so far, for any install of Debian testing.
== "WTF" ==

This failure was not avoided, due to postinst improperly deciding
to enter the sed fixup section despite it being an initial-install,
thus dpkg --compare-versions with empty $PREV_VER ought to have been false
(see dpkg(1)).

Or, to put it more clearly, this perhaps unfixable permission failure
(see also related bugs #596284 / #694986 / #649148 ) would at least
have been avoided in *my* situation of an initial-install -
*if* the version checks had been correct.


   * What outcome did you expect instead?

Given that I expect debootstrap to be an absolute hotpath
(thousands of server installs) this should have Nothing But Worked.

Will soon try non-fakechroot mode of debootstrap instead,
since I'm hopeful that this will avoid the Permission Denied issue.
I'm quickly running out of ideas on how to get a Debian testing debootstrap
up and running, however, since I'm unsure whether I'm able to locally supply a
custom-patched package, or use any other suitable methods to avoid that failure.
There are several similar Internet reports about debootstrap-related problems
in this area.


This reportbug template produced by host system (aptosid 2013-01),
not semi-bootstrapped one - some info may be slightly(!) mismatching.



Untested patch included here.
It corrects the comparison operators where suitable, and only there!
(some others further below talk of those being necessary
for both specific version ranges and initial-install empty-string, too)
With this patch it means that postinst now depends on solid availability
of the possibly too modern lt-nl variants (perhaps that kind of dpkg support
may happen to be not old enough?).

Thank you for maintaining a very important and thus sizeable core package!

Andreas Mohr

--- initscripts.postinst.orig	2013-08-23 15:39:09.021852346 +0200
+++ initscripts.postinst	2013-08-23 15:41:39.228899560 +0200
@@ -61,16 +61,16 @@
 }
 
 # In 2.88dsf-23 the "mountoverflowtmp" script was dropped entirely.
-if dpkg --compare-versions "$PREV_VER" lt "2.88dsf-23" ; then
+if dpkg --compare-versions "$PREV_VER" lt-nl "2.88dsf-23" ; then
         update-rc.d -f mountoverflowtmp remove >/dev/null
 fi
 # In 2.88dsf-41+jessie1 the "mtab.sh" script was dropped entirely.
-if dpkg --compare-versions "$PREV_VER" lt "2.88dsf-41+jessie1" ; then
+if dpkg --compare-versions "$PREV_VER" lt-nl "2.88dsf-41+jessie1" ; then
         update-rc.d -f mtab.sh remove >/dev/null
 fi
 
 # Comment out obsolete options in rcS.
-if dpkg --compare-versions "$PREV_VER" lt "2.88dsf-23" ; then
+if dpkg --compare-versions "$PREV_VER" lt-nl "2.88dsf-23" ; then
     if [ -f /etc/default/rcS ]; then
 	sed -i \
 -e 's:^\(RAMRUN=.*\)$:#\1 # OBSOLETE; see /etc/default/tmpfs and tmpfs(5).:' \


-- System Information:
Debian Release: 7.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i586)

Kernel: Linux 3.9-0.slh.4-aptosid-686 (SMP w/1 CPU core; PREEMPT)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages initscripts depends on:
ii  coreutils       8.13-3.3
ii  debianutils     4.3.4
ii  libc6           2.17-92
ii  lsb-base        4.1+Debian9
ii  mount           2.20.1-5.3
ii  sysv-rc         2.88dsf-41
ii  sysvinit-utils  2.88dsf-41

Versions of packages initscripts recommends:
ii  e2fsprogs  1.42.5-1.1
ii  psmisc     22.20-1

initscripts suggests no packages.

-- no debconf information



More information about the Pkg-sysvinit-devel mailing list