[arch-releng] [PATCH 1/1] explicitly detach loop device on umount and silent losetup error

Christian Hesse list at eworm.de
Thu May 28 06:59:41 UTC 2015


From: Christian Hesse <mail at eworm.de>

Umount detaches the loop device automatically, but let's make it
explicit to be sure. Additionally losetup gives:

losetup: /dev/loop0: detach failed: No such device or address

This is kind of expected, let's silent the error message.

Signed-off-by: Christian Hesse <mail at eworm.de>
---
 archiso/initcpio/hooks/archiso          | 2 +-
 archiso/initcpio/hooks/archiso_loop_mnt | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/archiso/initcpio/hooks/archiso b/archiso/initcpio/hooks/archiso
index b02d9f8..3edc76c 100644
--- a/archiso/initcpio/hooks/archiso
+++ b/archiso/initcpio/hooks/archiso
@@ -182,7 +182,7 @@ archiso_mount_handler() {
     fi
 
     if [[ "${copytoram}" == "y" ]]; then
-        umount /run/archiso/bootmnt
+        umount -d /run/archiso/bootmnt
     fi
 }
 
diff --git a/archiso/initcpio/hooks/archiso_loop_mnt b/archiso/initcpio/hooks/archiso_loop_mnt
index a02cfac..46338e5 100644
--- a/archiso/initcpio/hooks/archiso_loop_mnt
+++ b/archiso/initcpio/hooks/archiso_loop_mnt
@@ -26,7 +26,7 @@ archiso_loop_mount_handler () {
     archiso_mount_handler ${newroot}
 
     if [[ "${copytoram}" == "y" ]]; then
-        losetup -d ${_dev_loop}
+        losetup -d ${_dev_loop} 2>/dev/null
         umount /run/archiso/img_dev
     fi
 }
-- 
2.4.2


More information about the arch-releng mailing list