Pass the -s (sync) flag to kpartx in map_disk0(). Without the -s flag, kpartx will return directly after signaling the device mapper to create the partition devices, however it is not guaranteed that the devices will have appeared in userspace by the time map_disk0 will look for them. With -s, kpartx will wait until the devices have been created.
Signed-off-by: Apollon Oikonomopoulos <[email protected]> --- common.sh.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.sh.in b/common.sh.in index a35eadd..8d5bcc0 100644 --- a/common.sh.in +++ b/common.sh.in @@ -105,7 +105,7 @@ map_disk0() { log_error "Cannot interpret kpartx output and get partition mapping" exit 1 fi - kpartx -a -p- $blockdev > /dev/null + kpartx -a -s -p- $blockdev > /dev/null filesystem_dev="/dev/mapper/$filesystem_dev_base" if [ ! -b "$filesystem_dev" ]; then log_error "Can't find kpartx mapped partition: $filesystem_dev" -- 1.9.0
