Skip to content

Add os-prober option for GRUB to detect other operating systems - #4697

Open
VictorZaca wants to merge 6 commits into
archlinux:masterfrom
VictorZaca:grub-os-prober
Open

Add os-prober option for GRUB to detect other operating systems#4697
VictorZaca wants to merge 6 commits into
archlinux:masterfrom
VictorZaca:grub-os-prober

Conversation

@VictorZaca

Copy link
Copy Markdown

Description

archinstall currently offers no way to enable dual boot detection: users installing alongside Windows have to install os-prober, set GRUB_DISABLE_OS_PROBER=false and re-run grub-mkconfig manually after the installation (see e.g. #2542).

This adds an opt-in os_prober boolean 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:

  • pacstraps os-prober and fuse3 — fuse3 provides grub-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 skipped
  • sets GRUB_DISABLE_OS_PROBER=false in /etc/default/grub before the existing grub-mkconfig run, so detected systems show up in the GRUB menu on first boot

The 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": true inside bootloader_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

  • Unit tests, ruff, flake8, mypy (strict) and the locales check pass; base.pot regenerated for the three new strings
  • E2E in QEMU/OVMF with two disks: GRUB + os_prober: true and a Windows-style ESP (EFI/Microsoft/Boot/bootmgfw.efi) on a second, unmounted disk -> grub.cfg gains menuentry 'Windows Boot Manager (on /dev/sda1)', /etc/default/grub ends up with exactly one uncommented GRUB_DISABLE_OS_PROBER=false, and the GRUB menu shows both entries after reboot
  • Negative E2E: same disks with os_prober: false -> no Windows entry, /etc/default/grub untouched, os-prober/fuse3 not installed
  • TUI: the option greys out and is forced off when switching to a non-GRUB bootloader; switching back to GRUB re-enables the item without silently turning the value back on

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.
@VictorZaca
VictorZaca requested a review from Torxed as a code owner August 5, 2026 18:10
Copilot AI lite review requested due to automatic review settings August 5, 2026 18:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 BootloaderConfiguration with os_prober and expose it via JSON parsing/serialization and summaries.
  • Update the GRUB installation path to optionally install os-prober/fuse3 and set GRUB_DISABLE_OS_PROBER=false before generating grub.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}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Grub and os-prober option (for dual boot)

2 participants