On Sat, Jan 26, 2013 at 01:51:21PM +0000, Jonathan Wiltshire wrote: > On Sat, Jan 26, 2013 at 01:17:44PM +0000, Roger Leigh wrote: > > (Using the new bug number) > > > > On Sat, Jan 26, 2013 at 12:14:59PM +0000, Jonathan Wiltshire wrote: > > > Control: tag -1 + moreinfo > > > > > > On Thu, Nov 15, 2012 at 10:32:19PM +0000, Roger Leigh wrote: > > > > Please unblock package sysvinit > > > > > > > > The attached debdiff includes a correction to the init script > > > > dependencies for the three bootclean scripts. (#677097) > > > > > > Is this request still relevant for wheezy? -35 has been superceded in > > > unstable with non-RC changes, so a fix will need to go through tpu now. > > > > Which changes were non-RC? I don't think there are any changes > > here which do not cause failure on upgrade or at boot time, > > other than a single translation update. > > Ah, I went by e.g. the severity of #697537 (minor), I didn't take a deep > look into the changes themselves.
I've attached a debdiff for 2.88dsf-40. This contains a some small changes to the sysvinit postinst to correct some problems identifying and signalling init on Hurd and when using LXC containers, which were not fully addressed in the previous upload. It should now be completely robust when restarting for all use cases. I'm away until Monday the 11th from now, but if there are any issues with this, I'll be happy to look into them next week. Regards, Roger -- .''`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' schroot and sbuild http://alioth.debian.org/projects/buildd-tools `- GPG Public Key F33D 281D 470A B443 6756 147C 07B3 C8BC 4083 E800
diff -Nru sysvinit-2.88dsf/debian/changelog sysvinit-2.88dsf/debian/changelog --- sysvinit-2.88dsf/debian/changelog 2012-11-16 20:51:07.000000000 +0000 +++ sysvinit-2.88dsf/debian/changelog 2013-02-03 16:35:09.000000000 +0000 @@ -1,3 +1,70 @@ +sysvinit (2.88dsf-40) unstable; urgency=low + + [ Roger Leigh ]: + * Don't restart init on GNU/Hurd (Closes: #663009). + * Handle PID detection more robustly, to work better with containers + (Closes: #699523). Always use PID1, which avoids the need for + fragile pidof usage. + * Handle ischroot more gracefully on failure (Closes: #699566). + + -- Roger Leigh <rle...@debian.org> Sun, 03 Feb 2013 14:52:05 +0000 + +sysvinit (2.88dsf-39) unstable; urgency=low + + [ Roger Leigh ]: + * initscripts postinst calls urandom, not urandom.sh (Closes: #698966). + * sysvinit postinst unconditionally creates a compatibility initctl + link to ensure the migration to /run won't fail (Closes: #663009). + + -- Roger Leigh <rle...@debian.org> Sat, 26 Jan 2013 12:09:29 +0000 + +sysvinit (2.88dsf-38) unstable; urgency=low + + [ Roger Leigh ]: + * If pidof fails in the sysvinit postinst or initscripts, default + to PID 1 (for /sbin/init) (Closes: #663009). + * Make fstab globbing in initscripts completely robust. + + -- Roger Leigh <rle...@debian.org> Wed, 23 Jan 2013 22:43:55 +0000 + +sysvinit (2.88dsf-37) unstable; urgency=low + + [ Roger Leigh ] + * initscripts: Remove all use of shell heredocs in shell libraries; + these require a writable /tmp which will not be guaranteed to be + present in early boot (Closes: #697994). + + -- Roger Leigh <rle...@debian.org> Mon, 14 Jan 2013 21:53:59 +0000 + +sysvinit (2.88dsf-36) unstable; urgency=low + + [ Roger Leigh ] + * initscripts: + - Handle globbing of /etc/fstab.d/* safely. + - Correct erroneous error that an entry for /dev/shm existed in + /etc/fstab when no entry was present (Closes: #697537). + + -- Roger Leigh <rle...@debian.org> Fri, 11 Jan 2013 23:36:28 +0000 + +sysvinit (2.88dsf-35) unstable; urgency=low + + [ David Prévot ] + * Fix German translation charset. + + [ Roger Leigh ] + * initscripts: + - To permit enabling of dependency-based boot, add Breaks on older + versions of bootchart. Thanks to Andreas Beckmann. + Closes: #694252. + - To work around a bug in the Oracle database, which has a faulty + check for /dev/shm, continue to mount a tmpfs on /dev/shm rather + than /run/shm if one is defined in /etc/fstab. Closes: #694379. + * sysvinit-utils: + - Add Breaks: upstart (<< 1.5-1) to avoid breaking the boot with + older versions of upstart. Closes: #694961. + + -- Roger Leigh <rle...@debian.org> Mon, 17 Dec 2012 22:50:49 +0000 + sysvinit (2.88dsf-34) unstable; urgency=low [ Roger Leigh ] diff -Nru sysvinit-2.88dsf/debian/control sysvinit-2.88dsf/debian/control --- sysvinit-2.88dsf/debian/control 2012-08-31 21:14:04.000000000 +0100 +++ sysvinit-2.88dsf/debian/control 2012-12-17 22:37:45.000000000 +0000 @@ -42,6 +42,7 @@ Conflicts: last, sysvconfig, chkconfig (<< 11.0-79.1-2) Replaces: last, sysvinit (<= 2.86.ds1-65) Depends: ${shlibs:Depends}, ${misc:Depends} +Breaks: upstart (<< 1.5-1) Suggests: bootlogd, sash Description: System-V-like utilities This package contains the important System-V-like utilities. @@ -74,7 +75,8 @@ sysvinit-utils (>= 2.86.ds1-64), sysv-rc | file-rc, coreutils (>= 5.93) Recommends: psmisc, e2fsprogs -Conflicts: libdevmapper1.02.1 (<< 2:1.02.24-1) +Conflicts: + libdevmapper1.02.1 (<< 2:1.02.24-1), Replaces: libc6, libc6.1, libc0.1, libc0.3 Breaks: # Needed for ifquery @@ -112,7 +114,9 @@ autofs (<< 5.0.0), # Older versions of initramfs-tools can't cope with /etc/mtab # being a symlink #668616 and #668650 - initramfs-tools (<< 0.104) + initramfs-tools (<< 0.104), +# Needed for transition to dependency-based boot for wheezy + bootchart (<< 0.10~svn407-3.3) Description: scripts for initializing and shutting down the system The scripts in this package initialize a standard Debian system at boot time and shut it down at halt or reboot time. diff -Nru sysvinit-2.88dsf/debian/initscripts.postinst sysvinit-2.88dsf/debian/initscripts.postinst --- sysvinit-2.88dsf/debian/initscripts.postinst 2012-11-16 15:33:58.000000000 +0000 +++ sysvinit-2.88dsf/debian/initscripts.postinst 2013-01-26 12:08:54.000000000 +0000 @@ -561,9 +561,9 @@ if [ "$PREV_VER" = "" ]; then if which invoke-rc.d >/dev/null 2>&1 then - invoke-rc.d urandom.sh start || true + invoke-rc.d urandom start || true else - /etc/init.d/urandom.sh start || true + /etc/init.d/urandom start || true fi fi diff -Nru sysvinit-2.88dsf/debian/po/de.po sysvinit-2.88dsf/debian/po/de.po --- sysvinit-2.88dsf/debian/po/de.po 2012-08-31 21:14:04.000000000 +0100 +++ sysvinit-2.88dsf/debian/po/de.po 2012-12-10 23:03:45.000000000 +0000 @@ -21,7 +21,7 @@ #: ../sysv-rc.templates:1001 msgid "Unable to migrate to dependency-based boot system" msgstr "" -"Es konnte nicht auf abhängigkeitsbasierte Systemstartreihenfolge umgestellt " +"Es konnte nicht auf abhängigkeitsbasierte Systemstartreihenfolge umgestellt " "werden." #. Type: note @@ -32,7 +32,7 @@ "dependency-based boot sequencing:" msgstr "" "Im Startsystem gibt es Probleme, die eine Umstellung auf " -"abhängigkeitsbasierte Systemstartreihenfolge verhindern:" +"abhängigkeitsbasierte Systemstartreihenfolge verhindern:" #. Type: note #. Description @@ -43,10 +43,10 @@ "package has been removed, but not purged. It is suggested that these are " "removed by running:" msgstr "" -"Falls das gemeldete Problem von einer lokalen Ãnderung rührt, muss es manuell " +"Falls das gemeldete Problem von einer lokalen Änderung rührt, muss es manuell " "behoben werden. Dies sind normalerweise veraltete Conffiles, die " -"zurückgeblieben sind, als ein Paket gelöscht, aber nicht vollständig entfernt " -"wurde. Es wird empfohlen, diese zu entfernen, indem Folgendes ausgeführt wird:" +"zurückgeblieben sind, als ein Paket gelöscht, aber nicht vollständig entfernt " +"wurde. Es wird empfohlen, diese zu entfernen, indem Folgendes ausgeführt wird:" #. Type: note #. Description @@ -63,5 +63,5 @@ "fixed, run \"dpkg --configure sysv-rc\"." msgstr "" "Die Paketinstallation kann nicht fortgesetzt werden, bis obige Probleme " -"behoben wurde. Um den Umstellungsprozess nach dem Lösen dieser Probleme " -"erneut zu versuchen, führen Sie »dpkg --configure sysv-rc« aus." +"behoben wurde. Um den Umstellungsprozess nach dem Lösen dieser Probleme " +"erneut zu versuchen, führen Sie »dpkg --configure sysv-rc« aus." diff -Nru sysvinit-2.88dsf/debian/postinst sysvinit-2.88dsf/debian/postinst --- sysvinit-2.88dsf/debian/postinst 2012-04-29 18:02:44.000000000 +0100 +++ sysvinit-2.88dsf/debian/postinst 2013-02-03 16:31:09.000000000 +0000 @@ -17,31 +17,27 @@ ;; esac - # PID of init; may not always be 1. Use for sending signals - # and checking if init is running. - PID="$(pidof /sbin/init || true)" + # PID of init; may not always be 1 but this code isn't run in + # these cases (Hurd). Use for sending signals and checking if + # init is running. + PID=1 # Create /run/initctl if not present, and also create compatibility # symlinks - if [ "$INITCTL" ] && [ ! -p "$INITCTL" ] + if [ ! -p "$INITCTL" ] then # Create new control channel echo "sysvinit: creating $INITCTL" rm -f $INITCTL mkfifo -m 600 $INITCTL + fi - # Replace old control channel (if present) with symlink - if [ -e "$OLDINITCTL" ]; then - ln -s "$INITCTL" "$OLDINITCTL.new" - mv "$OLDINITCTL.new" "$OLDINITCTL" - fi + # Replace old control channel with symlink + ln -s "$INITCTL" "$OLDINITCTL.new" + mv "$OLDINITCTL.new" "$OLDINITCTL" - # Reopen control channel (uses new channel). - if ! ischroot && [ -n "$PID" ] - then - kill -s USR1 "$PID" - fi - fi + # Reopen control channel (uses new channel). + kill -s USR1 "$PID" rm -f /etc/ioctl.save if [ ! -f /etc/inittab ] @@ -49,38 +45,29 @@ cp -p /usr/share/sysvinit/inittab /etc/inittab fi - # Tell init to re-exec itself. We loop on failure because to reduce - # the chance of a race before the new control channel is opened. - if ! ischroot && [ -n "$PID" ] - then - echo -n "sysvinit: restarting..." - for delay in 0 1 2 3 4 5 6 fail; - do - if init u + # Tell init to re-exec itself. We loop on failure to reduce + # the chance of a race before the new control channel is + # opened. + echo -n "sysvinit: restarting..." + for delay in 0 1 2 3 4 5 6 fail; + do + if init u + then + echo " done." + break + else + if [ "$delay" = "fail" ] then - echo " done." - break + echo " failed." else - if [ "$delay" = "fail" ] - then - echo " failed." - else - echo -n "." - sleep "$delay" - fi + echo -n "." + sleep "$delay" fi - done - else - if [ -n "$PID" ] - then - echo "Not restarting sysvinit: chroot detected" - else - echo "Not restarting sysvinit: init not running" fi - fi + done # Remove old pipe if present. No longer in use after re-exec. - if [ "$OLDINITCTL" ] && [ -p "$OLDINITCTL" ] + if [ -p "$OLDINITCTL" ] then rm -f "$OLDINITCTL" fi @@ -97,10 +84,28 @@ umask 022 +restart=yes + +chroot=0 +ischroot || chroot="$?" + +if [ "$chroot" != "1" ]; then + restart=no +fi + # If systemd is running, don't restart init or doing any initctl # migration. -if [ ! -e /sys/fs/cgroup/systemd ] ; then +if [ -e /sys/fs/cgroup/systemd ]; then + restart=no +fi +if [ "$(uname -s)" = "GNU" ]; then + restart=no +fi + +if [ "$restart" = "yes" ]; then do_restart +else + echo "Not restarting sysvinit" fi #DEBHELPER# diff -Nru sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall.sh sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall.sh --- sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall.sh 2012-11-16 15:18:07.000000000 +0000 +++ sysvinit-2.88dsf/debian/src/initscripts/etc/init.d/mountall.sh 2013-01-23 22:40:32.000000000 +0000 @@ -55,7 +55,7 @@ mknod -m 600 "$INITCTL" p # Reopen control channel. - PID="$(pidof /sbin/init || true)" + PID="$(pidof /sbin/init || echo 1)" [ -n "$PID" ] && kill -s USR1 "$PID" fi diff -Nru sysvinit-2.88dsf/debian/src/initscripts/lib/init/mount-functions.sh sysvinit-2.88dsf/debian/src/initscripts/lib/init/mount-functions.sh --- sysvinit-2.88dsf/debian/src/initscripts/lib/init/mount-functions.sh 2012-08-31 21:14:04.000000000 +0100 +++ sysvinit-2.88dsf/debian/src/initscripts/lib/init/mount-functions.sh 2013-01-22 23:47:04.000000000 +0000 @@ -3,12 +3,13 @@ # # Sourcer must source /lib/lsb/init-functions.sh +# List available fstab files, including any files in /etc/fstab.d. +# This looks ugly, but we can't use find and it's safer than globbing. fstab_files() { - if ! eval 'ls /etc/fstab.d/*.fstab' >/dev/null 2>&1; then - echo /etc/fstab - else - echo '/etc/fstab' '/etc/fstab.d/*' + echo /etc/fstab + if [ -d /etc/fstab.d ]; then + ls -1 /etc/fstab.d | grep '\.fstab$' | sed -e 's;^;/etc/fstab.d/;' fi } @@ -35,17 +36,17 @@ # device node, # 2) Swap that is on a md device or a file that may be on a md # device, -read_fstab () { - fstabroot=/dev/root - rootdev=none - roottype=none - rootopts=defaults - rootmode=rw - rootcheck=no - swap_on_lv=no - swap_on_file=no +_read_fstab () { + echo "fstabroot=/dev/root" + echo "rootdev=none" + echo "roottype=none" + echo "rootopts=defaults" + echo "rootmode=rw" + echo "rootcheck=no" + echo "swap_on_lv=no" + echo "swap_on_file=no" - for file in "$(eval ls $(fstab_files))"; do + fstab_files | while read file; do if [ -f "$file" ]; then while read DEV MTPT FSTYPE OPTS DUMP PASS JUNK; do case "$DEV" in @@ -53,7 +54,7 @@ continue; ;; /dev/mapper/*) - [ "$FSTYPE" = "swap" ] && swap_on_lv=yes + [ "$FSTYPE" = "swap" ] && echo swap_on_lv=yes ;; /dev/*) ;; @@ -64,21 +65,21 @@ fi ;; /*) - [ "$FSTYPE" = "swap" ] && swap_on_file=yes + [ "$FSTYPE" = "swap" ] && echo swap_on_file=yes ;; *) ;; esac [ "$MTPT" != "/" ] && continue - rootdev="$DEV" - fstabroot="$DEV" - rootopts="$OPTS" - roottype="$FSTYPE" - ( [ "$PASS" != 0 ] && [ "$PASS" != "" ] ) && rootcheck=yes - ( [ "$FSTYPE" = "nfs" ] || [ "$FSTYPE" = "nfs4" ] ) && rootcheck=no + echo rootdev=\"$DEV\" + echo fstabroot=\"$DEV\" + echo rootopts=\"$OPTS\" + echo roottype=\"$FSTYPE\" + ( [ "$PASS" != 0 ] && [ "$PASS" != "" ] ) && echo rootcheck=yes + ( [ "$FSTYPE" = "nfs" ] || [ "$FSTYPE" = "nfs4" ] ) && echo rootcheck=no case "$OPTS" in ro|ro,*|*,ro|*,ro,*) - rootmode=ro + echo rootmode=ro ;; esac done < "$file" @@ -86,15 +87,29 @@ done } +# Read /etc/fstab, looking for: +# 1) The root filesystem, resolving LABEL=*|UUID=* entries to the +# device node, +# 2) Swap that is on a md device or a file that may be on a md +# device, + +read_fstab () { + eval "$(_read_fstab)" +} + # Find a specific fstab entry # $1=mountpoint # $2=fstype (optional) -# returns 0 on success, 1 on failure (not found or no fstab) -read_fstab_entry () { +_read_fstab_entry () { # Not found by default. - found=1 + echo "MNT_FSNAME=" + echo "MNT_DIR=" + echo "MNT_TYPE=" + echo "MNT_OPTS=" + echo "MNT_FREQ=" + echo "MNT_PASS=" - for file in "$(eval ls $(fstab_files))"; do + fstab_files | while read file; do if [ -f "$file" ]; then while read MNT_FSNAME MNT_DIR MNT_TYPE MNT_OPTS MNT_FREQ MNT_PASS MNT_JUNK; do case "$MNT_FSNAME" in @@ -106,12 +121,32 @@ if [ -n "$2" ]; then [ "$MNT_TYPE" = "$2" ] || continue; fi - found=0 + echo "MNT_FSNAME=$MNT_FSNAME" + echo "MNT_DIR=$MNT_DIR" + echo "MNT_TYPE=$MNT_TYPE" + echo "MNT_OPTS=$MNT_OPTS" + echo "MNT_FREQ=$MNT_FREQ" + echo "MNT_PASS=$MNT_PASS" break 2 fi + MNT_DIR="" done < "$file" fi done +} + +# Find a specific fstab entry +# $1=mountpoint +# $2=fstype (optional) +# returns 0 on success, 1 on failure (not found or no fstab) +read_fstab_entry () { + eval "$(_read_fstab_entry "$1" "$2")" + + # Not found by default. + found=1 + if [ "$1" = "$MNT_DIR" ]; then + found=0 + fi return $found } @@ -252,10 +287,8 @@ if ! read_fstab_entry "$MTPT" "$FSTYPE"; then CALLER_OPTS="$(echo "$CALLER_OPTS" | sed -e 's/^-o//')" echo "Creating /etc/fstab entry for $MTPT to replace default in /etc/default/tmpfs (deprecated)" >&2 - cat << EOF -# This mount for $MTPT replaces the default configured in /etc/default/tmpfs -$DEVNAME $MTPT $FSTYPE $CALLER_OPTS 0 0 -EOF + echo "# This mount for $MTPT replaces the default configured in /etc/default/tmpfs" + echo "$DEVNAME $MTPT $FSTYPE $CALLER_OPTS 0 0" fi ;; esac @@ -424,6 +457,14 @@ # directory. The migration logic will then take care of the # rest. Note that it will take a second boot to fully # migrate; it should only ever be needed on broken systems. + RAMSHM_ON_DEV_SHM="no" + if read_fstab_entry "/dev/shm"; then + RAMSHM_ON_DEV_SHM="yes" + fi + if read_fstab_entry "/run/shm"; then + RAMSHM_ON_DEV_SHM="no" + fi + if [ -L /run ]; then if [ "$(readlink /run)" = "/var/run" ]; then rm -f /run @@ -431,12 +472,20 @@ fi if bind_mount /var/run /run; then bind_mount /var/lock /run/lock - bind_mount /dev/shm /run/shm + if [ yes = "$RAMSHM_ON_DEV_SHM" ]; then + run_migrate /run/shm /dev/shm + else + run_migrate /dev/shm /run/shm + fi fi else run_migrate /var/run /run run_migrate /var/lock /run/lock - run_migrate /dev/shm /run/shm + if [ yes = "$RAMSHM_ON_DEV_SHM" ]; then + run_migrate /run/shm /dev/shm + else + run_migrate /dev/shm /run/shm + fi fi } @@ -512,20 +561,38 @@ { MNTMODE="$1" - if [ ! -d /run/shm ] + RAMSHM_ON_DEV_SHM="no" + SHMDIR="/run/shm" + if read_fstab_entry "/dev/shm"; then + if [ "$MNTMODE" = "mount_noupdate" ]; then + log_warning_msg "Warning: fstab entry for /dev/shm; should probably be for /run/shm unless working around a bug in the Oracle database" + fi + SHMDIR="/dev/shm" + RAMSHM_ON_DEV_SHM="yes" + fi + if read_fstab_entry "/run/shm"; then + if [ "$MNTMODE" = "mount_noupdate" ] && [ "$RAMSHM_ON_DEV_SHM" = "yes" ]; then + log_warning_msg "Warning: fstab entries for both /dev/shm and /run/shm found; only /run/shm will be used" + fi + + SHMDIR="/run/shm" + RAMSHM_ON_DEV_SHM="no" + fi + + if [ ! -d "$SHMDIR" ] then - mkdir --mode=755 /run/shm - [ -x /sbin/restorecon ] && /sbin/restorecon /run/shm + mkdir --mode=755 "$SHMDIR" + [ -x /sbin/restorecon ] && /sbin/restorecon "$SHMDIR" fi # Now check if there's an entry in /etc/fstab. If there is, # it overrides the existing RAMSHM setting. - if read_fstab_entry /run/shm; then - if [ "$MNT_TYPE" = "tmpfs" ] ; then - RAMSHM="yes" - else - RAMSHM="no" - fi + if read_fstab_entry "$SHMDIR"; then + if [ "$MNT_TYPE" = "tmpfs" ] ; then + RAMSHM="yes" + else + RAMSHM="no" + fi fi KERNEL="$(uname -s)" @@ -535,16 +602,20 @@ esac if [ yes = "$RAMSHM" ]; then - domount "$MNTMODE" tmpfs shmfs /run/shm tmpfs "-onosuid,${NODEV}noexec$SHM_OPT" + domount "$MNTMODE" tmpfs shmfs "$SHMDIR" tmpfs "-onosuid,${NODEV}noexec$SHM_OPT" # Make sure we don't get cleaned - touch /run/shm/.tmpfs + touch "$SHMDIR"/.tmpfs else - chmod "$SHM_MODE" /run/shm + chmod "$SHM_MODE" "$SHMDIR" fi # Migrate early, so /dev/shm is available from the start if [ "$MNTMODE" = mount_noupdate ] || [ "$MNTMODE" = mount ]; then - run_migrate /dev/shm /run/shm ../run/shm + if [ yes = "$RAMSHM_ON_DEV_SHM" ]; then + run_migrate /run/shm /dev/shm + else + run_migrate /dev/shm /run/shm + fi fi } diff -Nru sysvinit-2.88dsf/debian/src/initscripts/man/tmpfs.5 sysvinit-2.88dsf/debian/src/initscripts/man/tmpfs.5 --- sysvinit-2.88dsf/debian/src/initscripts/man/tmpfs.5 2012-08-31 21:14:04.000000000 +0100 +++ sysvinit-2.88dsf/debian/src/initscripts/man/tmpfs.5 2012-12-17 22:35:46.000000000 +0000 @@ -76,7 +76,10 @@ Packages can not expect directories in /run/shm to exist after boot. Note that /run/shm was previously /dev/shm, and a compatibility symlink or bind mount will be created to allow the old path to -continue to function. +continue to function. If an fstab entry for /dev/shm exists instead +of /run/shm, then /dev/shm will continue to be used; note that this is +only needed for users of newer versions of the Oracle database, which +contain a buggy check for /dev/shm. .IP /tmp Previously configured using \fBRAMTMP\fP in /etc/default/rcS. Note