Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 761475 - sys-boot/os-prober-1.77 relying on non-existant output from udevadm
Summary: sys-boot/os-prober-1.77 relying on non-existant output from udevadm
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal critical
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords: PullRequest
Depends on:
Blocks:
 
Reported: 2020-12-24 07:02 UTC by dan
Modified: 2021-10-08 11:12 UTC (History)
4 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dan 2020-12-24 07:02:16 UTC
os-prober is intended to help the user locate other OS's and grub-mkconfig calls it when it runs (the level 30 script). However, it WILL FAIL to find a Windows EFI partition because it looks for output from udevadm that will never be produced. Specifically:
05efi in /usr/lib/os-probes/mounted excepts udevadm info -q property -n <part> to return ID_PART_ENTRY_TYPE and ID_PART_ENTRY_SCHEME

Actual output of udevadm info -q property -n /dev/sda1 (my EFI partition): 
DEVPATH=/devices/pci0000:00/0000:00:1f.2/ata1/host0/target0:0:0/0:0:0:0/block/sda/sda1
DEVNAME=/dev/sda1
DEVTYPE=partition
PARTN=1
PARTNAME=EFI system partition
MAJOR=8
MINOR=1
SUBSYSTEM=block

Result: ID_PART_ENTRY_TYPE and ID_PART_TYPE_SCHEME are both not present, thus 05efi does not recognize partition as EFI partition

From log (with some debugging output added by me to help trace the error):
Dec 23 15:21:11 livecd 05efi[20142]: debug: calling udevadm info -q property -n "/dev/sda1"
Dec 23 15:21:11 livecd 05efi[20147]: debug: /dev/sda1 partition scheme is
Dec 23 15:21:11 livecd 05efi[20148]: debug: /dev/sda1 partition type is
Comment 1 Jonas Stein gentoo-dev 2020-12-24 12:52:58 UTC
Does this mean this package is totally unusable right now?
Comment 2 dan 2020-12-24 19:05:03 UTC
I'd personally go so far as to mask it in the portage tree. At least until someone can fix it. I'd almost be willing to do it myself except I'm not quite in a position to do so. 

Still, I'll do some browsing and if I can come up with some kind of fix, I'll post it here.
Comment 3 jeremy mills 2020-12-25 06:05:35 UTC
To the best of my knowledge this has never worked in a livecd or chroot environment. Which is what it looks like due to the "livecd" prompt. I can verify that it does work once you boot the actual system though. I've always had to run grub-mkconfig once booted into my install to get my windows partition to show up in grub. Maybe its due to udev not actually running inside the chroot...I don't know. When using lvm it'll toss a warning about lvmetad because lvm isn't running in the chroot so maybe...its a similar reason with udev.
Comment 4 Peter Levine 2021-03-25 03:14:57 UTC
The problem appears to be related to the lack of a --bind mounted /run/udev in the chrooted environment.  See https://wiki.gentoo.org/wiki/GRUB2#os-prober_and_UEFI_in_chroot.
Comment 5 Larry the Git Cow gentoo-dev 2021-03-26 17:44:49 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=cafa4c43d97fd9b6b12fa5a25fa82ef2a14304d8

commit cafa4c43d97fd9b6b12fa5a25fa82ef2a14304d8
Author:     Peter Levine <plevine457@gmail.com>
AuthorDate: 2021-03-25 01:35:28 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2021-03-26 17:44:38 +0000

    sys-boot/os-prober: Add new elog info
    
    Add a message about the necessity of bind mounting /run/udev. Also,
    warn about the defaulting of GRUB_DISABLE_OS_PROBER=true with
    grub-mkconfig.
    
    Closes: https://bugs.gentoo.org/761475
    Package-Manager: Portage-3.0.17, Repoman-3.0.2
    Signed-off-by: Peter Levine <plevine457@gmail.com>
    Signed-off-by: Ben Kohler <bkohler@gentoo.org>

 sys-boot/os-prober/os-prober-1.78.ebuild | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Comment 6 Larry the Git Cow gentoo-dev 2021-10-08 11:12:32 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=84564ed5e8df1bf6240aa2b5401562ff81e27081

commit 84564ed5e8df1bf6240aa2b5401562ff81e27081
Author:     Peter Levine <plevine457@gmail.com>
AuthorDate: 2021-10-08 01:46:36 +0000
Commit:     Ben Kohler <bkohler@gentoo.org>
CommitDate: 2021-10-08 11:12:21 +0000

    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@gmail.com>
    Signed-off-by: Ben Kohler <bkohler@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(-)