Skip to content

Commit ce616cb

Browse files
committed
Move 'sleep 1' before mkfs into attach_image()
I just encountered a similar issue as #45 when creating an image with UEFI (which implies creating a partitioning table) – sfdisk failed due to nbd device not being ready. I think the sleep needs to be right after `attach_image`, i.e. sooner than `mkfs`. There’s already one `sleep 1` after writing the partitioning table which is before mkfs. Related to 9ebdf2f
1 parent 4c8b744 commit ce616cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

alpine-make-vm-image

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,10 @@ attach_image() {
202202
} || die 'No available nbd device found!'
203203

204204
qemu-nbd --connect="$disk_dev" --cache=writeback \
205-
${format:+--format=$format} "$image" \
206-
&& echo "$disk_dev"
205+
${format:+--format=$format} "$image" || return 1
206+
207+
sleep 1 # see #45
208+
echo "$disk_dev"
207209
}
208210

209211
# Prints UUID of filesystem on the specified block device.
@@ -554,8 +556,6 @@ fi
554556
# useless for NBD image and prints confusing error).
555557
[ "$ROOTFS" = ext4 ] && mkfs_args='-O ^64bit -E nodiscard' || mkfs_args='-K'
556558

557-
sleep 1 # see #45
558-
559559
mkfs.$ROOTFS -L root $mkfs_args "$root_dev"
560560

561561
root_uuid=$(blk_uuid "$root_dev")

0 commit comments

Comments
 (0)