Control: found -1 2.04-9
Control: tags -1 + patch
Control: retitle -1 grub-pc: postinst inconsistently masks lvm2's "leaked fd" 
errors

Repros on current sid,
started seeing it since I switched this system to LVM.
Patch attached, derivation below.

-- >8 --
$ sudo strace -vs99999 -fo /tmp/ss dpkg-reconfigure grub-pc
Configuring grub-pc
-------------------

The following Linux command line was extracted from /etc/default/grub or the 
`kopt' parameter in GRUB Legacy's menu.lst. Please verify that it is correct, 
and modify it if
necessary. The command line is allowed to be empty.

Linux command line:

The following string will be used as Linux parameters for the default menu 
entry but not for the recovery mode.

Linux default command line:

The grub-pc package is being upgraded. This menu allows you to select which 
devices you'd like grub-install to be automatically run for, if any.

Running grub-install automatically is recommended in most situations, to 
prevent the installed GRUB core image from getting out of sync with GRUB 
modules or grub.cfg.

If you're unsure which drive is designated as boot drive by your BIOS, it is 
often a good idea to install GRUB to all of them.

Note: it is possible to install GRUB to partition boot records as well, and 
some appropriate partitions are offered here. However, this forces GRUB to use 
the blocklist
mechanism, which makes it less reliable, and therefore is not recommended.

  1. /dev/sda (120040 MB; WDC_WDS120G2G0A-00JH30)  3. /dev/sdb (120034 MB; 
BIOSTAR_S100-120GB)  5. /dev/dm-4 (134 MB; szarotka--lvm-boot)     7. none of 
the above
  2. /dev/sda2 (71761 MB; WDC_WDS120G2G0A-00JH30)  4. /dev/sdb2 (71761 MB; 
BIOSTAR_S100-120GB)  6. /dev/dm-14 (59055 MB; szarotka--lvm-root)

(Enter the items or ranges you want to select, separated by spaces.)

GRUB install devices: 1 3

Installing for i386-pc platform.
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15785: 
grub-install
Installation finished. No error reported.
Installing for i386-pc platform.
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
File descriptor 3 (pipe:[2596779]) leaked on vgs invocation. Parent PID 15896: 
grub-install
Installation finished. No error reported.
-- >8 --

And grepping for "File descriptor" in the strace yields a process which
has execed
  "vgs" "--options" "vg_uuid,pv_name" "--noheadings" "--separator" ":"

Reproing the execve() exactly didn't get me anywhere, but:
-- >8 --
# "vgs" "--options" "vg_uuid,pv_name" "--noheadings" "--separator" ":" 
3>/dev/null
File descriptor 3 (/dev/null) leaked on vgs invocation. Parent PID 17578: -bash
  6kfJYU-RSWR-UkIa-cJk2-rEzi-qhqh-VWBl67:/dev/sda2
  6kfJYU-RSWR-UkIa-cJk2-rEzi-qhqh-VWBl67:/dev/sdb2
-- >8 --

Bingo, as gamblers say.

Thus: where from? Grepping for variants in /var/lib/dpkg/info/ didn't
get me anywhere, but:
-- >8 --
$ sudo find / -xdev -path ~ -prune -o -type f -exec grep -F vg_uuid {} +
grep: /var/log/journal/adc518602b20465e982dd9c8266a32e3/user-1000.journal: 
binary file matches
/root/.bash_history:"vgs" "--options" "vg_uuid,pv_name" "--noheadings" 
"--separator" ":" 3>/dev/null
/etc/lvm/profile/lvmdbusd.profile:      
vgs_cols_full="vg_name,vg_uuid,vg_fmt,vg_size,vg_free,vg_sysid,vg_extent_size,vg_extent_count,vg_free_count,vg_profile,max_lv,max_pv,pv_count,lv_count,snap_count,vg_seqno,vg_mda_count,vg_mda_free,vg_mda_size,vg_mda_used_count,vg_attr,vg_tags"
/etc/lvm/profile/lvmdbusd.profile:      
pvs_cols_full="pv_name,pv_uuid,pv_fmt,pv_size,pv_free,pv_used,dev_size,pv_mda_size,pv_mda_free,pv_ba_start,pv_ba_size,pe_start,pv_pe_count,pv_pe_alloc_count,pv_attr,pv_tags,vg_name,vg_uuid"
/etc/lvm/profile/lvmdbusd.profile:      
lvs_cols_full="lv_uuid,lv_name,lv_path,lv_size,vg_name,pool_lv_uuid,pool_lv,origin_uuid,origin,data_percent,lv_attr,lv_tags,vg_uuid,lv_active,data_lv,metadata_lv,lv_parent,lv_role,lv_layout"
/etc/lvm/profile/command_profile_template.profile:      
vgs_cols_verbose="vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
/etc/lvm/lvm.conf:      # vgs_cols_verbose = 
"vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
grep: /usr/sbin/grub-install: binary file matches
grep: /usr/sbin/grub-mkdevicemap: binary file matches
grep: /usr/sbin/lvm: binary file matches
grep: /usr/sbin/grub-probe: binary file matches
grep: /usr/sbin/grub-macbless: binary file matches
grep: /usr/lib/grub/i386-pc/grub-bios-setup: binary file matches
grep: /usr/lib/x86_64-linux-gnux32/liblvm2cmd.so.2.03: binary file matches
/usr/share/bash-completion/completions/lvm:            COMPREPLY=($(compgen -W 
'vg_fmt vg_uuid vg_name vg_attr vg_size
/usr/share/doc/lvm2/lvmpolld_overview.txt:is full LV uuid (vg_uuid+lv_uuid) 
prefixed with LVM_SYSTEM_DIR if set by client.
grep: /usr/bin/grub-mount: binary file matches
grep: /usr/bin/grub-mkrescue: binary file matches
grep: /usr/bin/grub-editenv: binary file matches
grep: /usr/bin/grub-mkrelpath: binary file matches
grep: /usr/bin/grub-mklayout: binary file matches
grep: /usr/bin/grub-script-check: binary file matches
grep: /usr/bin/grub-mkpasswd-pbkdf2: binary file matches
grep: /usr/bin/grub-mkimage: binary file matches
grep: /usr/bin/grub-mkstandalone: binary file matches
grep: /usr/bin/grub-fstest: binary file matches
grep: /usr/bin/grub-mknetdir: binary file matches
grep: /usr/bin/grub-menulst2cfg: binary file matches
grep: /usr/bin/grub-mkfont: binary file matches
grep: /usr/bin/grub-syslinux2cfg: binary file matches
grep: /usr/bin/grub-file: binary file matches
grep: /usr/bin/grub-render-label: binary file matches
grep: /usr/bin/grub-glue-efi: binary file matches
$ sudo find / -xdev  -path /home/nabijaczleweli -prune -o -type f -exec grep 
-Fe --no-headings {} +
[sudo] password for nabijaczleweli:
grep: /var/log/journal/adc518602b20465e982dd9c8266a32e3/user-1000.journal: 
binary file matches
/usr/local/src/util-linux-2.36/Documentation/releases/v2.36-ReleaseNotes:   - 
fix man page --no-headings short option  [Karel Zak]

$ grep -a vg_uuid /bin/*grub* /sbin/*grub*
/sbin/grub-mkdevicemap:archelpgrub-core/fs/archelp.ctoo deep nesting of 
symlinksfile `%s' not foundvariable `%s' isn't setPartition %d starts from 
%llu%d,%dLooking for %s%s is a parent of %s%s starts from %lluopening the 
device %s%s is present%s is not presentGRUB_LEGACY_0_BASED_PARTITIONSdisk does 
not exist, so falling back to partition device %scannot find the partition of 
`%s'zpoolstatusYESZPOOL_VDEV_NAME_PATHNAMESTATEREADWRITECKSUMmirrormirror-%uraidz%uraidz1%uraidz2%uraidz3%uONLINE/dev/%s/dev/mapper/dev/root/dev/dm-vgs--optionsvg_uuid,pv_name--noheadings--separator/dev/mapper/
 %s %256s %256s %256s %256s %256scannot save the original directorychanging 
current directory to %scannot restore the original directoryfailed to get 
canonical path of `%s'/proc/self/mountinfo%d %d %u:%u %s %s%n - %s 
%sfuse.zfs/@%s/%s%s/%s@%sbtrfsautofside/scsi/rd/crs/ccciss/cetherd/eida/ci2o/hdmmcblkvdiskloopnvme/dev/mdmdadm--detail--exportMD_CONTAINER=Container
 of %s is %sMD_METADATA=imsm%s is imsmioctl RAID_VERSION error: %sioctl 
GET_DISK_INFO error: %smd%sMD_UUID=mduuid/%s,%smduuid/%sunsupported RAID 
version: %d.%dioctl GET_ARRAY_INFO error: %sunknown kind of RAID device 
`%s'invalid file name `%s'beyond the total sectorsDetecting %s...
-- >8 --

So it's in a grub object somewhere.

Thus, ^Zing in the middle of the spew:
-- >8 --
Snapshot of files open in process 6988 - bash 
/var/lib/dpkg/info/grub-pc.postinst configure 2.04-9
   FD TYPE    MODE DEVICE           SIZE     OFFSET       NODE  NAME
    0 FIFO    r    0xe                            0    2684070  pipe
    1 CHR     u    0x17                0          0          6  /dev/pts/3
    2 CHR     u    0x17                0          0          6  /dev/pts/3
    3 FIFO    w    0xe                            0    2684071  pipe
  255 REG     r    0xfe0e          26473      26189    1054434  
/var/lib/dpkg/info/grub-pc.postinst


Snapshot of files open in process 7549 - grub-install --target=i386-pc --force 
--no-floppy /dev/sda
   FD TYPE    MODE DEVICE           SIZE     OFFSET       NODE  NAME
    0 FIFO    r    0xe                            0    2684070  pipe
    1 CHR     u    0x17                0          0          6  /dev/pts/3
    2 CHR     u    0x17                0          0          6  /dev/pts/3
    3 FIFO    w    0xe                            0    2684071  pipe
    4 REG     r    0xfe0e        2394102    1048576     277557  
/usr/share/grub/unicode.pf2
    5 REG     w    0xfe04              0          0        866  
/boot/grub/fonts/unicode.pf2
-- >8 --

Bingo again, as they say. These are the same pipe, so I'm assuming this
is debconf IPC or something to that effect.

Thus, in /var/lib/dpkg/info/grub-pc.postinst:
-- >8 --

    # If grub.cfg has been generated, update it.
    if test -e /boot/grub/grub.cfg && ! running_in_container; then
      update-grub 3>&-
    fi
-- >8 --
which explicitly kills it, BUT:
-- >8 --
run_grub_install()
{
    if ! grub-install $@ ; then
        echo "Failed: grub-install $@" >&2
        echo "WARNING: Bootloader is not properly installed, system may not be 
bootable" >&2
    fi
}

          if $RET ; then
            # Create core.img (but do not risk writing to MBR).
            # Using grub-probe instead of "(hd0)" avoids (UUID=) hack slowness
            # in case /boot/grub is not on (hd0) in device.map.
            echo "Generating core.img" >&2
            grub-install --target=i386-pc --no-floppy --grub-setup=/bin/true 
"$(grub-probe -t drive /boot/grub)" > /dev/null


                        for i in `echo $RET | sed -e 's/, / /g'` ; do
              real_device="$(readlink -f "$i")"
              if grub-install --target=i386-pc --force --no-floppy $real_device 
; then   # this is the one I'm observing!
                # We just installed GRUB 2; then also generate grub.cfg.
                touch /boot/grub/grub.cfg
              else
                failed_devices="$failed_devices $real_device"
              fi
            done
-- >8 --

Which don't.
Adding 3>&- to the one I commented on silences the warnings.
Removing 3>&- from the update-grub call yields:
-- >8 --
GRUB install devices: 1 3

Installing for i386-pc platform.
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12537: 
grub-install
Installation finished. No error reported.
Installing for i386-pc platform.
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12628: 
grub-install
Installation finished. No error reported.
Generating grub configuration file ...
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 12993: 
/usr/sbin/grub-probe
Found linux image: /boot/vmlinuz-6.5.0-2-amd64
Found initrd image: /boot/initrd.img-6.5.0-2-amd64
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13166: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13221: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13272: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13326: 
/usr/sbin/grub-probe
Found linux image: /boot/vmlinuz-6.3.0-2-amd64
Found initrd image: /boot/initrd.img-6.3.0-2-amd64
Found linux image: /boot/vmlinuz-5.5.0-1-amd64
Found initrd image: /boot/initrd.img-5.5.0-1-amd64
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
File descriptor 3 (pipe:[2806686]) leaked on vgs invocation. Parent PID 13784: 
/usr/sbin/grub-probe
Adding Hurd...
done
-- >8 --

So this is also masking that.

A quick grep for "File descriptor" in src:lvm2 yielded:
-- >8 --
static void _close_descriptor(int fd, unsigned suppress_warnings,
                              const char *command, pid_t ppid,
                              const char *parent_cmdline)
{
        int r;
        const char *filename;

        /* Ignore bad file descriptors */
        if (!is_valid_fd(fd))
                return;

        if (!suppress_warnings)
                filename = _get_filename(fd);

        r = close(fd);
        if (suppress_warnings)
                return;

        if (!r)
                fprintf(stderr, "File descriptor %d (%s) leaked on "
                        "%s invocation.", fd, filename, command);
        else if (errno == EBADF)
                return;
        else
                fprintf(stderr, "Close failed on stray file descriptor "
                        "%d (%s): %s", fd, filename, strerror(errno));

        fprintf(stderr, " Parent PID %" PRIpid_t ": %s\n", ppid, 
parent_cmdline);
}

static int _close_stray_fds(const char *command, struct custom_fds *custom_fds)
{
#ifndef VALGRIND_POOL
        struct rlimit rlim;
        int fd;
        unsigned suppress_warnings = 0;
        pid_t ppid = getppid();
        const char *parent_cmdline = _get_cmdline(ppid);
        static const char _fd_dir[] = DEFAULT_PROC_DIR "/self/fd";
        struct dirent *dirent;
        DIR *d;

#ifdef HAVE_VALGRIND
        if (RUNNING_ON_VALGRIND) {
                log_debug("Skipping close of descriptors within valgrind 
execution.");
                return 1;
        }
#endif

        if (getenv("LVM_SUPPRESS_FD_WARNINGS"))
                suppress_warnings = 1;

        if (!(d = opendir(_fd_dir))) {
tools/lvmcmdline.c lines 3498-3550/3839 byte 95587/102808 93%  (press RETURN)
-- >8 --

In which the same screen in less (a) confirms what's happening,
and (b) presents the solution.

/Why/ exactly lvm2 programs decide to complain about files they got from
the environment and didn't use is beyond me, since that appears like a
lot of code to complain about nothing, but doesn't really matter here.

Adding
  export LVM_SUPPRESS_FD_WARNINGS=yes
to the head of the postinst script yielded
-- >8 --
GRUB install devices: 1 3

Installing for i386-pc platform.
Installation finished. No error reported.
Installing for i386-pc platform.
Installation finished. No error reported.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.5.0-2-amd64
Found initrd image: /boot/initrd.img-6.5.0-2-amd64
Found linux image: /boot/vmlinuz-6.3.0-2-amd64
Found initrd image: /boot/initrd.img-6.3.0-2-amd64
Found linux image: /boot/vmlinuz-5.5.0-1-amd64
Found initrd image: /boot/initrd.img-5.5.0-1-amd64
Adding Hurd...
done
-- >8 --
which is what I'm used to seeing since pre-LVM.

The attached patch does both of the changes I described.

Best,
наб
diff -ru grub2-2.12~rc1.orig/debian/postinst.in grub2-2.12~rc1/debian/postinst.in
--- grub2-2.12~rc1.orig/debian/postinst.in	2023-10-02 15:55:25.000000000 +0200
+++ grub2-2.12~rc1/debian/postinst.in	2023-10-21 19:49:25.813638164 +0200
@@ -1,5 +1,6 @@
 #!/bin/bash
 set -e
+export LVM_SUPPRESS_FD_WARNINGS=yes
 
 # Apply a sed expression using extended regular expressions in place to a
 # file, if it exists.  The file is the first argument in order to work
@@ -787,7 +788,7 @@
 
     # If grub.cfg has been generated, update it.
     if test -e /boot/grub/grub.cfg && ! running_in_container; then
-      update-grub 3>&-
+      update-grub
     fi
   ;;
   abort-upgrade|abort-remove|abort-deconfigure)

Attachment: signature.asc
Description: PGP signature

Reply via email to