From 9ef55c91d0db97028c7d9a1debb9732be692e00a Mon Sep 17 00:00:00 2001 From: Dermot Bradley Date: Sat, 10 Sep 2022 16:17:05 +0100 Subject: [PATCH] main/grub: prevent harmless LVM related warnings Whenever grub-probe is run (by grub-mkconfig) and the root filesystem is on LVM then multiple warnings may be displayed: File descriptor 7 (socket:[24298]) leaked on vgs invocation. Parent PID 12489: /usr/sbin/grub-probe These warnings are harmless but annoying and may make users think there is an actual problem with their OS. If the environment variable LVM_SUPPRESS_FD_WARNINGS is set then grub-probe will not display these. This patch sets LVM_SUPPRESS_FD_WARNINGS when "vgs" is called, so preventing these harmless warnings appearing. --- main/grub/0013-prevent-vgs-warnings.patch | 37 +++++++++++++++++++++++ main/grub/APKBUILD | 4 ++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 main/grub/0013-prevent-vgs-warnings.patch diff --git a/main/grub/0013-prevent-vgs-warnings.patch b/main/grub/0013-prevent-vgs-warnings.patch new file mode 100644 index 00000000000..ebf125cbc43 --- /dev/null +++ b/main/grub/0013-prevent-vgs-warnings.patch @@ -0,0 +1,37 @@ +From: Dermot Bradley +Date: Tue, 6 Sep 2022 23:41:36 +0100 +Subject: [PATCH] prevent harmless LVM warnings from grub-probe + +Whenever grub-probe is run (by grub-mkconfig) and the root +filesystem is on LVM then multiple warnings may be displayed: + + File descriptor 7 (socket:[24298]) leaked on vgs invocation. + Parent PID 12489: /usr/sbin/grub-probe + +These warnings are harmless but annoying and may make users think +there is an actual problem with their OS. If the environment +variable LVM_SUPPRESS_FD_WARNINGS is set then grub-probe will not +display these. However in the described situation grub-probe is not +being called directly, but rather via grub-mkconfig and so this +patch simply prefixes grub-probe's call to 'vgs' with setting this +environment variable. + +I see numerous discussions of this "bug" across multiple distros +(e.g. Debian from 2008, Ubuntu from 2015) over the years and indeed +found two Grub bugs (39696 & 45279) regarding it (from 2013 & 2015) +but no attempt appears to have been made to resolve this upstream. + +--- + +diff -aur a/grub-core/osdep/unix/getroot.c b/grub-core/osdep/unix/getroot.c +--- a/grub-core/osdep/unix/getroot.c ++++ b/grub-core/osdep/unix/getroot.c +@@ -614,7 +614,7 @@ + /* by default PV name is left aligned in 10 character field, meaning that + we do not know where name ends. Using dummy --separator disables + alignment. We have a single field, so separator itself is not output */ +- argv[0] = "vgs"; ++ argv[0] = "LVM_SUPPRESS_FD_WARNINGS=1 vgs"; + argv[1] = "--options"; + if (vgid) + argv[2] = "vg_uuid,pv_name"; diff --git a/main/grub/APKBUILD b/main/grub/APKBUILD index cec4c2fc4e2..038f91e7d0f 100644 --- a/main/grub/APKBUILD +++ b/main/grub/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs pkgname=grub pkgver=2.06 -pkgrel=5 +pkgrel=6 pkgdesc="Bootloader with support for Linux, Multiboot and more" url="https://www.gnu.org/software/grub/" arch="all !s390x" @@ -54,6 +54,7 @@ source="https://ftp.gnu.org/gnu/grub/grub-$pkgver.tar.xz 0010-riscv-binutils-2.38.patch 0011-mkconfig-ignore-apk-new-files.patch 0012-remove-udevadm-usage.patch + 0013-prevent-vgs-warnings.patch " # secfixes: @@ -281,4 +282,5 @@ d4432a36286f0ad7d3527d34e20daf9fbef24d6037171582ae3ccdd51668ffe422b87d984f107a9b 4b8b5eeeb45dd9fddc9af9b6e694644470672b35af33cd11f1578f35503b08662c51f27c10bffeb96a51de0a879c741c0d22600410147eb20505efe1a3b50b54 0010-riscv-binutils-2.38.patch 229fe710de9fb106e08457a5a19dd3cc1746389ff1cdd95721b092913c51550fc8ad05141a23fc396a9e8dbbcec909920eda5f3eed339af9938774feb9e6c7bc 0011-mkconfig-ignore-apk-new-files.patch c6011ece89e55d92e351bdab3eae180d75fcde642865934800641d42969febebd3a29a68941a10ef42a0bdeae0069432f2bb31e42fa651263cdedc1b964d5b33 0012-remove-udevadm-usage.patch +979d02731f2ae1769aa80fc86fe5fd6e1f872a9d614491ca166d73151a0c9156c4636b986aed26d705f0dbe3ef6ad4d8ff623eddb190266c361aa43ebb563315 0013-prevent-vgs-warnings.patch "