TL;DR: Regression in 3cef9aa17bf7dac59095b6972454c049a5fe97c0 confirmed.

Cyril Brulebois <[email protected]> (2026-07-04):
> Looking at the changes between v6.12.90 and v6.12.94, the following one
> seems pretty plausible:
>   
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=3cef9aa17bf7dac59095b6972454c049a5fe97c0
> 
> backported from:
>   
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=267ec4d7223a783f029a980f41b93c39b17996da
> 
> From a quick look at loop.c in v6.12.94, the code mentioned in the
> commit message looks like it's in place, so if the regression is
> confirmed to come from this commit (which I'm not certain of yet), it
> shouldn't be caused by assumptions valid in the master branch but not in
> the stable branch.
> 
> Next steps for me (in no particular order):
>  - find a minimal reproducer;
>  - check what happens with a recent mainline kernel (e.g.
>    7.0.12-2~bpo13+1);
>  - check what happens with v6.12.94 once that commit is reverted.

Building a 6.12.94-2 version with just that patch reverted, deploying
the resulting linux-image-6.12.94+deb13.1-amd64-unsigned package, and
building a system image leaves the system in a consistent state again:

    root@iot-isobuilder-54:~# find /sys/ -name loop0'*'|sort
    /sys/block/loop0
    /sys/class/block/loop0
    /sys/devices/virtual/block/loop0
    /sys/kernel/debug/block/loop0

(i.e. no more extraneous loop0pX.)

Toying with a fresh file doesn't bring back remnants from the image
build:

    root@iot-isobuilder-54:~# fallocate -l 1G foo.img
    root@iot-isobuilder-54:~# kpartx -asv foo.img
    root@iot-isobuilder-54:~# lsblk
    NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    loop0    7:0    0    1G  0 loop 
    sda      8:0    0   20G  0 disk 
    ├─sda1   8:1    0 18.9G  0 part /
    ├─sda2   8:2    0    1K  0 part 
    └─sda5   8:5    0  1.1G  0 part [SWAP]

Cleaning this up, and partitioning also gives the expected brand new
partitions (2 × ~500M):

    root@iot-isobuilder-54:~# kpartx -dsv foo.img
    loop deleted : /dev/loop0
    root@iot-isobuilder-54:~# fdisk /dev/foo.img
    […]
    root@iot-isobuilder-54:~# kpartx -asv foo.img
    add map loop0p1 (253:2): 0 1024000 linear 7:0 2048
    add map loop0p2 (253:3): 0 1071104 linear 7:0 1026048
    root@iot-isobuilder-54:~# lsblk
    NAME      MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
    loop0       7:0    0    1G  0 loop 
    ├─loop0p1 253:0    0  500M  0 part 
    └─loop0p2 253:1    0  523M  0 part 
    sda         8:0    0   20G  0 disk
    ├─sda1      8:1    0 18.9G  0 part /
    ├─sda2      8:2    0    1K  0 part
    └─sda5      8:5    0  1.1G  0 part [SWAP]

And finally, a second system image build succeeds again, as there are no
duplicates that trigger the safeguard's exit condition.


Cheers,
-- 
Cyril Brulebois ([email protected])            <https://debamax.com/>
D-I release manager -- Release team member -- Freelance Consultant

Attachment: signature.asc
Description: PGP signature

Reply via email to