diff -Nru sysvinit-2.87dsf/debian/changelog sysvinit-2.87dsf/debian/changelog --- sysvinit-2.87dsf/debian/changelog 2010-09-24 10:48:30.000000000 +0100 +++ sysvinit-2.87dsf/debian/changelog 2011-01-28 11:51:18.000000000 +0000 @@ -1,3 +1,11 @@ +sysvinit (2.87dsf-4ubuntu19) maverick; urgency=low + + * debian/initscripts/etc/init.d/umountroot: Improve handling of + respawn of init: we now wait for inits map file to change. If this doesn't + happen within 5 seconds, we unmount forcibly. + + -- James Hunt Fri, 28 Jan 2011 11:45:35 +0000 + sysvinit (2.87dsf-4ubuntu18) maverick; urgency=low * Allocate pidof/killall5 omitpid buffers dynamically. 16 is too small diff -Nru sysvinit-2.87dsf/debian/patches/99_improve-init-reexec-handling.dpatch sysvinit-2.87dsf/debian/patches/99_improve-init-reexec-handling.dpatch --- sysvinit-2.87dsf/debian/patches/99_improve-init-reexec-handling.dpatch 1970-01-01 01:00:00.000000000 +0100 +++ sysvinit-2.87dsf/debian/patches/99_improve-init-reexec-handling.dpatch 2011-01-28 11:44:13.000000000 +0000 @@ -0,0 +1,44 @@ +Description: Fix for init (upstart) respawn. +Author: James Hunt + +Index: sysvinit-2.87dsf/debian/initscripts/etc/init.d/umountroot +=================================================================== +--- sysvinit-2.87dsf.orig/debian/initscripts/etc/init.d/umountroot 2011-01-28 11:41:26.846543000 +0000 ++++ sysvinit-2.87dsf/debian/initscripts/etc/init.d/umountroot 2011-01-28 11:41:32.018542999 +0000 +@@ -28,10 +28,33 @@ + ln -nsf /var/run /lib/init/rw + fi + +- # Ask init to reexec itself before we go down if it has been ++ # Ask init to re-exec itself before we go down if it has been + # upgraded this cycle. It'll lose all its state, but at least +- # it won't hold open files on the root filesystem +- [ -f /var/run/init.upgraded ] && telinit u || : ++ # it won't hold open files on the root filesystem (lp:#672177). ++ if [ -f /var/run/init.upgraded ] ++ then ++ old_map=$( cat /proc/1/maps ) ++ map=$old_map ++ telinit u || : ++ i=0 ++ timeout=5 ++ while [ "$map" = "$old_map" ] ++ do ++ sleep 1 ++ map=$( cat /proc/1/maps ) ++ /usr/bin/logger "waiting for init to respawn" ++ i=$((i+1)) ++ if [ $i -eq $timeout ] ; then ++ break ++ fi ++ done ++ ++ if [ "$map" = "$old_map" ] ; then ++ /usr/bin/logger "FAIL: init failed to respawn in $timeout seconds - unmounting anyway" ++ else ++ /usr/bin/logger "SUCCESS: init respawned after $i seconds (within $timeout seconds timeout)" ++ fi ++ fi + + MOUNT_FORCE_OPT= + [ "$(uname -s)" = "GNU/kFreeBSD" ] && MOUNT_FORCE_OPT=-f diff -Nru sysvinit-2.87dsf/debian/patches/series sysvinit-2.87dsf/debian/patches/series --- sysvinit-2.87dsf/debian/patches/series 2010-09-06 17:56:59.000000000 +0100 +++ sysvinit-2.87dsf/debian/patches/series 2011-01-28 11:40:22.000000000 +0000 @@ -1,3 +1,4 @@ +99_improve-init-reexec-handling.dpatch 10_doc_manuals.dpatch 11_doc_shutdown-c.dpatch 14_doc_fsf_addr.dpatch