public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ben Kohler" <bkohler@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/
Date: Fri,  8 Oct 2021 11:12:34 +0000 (UTC)	[thread overview]
Message-ID: <1633691541.84564ed5e8df1bf6240aa2b5401562ff81e27081.bkohler@gentoo> (raw)

commit:     84564ed5e8df1bf6240aa2b5401562ff81e27081
Author:     Peter Levine <plevine457 <AT> gmail <DOT> com>
AuthorDate: Fri Oct  8 01:46:36 2021 +0000
Commit:     Ben Kohler <bkohler <AT> gentoo <DOT> org>
CommitDate: Fri Oct  8 11:12:21 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84564ed5

sys-boot/os-prober: fix os-prober in chroot and no mounted /run/udev

When /run/udev isn't mounted or udev isn't available, fallback to blkid.

Bug: https://bugs.gentoo.org/761475
Package-Manager: Portage-3.0.26, Repoman-3.0.3
Signed-off-by: Peter Levine <plevine457 <AT> gmail.com>
Signed-off-by: Ben Kohler <bkohler <AT> gentoo.org>

 .../os-prober-1.79-efi-chroot-blkid-fallback.patch | 24 ++++++++++++++++++++++
 sys-boot/os-prober/os-prober-9999.ebuild           |  3 +--
 2 files changed, 25 insertions(+), 2 deletions(-)

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
new file mode 100644
index 00000000000..b5b90b2214d
--- /dev/null
+++ b/sys-boot/os-prober/files/os-prober-1.79-efi-chroot-blkid-fallback.patch
@@ -0,0 +1,24 @@
+Fixes missing entries when os-prober is run in a chroot environment by falling back
+to blkid if udev isn't available or if /run/udev isn't bind mounted. Modified from
+https://build.opensuse.org/package/view_file/Base:System/os-prober/os-prober-05efi-blkid.patch?rev=103
+
+Bug: https://bugs.gentoo.org/761475
+     https://bugzilla.opensuse.org/1076779
+
+--- a/os-probes/mounted/x86/05efi
++++ b/os-probes/mounted/x86/05efi
+@@ -46,6 +46,14 @@ if type udevinfo > /dev/null 2>&1; then
+ 	fi
+ 
+ 	eval "$(udevinfo -q property -n "$partition" | grep -E '^ID_PART_ENTRY_(TYPE|SCHEME)=')"
++
++	# udev may not work in chroot as its db may not be there, bailout that by blkid (bsc#1076779)
++	if [ -z "$ID_PART_ENTRY_TYPE" -a -z "$ID_PART_ENTRY_SCHEME" ] &&
++		type blkid > /dev/null 2>&1; then
++		debug "fallback to blkid"
++		eval "$(blkid -p -o udev "$partition" | grep -E '^(ID_PART_ENTRY_(TYPE|SCHEME))=')"
++	fi
++
+ 	debug "$partition partition scheme is $ID_PART_ENTRY_SCHEME"
+ 	debug "$partition partition type is $ID_PART_ENTRY_TYPE"
+ 

diff --git a/sys-boot/os-prober/os-prober-9999.ebuild b/sys-boot/os-prober/os-prober-9999.ebuild
index 4c80110b806..c854d403e4f 100644
--- a/sys-boot/os-prober/os-prober-9999.ebuild
+++ b/sys-boot/os-prober/os-prober-9999.ebuild
@@ -31,14 +31,13 @@ PATCHES=(
 	"${FILESDIR}"/${PN}-1.79-use-fstab-name.patch
 	"${FILESDIR}"/${PN}-1.79-mounted-boot-partition-fix.patch
 	"${FILESDIR}"/${PN}-1.79-fix-busy-umount-message.patch
+	"${FILESDIR}"/${PN}-1.79-efi-chroot-blkid-fallback.patch
 )
 
 DOC_CONTENTS="
 	If you intend for os-prober to detect versions of Windows installed on
 	NTFS-formatted partitions, your system must be capable of reading the
 	NTFS filesystem. One way to do this is by installing sys-fs/ntfs3g.
-	Also, in a chroot environment, it is necessary to bind mount /run/udev
-	(see https://wiki.gentoo.org/wiki/GRUB2#os-prober_and_UEFI_in_chroot).
 
 	NOTE: Since sys-boot/grub-2.06-rc1, grub-mkconfig disables os-prober by default.
 	To enable it, add GRUB_DISABLE_OS_PROBER=false to /etc/default/grub.


             reply	other threads:[~2021-10-08 11:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-08 11:12 Ben Kohler [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-14 14:18 [gentoo-commits] repo/gentoo:master commit in: sys-boot/os-prober/, sys-boot/os-prober/files/ Ben Kohler
2024-05-21 15:50 Ben Kohler
2024-05-08 16:43 Ben Kohler
2023-02-16 13:55 Ben Kohler
2021-10-08 11:12 Ben Kohler
2021-10-08 11:12 Ben Kohler
2021-10-08 11:12 Ben Kohler
2021-10-08 11:12 Ben Kohler
2017-12-26 12:53 Pacho Ramos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1633691541.84564ed5e8df1bf6240aa2b5401562ff81e27081.bkohler@gentoo \
    --to=bkohler@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox