From 9a03800349379ad3f158b8e86338cf10f4afbeb6 Mon Sep 17 00:00:00 2001 From: Tomas M Date: Fri, 12 Oct 2012 20:33:31 -0500 Subject: [PATCH] update dev entries before loop detach --- initramfs/cleanup | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/initramfs/cleanup b/initramfs/cleanup index 148dccd..9e43b08 100644 --- a/initramfs/cleanup +++ b/initramfs/cleanup @@ -55,8 +55,9 @@ if [ "$1" = "--init" ]; then # All other processes are already killed # so our goal now is just to unmount everything and reboot/shutdown - # First, mount proc again since it will be needed and it was already unmounted + # First, mount proc and sys again since it will be needed and it was already unmounted mount -t proc proc /proc >/dev/console 2>&1 + mount -t sysfs sysfs /sys >/dev/console 2>&1 # if debug is requested, start commandline prompt here if grep -q debug /proc/cmdline; then @@ -64,8 +65,9 @@ if [ "$1" = "--init" ]; then setsid sh -c 'exec sh < /dev/tty1 >/dev/tty1 2>&1' fi - # make sure to detach loop devices which can be detached at this moment, - # else they would block unmounting later. + # Update devs so we are aware of all active /dev/loop* files. + # Detach loop devices which are no longer used + mdev -s losetup | cut -d : -f 1 | xargs -n 1 losetup -d # next, unmount everything from union, backwards