Not waiting for loop devices after modprobe loop
Created by: ollieparanoid
When running pmbootstrap install
, we create a big empty file and mount it as loopback device, in order to copy the rootfs into it. To do that, we require the loop
kernel module, which may not be loaded by default.
In that case we load it with modprobe
and expect the loopdevices to directly appear afterwards:
But that is not the case, sometimes it will fail at this point:
$ sudo rmmod loop
$ lsmod | grep loop # this should be empty when it's unloaded
$ pmbootstrap install
with:
losetup: /home/pmos/rootfs/qemu-amd64.img: failed to set up loop device: No such file or directory
To fix this, we can add a short loop that waits 100ms until the loop devices are available.
It did not fail on my PC as I've tested it, but it fails on @craftyguy's shared gitlab CI runner every time.
Related: https://github.com/postmarketOS/pmbootstrap/pull/1539#issuecomment-396425973