diff -Nru sysvinit-2.87dsf/debian/changelog sysvinit-2.87dsf/debian/changelog --- sysvinit-2.87dsf/debian/changelog 2010-10-29 04:31:02.000000000 +0100 +++ sysvinit-2.87dsf/debian/changelog 2011-01-28 17:34:18.000000000 +0000 @@ -1,3 +1,11 @@ +sysvinit (2.87dsf-4ubuntu20) natty; 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 17:33:29 +0000 + sysvinit (2.87dsf-4ubuntu19) maverick-proposed; urgency=low * debian/initscripts.postinst (LP: #659738): 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 17:34:50.000000000 +0000 @@ -0,0 +1,41 @@ +Index: sysvinit-2.87dsf/debian/initscripts/etc/init.d/umountroot +=================================================================== +--- sysvinit-2.87dsf.orig/debian/initscripts/etc/init.d/umountroot 2011-01-28 15:42:13.234543001 +0000 ++++ sysvinit-2.87dsf/debian/initscripts/etc/init.d/umountroot 2011-01-28 15:43:15.398542998 +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 15:42:06.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