This document shows the fixing steps if booting up the machine skips GRUB and directly boots up Windows instead.
After altering some settings in Windows, or just as often, after updating Windows, you may find yourself in the following situation:
- When booting up the computer normally, the GRUB screen that lets you choose which OS you want to use does not appear, and instead, the computer directly boots into Windows.
- When booting up the computer while holding the Esc key, the option for multiple operating systems are present, but pressing Enter after selecting your desired Linux distribution does not work (but selecting Windows works).
- Tools like DiskInternals Linux Reader (certain tools are needed to read
ext4
partitions that some Linux systems use) shows that the Linux partitions, including its corresponding EFI partition is still intact.
The following steps summarizes what needs to be done:
First, boot into Windows, open the Command Prompt as administrator, and run bcdedit /set {bootmgr} path \EFI\endeavouros\grubx64.efi
(make sure to run it in the Command Prompt instead of PowerShell). Change endeavouros
to whatever Linux distribution you use. If you look through the relevant EFI partition with softwares like DiskInternals Linux Reader, you should find that this grubx64.efi
file exists.
After rebooting, you will be presented with the GRUB Rescue screen (with the grub rescue>
prompt). Type ls
to list the available partitions and you should see an output like this:
grub rescue> ls
(hd0) (hd0,gpt2) (hd0,gpt1)
where gpt
could also be msdos
. You can check the contents of each partition using ls
, for example, ls (hd0,6)/
might give an output similar to the following (not that gpt
and msdos
does not need to be specified when using it with ls
):
grub rescue> ls (hd0,6)/
lost+found/ bin/ boot/ cdrom/ dev/ etc/ home/ lib/
lib64/ media/ mnt/ opt/ proc/ root/ run/ sbin/
srv/ sys/ tmp/ usr/ var/ vmlinuz vmlinuz.old
initrd.img initrd.img.old
If the output is anything similar to the above, that means that the partition being checked is where the OS is installed. If not (e.g., an output of unknown filesystem
), then keep trying the other available partitions.
Once you found the OS partition, run:
grub rescue> set root=(hd0,6)
grub rescue> set prefix=(hd0,6)/boot/grub
grub rescue> insmod normal
grub rescue> normal
assuming (hd0,6)
is the partition where the OS is. Once that is done, the GRUB menu should open and you should be able to boot into the Linux partition.
Run the following commands to make sure you do not get the GRUB Rescue screen the next time you boot up your machine:
sudo grub-mkconfig -o /boot/grub/grub.cfg
sudo grub-install /dev/sda