Add os-prober option for GRUB to detect other operating systems - #4697
Open
VictorZaca wants to merge 6 commits into
Open
Add os-prober option for GRUB to detect other operating systems#4697VictorZaca wants to merge 6 commits into
VictorZaca wants to merge 6 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.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an opt-in os_prober boolean to the bootloader configuration to allow GRUB installations to detect other operating systems (e.g., Windows) during the initial grub-mkconfig run, while keeping the default behavior aligned with upstream GRUB (disabled).
Changes:
- Extend
BootloaderConfigurationwithos_proberand expose it via JSON parsing/serialization and summaries. - Update the GRUB installation path to optionally install
os-prober/fuse3and setGRUB_DISABLE_OS_PROBER=falsebefore generatinggrub.cfg. - Add a TUI toggle plus documentation, examples, test fixtures, and locale strings for the new option.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/test_args.py | Updates config parsing expectation to include os_prober. |
| tests/data/test_config.json | Adds os_prober to the test config fixture. |
| examples/config-sample.json | Documents os_prober in the sample config (default off). |
| docs/installing/guided.rst | Updates guided install example JSON to include os_prober. |
| docs/cli_parameters/config/config_options.csv | Documents os_prober within bootloader_config options. |
| archinstall/scripts/guided.py | Passes os_prober from config into Installation.add_bootloader(). |
| archinstall/locales/base.pot | Adds translation keys for the new TUI strings and regenerated catalog ordering. |
| archinstall/lib/models/bootloader.py | Adds os_prober model field + support check + preview output. |
| archinstall/lib/installer.py | Implements opt-in os-prober enablement for GRUB and validates option by bootloader. |
| archinstall/lib/bootloader/bootloader_menu.py | Adds the “Detect other operating systems” toggle, enabled only for GRUB. |
| os_prober_string = tr('Enabled') | ||
| else: | ||
| os_prober_string = tr('Disabled') | ||
| text += f'os-prober: {os_prober_string}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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