Skip to content

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

Open
VictorZaca wants to merge 7 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 7 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

This comment was marked as spam.

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.
@h8d13

h8d13 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Think this is a good idea, could close the gap with dual boot the easier way

@codefiles

Copy link
Copy Markdown
Contributor

What about this #266 (comment)? Is that no longer relevant?

@h8d13

h8d13 commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

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

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)

4 participants