Bug#1114972: grub-efi-amd64-bin: crossing a btrfs subvolume boundary keeps reference forever in trixie

Marc Lehmann debian-reportbug at plan9.de
Fri Sep 12 11:20:50 BST 2025


Package: grub-efi-amd64-bin
Version: 2.12-9
Severity: normal
X-Debbugs-Cc: debian-amd64 at lists.debian.org
User: debian-amd64 at lists.debian.org
Usertags: amd64

Dear Maintainer,

I have a custom grub config that probes various devices and filesysstem
images. It works something like this:

   if loopback loop4 ($datadev)/osimg/ubuntu.raw; then
      
      for kernel in (loop4)/ubuntu/boot/vmlinuz-*; do
         regexp -s version '\(loop4\)/ubuntu/boot/vmlinuz-(.*)' "$kernel"
         menuentry "ubuntu $version" "$version" {
            ...
         }
      done
      
      loopback -d loop4
   fi

This stopped working after upgrading from bookworm to trixie, because the loop device cannot
be deleted anymore, grub complains "error: device still referenced"

I have a minimal reproducer. On my setup, something like this triggers the bug:

   loopback loop5 btrfs.img
      
   for boot in (loop5)/subvolume/boot; do # <-- here it happens
      echo hi
   done
   
   loopback -d loop5 # <-- fails

While this does not:

   loopback loop5 btrfs.img
      
   for boot in (loop5)/boot; do # <--- works, boot is not a subvolume
      echo hi
   done
   
   loopback -d loop5 # <-- succeeds

I.e. simply expanding a glob seems to trigger it, but only if it crosses a
subvolumne boundary.

At least, this seems to be the case after some experimenting, I haven't
verified it.

-- System Information:
Debian Release: 13.0
  APT prefers stable-updates
  APT policy: (990, 'stable-updates'), (990, 'stable-security'), (990, 'stable'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'oldoldstable-debug'), (500, 'unstable'), (500, 'testing'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386, x32

Kernel: Linux 6.12.41+deb13-amd64 (SMP w/28 CPU threads; PREEMPT)
Kernel taint flags: TAINT_USER, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_IE.UTF-8, LC_CTYPE=en_IE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages grub-efi-amd64-bin depends on:
ii  grub-common              2.12-9
ii  grub-efi-amd64-unsigned  2.12-9

Versions of packages grub-efi-amd64-bin recommends:
ii  efibootmgr             18-2
ii  grub-efi-amd64-signed  1+2.12+9

grub-efi-amd64-bin suggests no packages.

-- no debconf information



More information about the Pkg-grub-devel mailing list