Possible workaround w/ losetup. # uname -rv 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC 2023
# cat /sys/module/loop/parameters/max_loop 8 # losetup -nl | sort /dev/loop0 0 0 1 1 /var/lib/snapd/snaps/lxd_24322.snap 0 512 /dev/loop1 0 0 1 1 /var/lib/snapd/snaps/snapd_18357.snap 0 512 /dev/loop2 0 0 1 1 /var/lib/snapd/snaps/core20_1822.snap 0 512 # ls -1 /dev/loop* /dev/loop-control /dev/loop0 /dev/loop1 /dev/loop2 /dev/loop3 /dev/loop4 /dev/loop5 /dev/loop6 /dev/loop7 # truncate -s 1g test1 # truncate -s 1g test2 # ls -lh test1 test2 -rw-r--r-- 1 root root 1.0G Apr 6 17:40 test1 -rw-r--r-- 1 root root 1.0G Apr 6 17:40 test2 # losetup /dev/loop7 test1 # losetup /dev/loop8 test2 losetup: /dev/loop8: failed to set up loop device: No such device or address ... # losetup --show --find test1 /dev/loop3 # losetup --show --find test1 /dev/loop4 # losetup --show --find test1 /dev/loop5 # losetup --show --find test1 /dev/loop6 # losetup --show --find test1 /dev/loop8 # losetup --show --find test1 /dev/loop9 # losetup --show --find test1 /dev/loop10 # losetup --show --find test1 /dev/loop11 # losetup --show --find test1 /dev/loop12 # losetup --show --find test1 /dev/loop13 # strace -e ioctl losetup --show --find test1 ioctl(3, LOOP_CTL_GET_FREE) = 14 ioctl(4, LOOP_CONFIGURE, {fd=3, block_size=0, info={lo_offset=0, lo_number=0, lo_flags=0, lo_file_name="/root/test1", ...}}) = 0 /dev/loop14 +++ exited with 0 +++ # losetup -d /dev/loop3 # losetup -d /dev/loop4 # losetup -d /dev/loop5 # losetup -d /dev/loop6 # losetup -d /dev/loop8 # losetup -d /dev/loop9 # losetup -d /dev/loop10 # losetup -d /dev/loop11 # losetup -d /dev/loop12 # losetup -d /dev/loop13 # losetup /dev/loop8 test2 # works now. # cat /sys/module/loop/parameters/max_loop 8 -- You received this bug notification because you are a member of Kernel Packages, which is subscribed to linux-hwe-5.15 in Ubuntu. https://bugs.launchpad.net/bugs/2015400 Title: losetup with mknod fails on jammy with kernel 5.15.0-69-generic Status in linux package in Ubuntu: Confirmed Status in linux-hwe-5.15 package in Ubuntu: New Bug description: losetup fails with devices created manually by mknod on kernel 5.15.0-69-generic # fallocate -l 1G test # mknod -m 660 /dev/loop8 b 7 8 # chown root:disk /dev/loop8 # losetup /dev/loop8 ./test losetup: ./test: failed to set up loop device: Device or resource busy Possibly as a result of this patch: https://lore.kernel.org/lkml/20221208200605.756287-1-isaacmanjar...@google.com/T/ which was introduced in 5.15.0-68: http://launchpadlibrarian.net/653145495/linux_5.15.0-67.74_5.15.0-68.75.diff.gz On a machine prior to this change (no issue with losetup): # cat /sys/module/loop/parameters/max_loop 0 # uname -r 5.15.0-58-generic On a machine after the change (has losetup issue as described above): # cat /sys/module/loop/parameters/max_loop 8 # uname -r 5.15.0-69-generic So it looks like the default changed and the max amount of loop devices that can be created with mknod (not loop-control) is 8. If we set max_loop=0 on the kernel command line, it works as before. Cannot unload and reload module on a running system to change the parameter because it is built into the kernel. Another workaround is to use `losetup --find` but that means you cannot create with named devices created with mknod. To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2015400/+subscriptions -- Mailing list: https://launchpad.net/~kernel-packages Post to : kernel-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~kernel-packages More help : https://help.launchpad.net/ListHelp