Yahoo
Advertisement
Advertisement
Advertisement
Advertisement

GRUB not detecting Windows: How to fix

The GRUB2 boot loader on a laptop screen with Ubuntu as an option.
Jordan Gloor / How-To Geek

If you recently set up a dual boot configuration with Windows and Linux, you might have run into the same problem I did: Windows not showing up as an option in the GRUB menu. I'll show you how I solved it (and the technical reason behind it).

To be more specific, I installed CachyOS on a drive separate from my Windows 11 drive. I'd installed various Linux distributions on this drive several times now, and the boot menu typically just works. My Windows 11 boot option would show up without any effort from me. In this instance, though, it took a few extra steps to make it work.

If when you start up your PC you don't see any boot menu at all, you'll need to first learn how to make your GRUB menu appear .

Why Windows isn't showing up in GRUB

As it turns out, GRUB installations nowadays often come with os-prober disabled, and that was the reason Windows wasn't appearing. If you're not in the know, os-prober is a package that allows GRUB to automatically identify other operating systems installed on your PC. When it's disabled, GRUB won't be able to identify Windows without manual intervention.

Advertisement
Advertisement

The reason for this is a mistrust of the os-prober package. Distribution developers packaging GRUB have been opting to disable os-prober as a security precaution as far back as 2021, when Canonical developer Julian Andres Klode outlined their reasoning for disabling os-prober in Ubuntu. They stated, "os-prober is inherently insecure as it mounts all partitions on your disk using grub-mount to check them for other OS." Even though patches have been made since then, many simply don't trust it.

You can easily enable os-prober again if you want. Whether you should or shouldn't, though, depends on your situation. I'm not in the business of giving cybersecurity advice without knowing your threat model, at the least.

For myself, I felt comfortable re-enabling os-prober given that my research told me most of the concerns were with Secure Boot workarounds, and I've already disabled Secure Boot on my PC. Again, it's up to you to decide what the safest route is. To that end, I'll show you two different options, with one of them avoiding os-prober altogether.

Easy option: Enable os-prober

If you feel confident enabling os-prober given the security implications, then you can do so by editing your default GRUB configuration. Typically you can find the configuration file at/etc/default/grub, so editing it will require opening it with the text editor of your choice and with administrative access. To edit it with nano, I used this command:

Scroll through the file until you find a line that reads#GRUB_DISABLE_OS_PROBER=false. Uncomment it by deleting the # symbol.

Advertisement
Advertisement

That's all you need to do to enable os-prober, aside from saving the file. In nano, you do that by hitting Ctrl+o followed by Enter to confirm the file name, then Ctrl+x to exit nano. Don't forget to update GRUB, as I'll explain later.

Safer option: Manually add Windows as a menu entry

Another option that's safer but a little more involved is to skip enabling os-prober and instead add Windows to GRUB's boot menu yourself.

To do this, you first need to know where your Linux system locates your Windows installation's EFI partition. You can find this out by running the following command, which lists all disks and their purposes :

I can see that on my Windows drive there's a device labeled "EFI System" located at/dev/nvme0n1p1. I'll copy that address and have it ready for the the following blkid command, which will reveal the device's UUID, which we need for a custom boot entry:

Look for the UUID value in quote marks and write it down. Then, we're going to edit GRUB's40_customfile, which lets us add custom boot entries to GRUB. I'm using nano to do this, but you can use your preferred text editor.

Paste in the following code block, and then replaceyour-Windows-EFI-partition-UUIDwith the UUID you found.

Also note that you can change the text inside the quote marks following "menuentry" with whatever you want your Windows boot entry to appear as.

Either way, remember to update GRUB

After making changes to your GRUB default configuration file or adding a custom boot entry, don't forget to regenerate your GRUB configuration. This process is what actually causes your changes to take effect. To be honest, I forgot about this myself when I disabled os-prober and was confused when Windows didn't appear after rebooting.

Advertisement
Advertisement

To make things easy, some distros have preconfigured aliases for updating GRUB, likeupdate-grub. You can try running that first (as sudo), but if doesn't work for you, you can always manually update it with this command:

Wait for the regeneration to complete, and then try rebooting. You should see Windows, plus any other operating systems you had installed, in the GRUB boot menu.

Consider replacing GRUB to avoid problems

If you're concerned about os-prober's vulnerabilities and you don't want to deal with manual GRUB menu editing, then I recommend looking into alternative boot managers.

For example, you could replace GRUB with systemd-boot , though its support for legacy BIOS (as opposed to UEFI) is lacking. You might also consider Clover Bootloader , which was originally designed for Hackintoshes and supports both UEFI and BIOS. Another option that will give you an experience similar to macOS' boot manager is rEFInd .

Advertisement
Advertisement
Mobilize your Website
View Site in Mobile | Classic
Share by: