Re: losetup: cannot find an unused loop device , kernel config of loopback device
Hi,
Colin Williams wrote:
> http://ix.io/3vfj
Where i read
+++ sudo losetup --show -f /mnt/host/source/src/build/ima
ges/kukui/R94-14125.0.2021_08_07_0451-a1/chromiumos_base_
image.bin
losetup: cannot find an unused loop device
++ lb_dev=
++ sudo losetup -l -a
+++ sudo partx -v -d ''
Now that kills the theory about all loop devices being occupied.
I had a look into
https://sources.debian.org/src/util-linux/2.36.1-7/sys-utils/losetup.c
where i find two occurences of
"cannot find an unused loop device"
Each happens after a call to loopcxt_find_unused() at
https://sources.debian.org/src/util-linux/2.36.1-7/lib/loopdev.c/#L1544
which seems to try two different methods to get the number of an unused
loop device.
No other external reason is to see for getting the losetup error message.
Any theory about bad program parameters seems unlikely.
----------------------------------------------------------------------
Do you have a file
/dev/loop-control
?
What is listed by
ls -ld /dev/loop*
?
(/dev/loop files do not vanish after losetup -d. So if there are none, then
it is likely that there never have been any.)
----------------------------------------------------------------------
What happens if you try to create a loop device manually ?
not_yet_existing_file="some_file_path"
dd if=/dev/zero bs=512 count=2 of="$not_yet_existing_file"
sudo losetup loop0 "$not_yet_existing_file"
There should be no messages from losetup.
sudo wc -c </dev/loop0
should yield "1024".
To clean up do:
losetup -d /dev/loop0
rm "$not_yet_existing_file"
Have a nice day :)
Thomas
Reply to: