Gentoo Archives: gentoo-commits

From: Ben Kohler <bkohler@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
Date: Fri, 08 Oct 2021 11:12:42
Message-Id: 1633691541.84564ed5e8df1bf6240aa2b5401562ff81e27081.bkohler@gentoo
1 commit: 84564ed5e8df1bf6240aa2b5401562ff81e27081
2 Author: Peter Levine <plevine457 <AT> gmail <DOT> com>
3 AuthorDate: Fri Oct 8 01:46:36 2021 +0000
4 Commit: Ben Kohler <bkohler <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 8 11:12:21 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84564ed5
7
8 sys-boot/os-prober: fix os-prober in chroot and no mounted /run/udev
9
10 When /run/udev isn't mounted or udev isn't available, fallback to blkid.
11
12 Bug: https://bugs.gentoo.org/761475
13 Package-Manager: Portage-3.0.26, Repoman-3.0.3
14 Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
15 Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>
16
17 .../os-prober-1.79-efi-chroot-blkid-fallback.patch | 24 ++++++++++++++++++++++
18 sys-boot/os-prober/os-prober-9999.ebuild | 3 +--
19 2 files changed, 25 insertions(+), 2 deletions(-)
20
21 diff --git a/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch b/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch
22 new file mode 100644
23 index 00000000000..b5b90b2214d
24 --- /dev/null
25 +++ b/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch
26 @@ -0,0 +1,24 @@
27 +Fixes missing entries when os-prober is run in a chroot environment by falling back
28 +to blkid if udev isn't available or if /run/udev isn't bind mounted. Modified from
29 +https://build.opensuse.org/package/view_file/Base:System/os-prober/os-prober-05efi-blkid.patch?rev=103
30 +
31 +Bug: https://bugs.gentoo.org/761475
32 + https://bugzilla.opensuse.org/1076779
33 +
34 +--- a/os-probes/mounted/x86/05efi
35 ++++ b/os-probes/mounted/x86/05efi
36 +@@ -46,6 +46,14 @@ if type udevinfo > /dev/null 2>&1; then
37 + fi
38 +
39 + eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')"
40 ++
41 ++ # udev may not work in chroot as its db may not be there, bailout that by blkid (bsc#1076779)
42 ++ if [ -z "$ID_PART_ENTRY_TYPE" -a -z "$ID_PART_ENTRY_SCHEME" ] &&
43 ++ type blkid > /dev/null 2>&1; then
44 ++ debug "fallback to blkid"
45 ++ eval "$(blkid -p -o udev "$partition" | grep -E '^(ID_PART_ENTRY_(TYPE|SCHEME))=')"
46 ++ fi
47 ++
48 + debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME"
49 + debug "$partition partition type is $ID_PART_ENTRY_TYPE"
50 +
51
52 diff --git a/sys-boot/os-prober/os-prober-9999.ebuild b/sys-boot/os-prober/os-prober-9999.ebuild
53 index 4c80110b806..c854d403e4f 100644
54 --- a/sys-boot/os-prober/os-prober-9999.ebuild
55 +++ b/sys-boot/os-prober/os-prober-9999.ebuild
56 @@ -31,14 +31,13 @@ PATCHES=(
57 "${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
58 "${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
59 "${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
60 + "${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
61 )
62
63 DOC_CONTENTS="
64 If you intend for os-prober to detect versions of Windows installed on
65 NTFS-formatted partitions, your system must be capable of reading the
66 NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
67 - Also, in a chroot environment, it is necessary to bind mount /run/udev
68 - (see https://wiki.gentoo.org/wiki/GRUB2#os-prober_and_UEFI_in_chroot).
69
70 NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
71 To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.