Add os-prober option for GRUB to detect other operating systems - #4697
Add os-prober option for GRUB to detect other operating systems#4697VictorZaca wants to merge 7 commits into
Conversation
Introduce an os_prober flag on BootloaderConfiguration, defaulting to false to match the upstream GRUB default of shipping os-prober disabled. Bootloader.has_os_prober_support() limits the option to GRUB, the only supported bootloader that consumes os-prober output.
When the os_prober option is set, install the os-prober package and set GRUB_DISABLE_OS_PROBER=false in /etc/default/grub so that grub-mkconfig detects other operating systems such as Windows. The edit runs for both the UKI and non-UKI paths and handles configs where the option is commented out, set to another value or missing entirely. Like the uki and removable options, an unsupported combination is downgraded with a warning instead of failing the installation.
Expose the os_prober option in the bootloader submenu. The item is only enabled when GRUB is selected and is reset when switching to a bootloader without os-prober support, mirroring the uki and removable handling. Regenerate the translation template for the new strings.
Cover os_prober in the config fixture and parsing assertions, and document the new key in the config options table and sample configs.
Since version 1.77 os-prober probes unmounted partitions exclusively through grub-mount and silently skips them when it cannot run. The grub package ships grub-mount but only lists fuse3 as an optional dependency, so without it os-prober is limited to already-mounted partitions and misses the common dual-boot case of Windows living on another disk. Installing fuse3 also lets grub-mount read NTFS in userspace, keeping detection independent of kernel filesystem modules inside the installation chroot.
The os-prober block straps packages and edits /etc/default/grub without leaving any trace in the install log. Add a debug marker, matching the logging convention of the surrounding bootloader steps.
Reuse the existing 'Detect other operating systems' msgid so the preview matches the menu item label and stays localizable, like the neighbouring Removable and Plymouth labels. Suggested in PR review.
|
Think this is a good idea, could close the gap with dual boot the easier way |
|
What about this #266 (comment)? Is that no longer relevant? |
|
I'm hoping they closed many of the withstanding CVEs since that convo is from 2021, perhaps there is a bug tracker to check... Also would stay optional default to off |
|
I went and read the history on this, because I'd assumed the same thing. The 2.06 change doesn't actually cite any CVE. The commit is e346414, and it credits a report from NyankoSec/SSD that was a command injection in grub-mkconfig (it copies linux/initrd lines out of a foreign grub.cfg without parsing them). That one never got a number. The March 2021 CVEs are in grub's own boot code, acpi/cutmem/rmmod and the parsers, not os-prober. I'm not going to claim it's fixed, though. os-prober reads foreign filesystems through grub's own FS drivers, and those keep producing CVEs. So the concern is real, it's just not the one in that comment. The line upstream added to the manual is that it's disabled by default "since automatic and silent execution of os-prober, and creating boot entries based on that data, is a potential attack vector". The objection is to it running on its own without the user knowing, and the same commit says "downstream vendors, who really want os-prober to be enabled out of the box in their relevant products, easily revert to it's old behavior". Here it's off by default, the option only appears if you've picked grub, and nothing gets installed or written unless you turn it on. If you want the prompt to say outright that it reads other partitions' filesystems, I'll add it. |
Description
archinstall currently offers no way to enable dual boot detection: users installing alongside Windows have to install
os-prober, setGRUB_DISABLE_OS_PROBER=falseand re-rungrub-mkconfigmanually after the installation (see e.g. #2542).This adds an opt-in
os_proberboolean to the bootloader configuration. It defaults to off, matching GRUB upstream, which ships os-prober disabled since 2.06 for security reasons — enabling it is an explicit user choice. When enabled together with GRUB, the installer:os-proberandfuse3— fuse3 providesgrub-mount, which os-prober relies on exclusively (since os-prober 1.77) to probe partitions that are not mounted, e.g. Windows on another disk; without it those partitions are silently skippedGRUB_DISABLE_OS_PROBER=falsein/etc/default/grubbefore the existinggrub-mkconfigrun, so detected systems show up in the GRUB menu on first bootThe TUI gets a "Detect other operating systems" toggle in the bootloader submenu, disabled for bootloaders other than GRUB, following the existing uki/removable pattern. Via config file:
"os_prober": trueinsidebootloader_config. Works on both UEFI and BIOS. If a config combines it with a non-GRUB bootloader, the option is ignored with a warning, like the other bootloader options.Closes #266
Testing
base.potregenerated for the three new stringsos_prober: trueand a Windows-style ESP (EFI/Microsoft/Boot/bootmgfw.efi) on a second, unmounted disk ->grub.cfggainsmenuentry 'Windows Boot Manager (on /dev/sda1)',/etc/default/grubends up with exactly one uncommentedGRUB_DISABLE_OS_PROBER=false, and the GRUB menu shows both entries after rebootos_prober: false-> no Windows entry,/etc/default/grubuntouched, os-prober/fuse3 not installed