live-build/functions: avoid losetup -P as it appears to race with udev and do it a bit more by-hand instead. (LP: #2045586)

ubuntu-core-desktop-noble
Michael Hudson-Doyle 11 months ago
parent 4d17ae31b3
commit 57592e6dc1

7
debian/changelog vendored

@ -1,3 +1,10 @@
livecd-rootfs (24.04.21) UNRELEASED; urgency=medium
* live-build/functions: avoid losetup -P as it appears to race with udev and
do it a bit more by-hand instead. (LP: #2045586)
-- Michael Hudson-Doyle <michael.hudson@ubuntu.com> Thu, 25 Jan 2024 07:45:58 +1300
livecd-rootfs (24.04.20) noble; urgency=medium
* fix: Fix for calling unminimize if lxd-installer package

@ -62,13 +62,26 @@ mount_image() {
trap clean_loops EXIT
backing_img="$1"
local rootpart="$2"
loop_device=$(losetup --show -f -P -v ${backing_img})
# As explained in excruciating detail in LP: #2045586, "losetup
# -P" (a.k.a. --partscan) appears to race with udev in a way that
# prevents the device nodes for the partitions from being
# created. So instead we run losetup without -P, wait for udev to
# settle, then run partprobe and then settle udev again (which is
# probably unnecessary but at this point a bit more superstition
# can't hurt)
loop_device=$(losetup --show -f -v ${backing_img})
if [ ! -b ${loop_device} ]; then
echo "unable to find loop device for ${backing_img}"
exit 1
fi
udevadm settle
partprobe ${loop_device}
udevadm settle
# Find the rootfs location
rootfs_dev_mapper="${loop_device}p${rootpart}"
if [ ! -b "${rootfs_dev_mapper}" ]; then

Loading…
Cancel
Save