[Libguestfs] [PATCH 1/2] Try to load the loop module before running mkinitrd

Matthew Booth mbooth at redhat.com
Thu Apr 22 13:38:11 UTC 2010


mkinitrd needs to mount files using loop. loop might be a module, so try to load
it first.
---
 lib/Sys/VirtV2V/GuestOS/RedHat.pm |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/lib/Sys/VirtV2V/GuestOS/RedHat.pm b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
index 0e469f5..08027b6 100644
--- a/lib/Sys/VirtV2V/GuestOS/RedHat.pm
+++ b/lib/Sys/VirtV2V/GuestOS/RedHat.pm
@@ -1114,6 +1114,13 @@ sub prepare_bootable
             $g->modprobe("ext2");
         };
 
+        # loop is a module in RHEL 5. Try to load it. Doesn't matter for other
+        # OSs if it doesn't exist, but RHEL 5 will complain:
+        #   All of your loopback devices are in use.
+        eval {
+            $g->modprobe("loop");
+        };
+
         $g->command(["/sbin/mkinitrd", @preload_args, $initrd, $version]);
     }
 
-- 
1.6.6.1




More information about the Libguestfs mailing list