From 9a81644d6518098a6f33286aecbe5adbe59744c6 Mon Sep 17 00:00:00 2001 From: Richard Su Date: Fri, 5 Jul 2013 12:38:24 -0700 Subject: [PATCH] Fix loop0p2 does not exist on F19 On Fedora 19, there is a delay between the time loop0p2 is created to the time it is ready to be mounted. This patches waits for 5 seconds for /dev/mapper/loop0p2 to be accessible. If it is not ready then the script exits with status 1. Fixes: bug #1197340 Change-Id: Iff0cfd0566673799a77500e0e24954f5f3743a17 --- elements/fedora/root.d/10-fedora-cloud-image | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/elements/fedora/root.d/10-fedora-cloud-image b/elements/fedora/root.d/10-fedora-cloud-image index 9b6443cb..1e5184a8 100755 --- a/elements/fedora/root.d/10-fedora-cloud-image +++ b/elements/fedora/root.d/10-fedora-cloud-image @@ -38,6 +38,10 @@ if [ ! -f $IMG_PATH/$BASE_IMAGE_TAR -o \ # /dev/loop0 does not create /dev/loop0p2, while kpartx at # least creates /dev/mapper/loop0p2. LOOPDEV=$(sudo kpartx -avr $WORKING/$RAW_FILE | awk "/loop[0-9]+$MAGIC_BIT/ {print \$3}") + if ! timeout 5 sh -c "while ! [ -e /dev/mapper/$LOOPDEV ]; do sleep 1; done"; then + echo "Error: Could not find /dev/mapper/$LOOPDEV" + exit 1 + fi EACTION="sudo kpartx -d $WORKING/$RAW_FILE;$EACTION" trap "$EACTION" EXIT mkdir $WORKING/mnt