Gentoo Archives: gentoo-user

From: Dutch Ingraham <stoa@×××.us>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] os-prober fails sucessfully
Date: Mon, 23 Mar 2020 13:16:34
Message-Id: d1613d89-4b93-7912-79dc-9858d9c8ea9b@gmx.us
In Reply to: Re: [gentoo-user] os-prober fails sucessfully by John Covici
1 On 3/17/20 9:00 PM, John Covici wrote:
2 > On Tue, 17 Mar 2020 19:23:53 -0400,
3 > Dutch Ingraham wrote:
4 >>
5 >> On 3/17/20 4:16 AM, Neil Bothwick wrote:
6 >>> On Tue, 17 Mar 2020 03:00:59 -0500, Dutch Ingraham wrote:
7 >>>
8 >>>> Also from [1], with emphasis added "30_os-prober this script uses
9 >>>> **os-prober to search for Linux** and other operating systems and places
10 >>>> the results in the GRUB 2 menu.
11 >>>>
12 >>>> A review of the scripts 10_linux and 30_os-prober supplied by Gentoo
13 >>>> with the grub and os-prober packages seems to confirm the Ubuntu
14 >>>> documentation's accuracy.
15 >>>>
16 >>>> Regardless of which script is responsible, the problem remains that
17 >>>> running 'grub-mkconfig -o /boot/grub/grub.cfg' under the circumstances
18 >>>> outlined in my original post should find the other Linux operating
19 >>>> systems, but doesn't.
20 >>>
21 >>> You're right, either things have changed since the days I used GRUB
22 >>> extensively or I am losing it. No, that's not a multiple choice question!
23 >>
24 >> Well, you wouldn't be the first to begin losing it! I sent the original
25 >> question before running things through strace, so.... (It wasn't
26 >> particularly helpful.)
27 >>>
28 >>> Have you tried running the script with "sh -x" to see just what it is
29 >>> doing?
30 >>
31 >> It calls a helper script and exits successfully.
32 >>
33 >> I wonder if it could be this part
34 >>>
35 >>> if ! command -v os-prober > /dev/null || ! command -v linux-boot-prober >/dev/null ; then
36 >>> # missing os-prober and/or linux-boot-prober
37 >>> exit 0
38 >>> fi
39 >>
40 >> Running `command -v os-prober' returns '/usr/bin/os-prober'
41 >>>
42 >>> If the os-prober command is missing the script will fail successfully, as
43 >>> you experience. Is sys-boot/os-prober installed?
44 >>>
45 >>>
46 >> Yes, it is installed as noted above, and, if I mount the partitions
47 >> manually, os-prober will find them.
48 >>
49 >>
50 >> I'm fairly certain I am missing one open and obvious thing, but can't
51 >> see it. Here is a list of things I have tried, mainly for
52 >> thread-completeness purposes:
53 >>
54 >> 1. Removed grub and op-prober packages then wiped all residual config files.
55 >>
56 >> 2. Reinstalled both, enabling the 'mount' use flag on grub.
57 >>
58 >> 3. Confirmed /usr/bin/os-prober and all /etc/grub.d/{scripts} are in
59 >> place and executable.
60 >>
61 >> 4. Even though it is the default, added GRUB_DISABLE_OS_PROBER=false to
62 >> /etc/default/grub.
63 >>
64 >> 5. Even though it is the default, set GRUB_PLATFORMS="pc" in make.conf.
65 >>
66 >>
67 >> On a fairly routine set-up (MBR/BIOS with four ext4 primary partitions)
68 >> I should be able to just set the mount use flag on grub, install grub
69 >> and os-prober, run 'grub-mkconfig -o /boot/grub/grub.cfg' and it should
70 >> just detect all operating systems and write the config, right? RIGHT?
71 >>
72 >>
73 >
74 > Are you sure its supposed to detect them even if they are not mounted?
75 > How would they be able to look at the files? Where are the image
76 > files on these partitions?
77 >
78
79 Those are good questions. As far as I have seen, distributions act in
80 one of three different ways:
81
82 1. Patch grub/os-prober in such a way that all operating systems
83 are detected rapidly, but not necessarily accurately. OpenSuSE works
84 this way, and can find 8 operating systems spread across two SSDs in
85 less than 10 seconds, albeit sometimes older kernels are listed as the
86 default for any given OS. No manual mounting of OSs is necessary.
87
88 2. Patch grub/os-prober in such a way that all operating systems
89 are detected very slowly but accurately. The Debians/Ubuntus and Fedora
90 work this way, but take up to five minutes to complete on a two-SSD
91 system. No manual mounting of OSs is necessary.
92
93 3. Vanilla grub/os-prober. Manual mounting of all OSs is required.
94 Arch Linux works this way. See
95 https://wiki.archlinux.org/index.php/GRUB#Detecting_other_operating_systems
96 .
97
98 I'm assuming 1 & 2 above are patched only anecdotally. There could be
99 something totally distinct happening.
100
101 The os-prober code itself, at least Gentoo's version, seems to indicate
102 it should find other OSs without manual mounting, as the code comments
103 and commands like lsblk, blkid, and mount would serve no other obvious
104 purpose.
105
106 Unfortunately I don't have the time right now to do a proper analysis of
107 the code from 1, 2, and 3 above against Gentoo's, so I suppose manually
108 mounting will have to suffice.