3 minutes
This tutorial explains how to restore the GRUB boot menu on Ubuntu, Manjaro, Arch Linux which disappeared after updating Windows on a dual / multi boot machine.
You’ve installed your favorite Linux distro alongside Windows and have been happily enjoying the best of both worlds, without having to override your Windows installation. This is possible thanks to the incredible bootloader: GRUB.
Until one day you notice that the GRUB boot menu no longer appears, causing your computer to automatically boot on Windows — locking you out of your Linux installation. If you have been plagued by this issue, cursing Linux or GRUB will be of no help. The real culprit here is Windows.
Here is what actually happened. Unlike GRUB which is intelligent by design to detect the presence of other operating systems, the Windows bootloader doesn’t take into account other operating systems that are installed on the computer. Whenever a major Windows update is available, the GRUB bootloader gets replaced by the Windows bootloader. Therefore, in order to bring back the GRUB boot menu, all we have to do is replace the Windows bootloader with GRUB.
Restore Missing GRUB Boot Menu
The instructions below explain how to restore / reinstall GRUB on Ubuntu, Debian, Manjaro, Arch Linux and other derivatives.
Step 1: Boot from a Live USB
First, you need to boot from a live Linux USB. Then, open a Terminal window.
Step 2: Identify Root Partition and EFI Partition
Run the following command to determine the current root
and EFI
partitions:
lsblk -io KNAME,MOUNTPOINT | grep "/"
We’ll now create shell variables to denote the root
and EFI
partitions:
Caution
Make sure to set the variables $ROOT_PART
and $EFI_PART
with the proper partition names you obtained above! Also, don't forget to add /dev/
in front of the partition name as shown below:
export ROOT_PART="/dev/nvme0n1p5"export EFI_PART="/dev/nvme0n1p1"
Step 3: Mount Root Partition and EFI Partition
Next, mount these partitions and set proper permissions:
sudo mount $ROOT_PART /mntsudo mount $EFI_PART /mnt/boot/efi
sudo mount -o bind /dev /mnt/devsudo mount -o bind /proc /mnt/procsudo mount -o bind /sys /mnt/syssudo mount -o bind /run /mnt/runsudo chroot /mnt/
Step 4: Fix GRUB Installation
Once the proper partitions have been mounted, run the appropriate commands below depending on your Linux distro.
- Ubuntu and Debian derivatives (For UEFI or Non-UEFI):
sudo apt-get install --reinstall grub-efisudo update-grub
- Manjaro and Arch Linux derivatives (For UEFI):
sudo pacman -S grub efibootmgr os-probersudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grubsudo grub-mkconfig -o /boot/grub/grub.cfg
- Manjaro and Arch Linux derivatives (For Non-UEFI):
sudo pacman -S grubsudo grub-install --recheck --target=i386-pc $ROOT_PARTsudo grub-mkconfig -o /boot/grub/grub.cfg
Step 5: Reboot
Finally, restart your computer and you should be good to boot on Linux again :)
sudo reboot
If you still don’t see the GRUB boot menu, you’ll need to change the boot order in the BIOS. It is also possible to do this from Windows without entering the BIOS as explained below.
Changing GRUB Boot Order in Windows
The following steps will enable you to change the boot order priority to set GRUB as the preferred bootloader without entering the BIOS.
Step 1
In Windows, click on the Start Menu and search for “Command Prompt”.
Step 2
Right click on the Command Prompt menu option and click “Run as administrator”.
Note
It is important to open the Command Prompt with Administrator privileges, otherwise the step below will not work!
Step 3
Copy and paste the appropriate command below depending on your Linux distro in the Command Prompt window and press ENTER:
- For Ubuntu:
bcdedit /set {bootmgr} path \EFI\ubuntu\grubx64.efi
- For Manjaro:
bcdedit /set {bootmgr} path \EFI\Manjaro\grubx64.efi
- For Arch Linux:
bcdedit /set {bootmgr} path \EFI\Arch\grubx64.efi
Next, reboot your machine and you should see the GRUB boot menu again :)
https://wiki.archlinux.org/title/GRUB
https://www.bleepingcomputer.com/forums/t/734220/lost-my-grub-menu-on-manjarowin-10-dual-boot/
grubfixbootlinuxwindows
607 Words
Dec 15, 2021
Muzaffar "Ray" Auhammud
Subscribe to TechBlog.dev
Don't miss out on quality Linux and Programming tutorials.
Join for a chance to win goodies and exclusive offers.
We promise to not spam you, plus our newsletter is 100% FREE!
You can unsubscribe anytime.
Read other posts
Comments
Permalink to comment
GUEST
Jan Wegner
What if I have an “extra” /boot-partition like
export BOOT_PART="/dev/nvme0n1p4"
and it is mounted on a previously mounted “/”export ROOT_PART="/dev/nvme0n1p5"
Will a$> mount $ROOT_PART "/mnt/root"; mount $BOOT_PART /mnt/root/boot"
do the trick?
advTHXanceJan
Permalink to comment
ADMIN
Ray
Jan Wegner
Unfortunately, I have not tried a setup having 2 boot partitions on the same disk. I reckon the second boot partition /dev/nvme0n1p4
is a non-EFI partition that lacks the ESP
flag?
If yes, I’d probably do it like this on Ubuntu and Debian derivatives distros:
export BOOT_MNT="/mnt/root/boot"export BOOT_PART="/dev/nvme0n1p4"sudo mkdir -p $BOOT_MNTsudo mount $BOOT_PART $BOOT_MNTsudo apt install --reinstall grub-efisudo grub-install --recheck --target=i386-pc $BOOT_PARTsudo grub-mkconfig -o $BOOT_MNT/grub/grub.cfg
DISCLAIMER:This is just pure speculation. I have not tested this one and won’t be held liable for any data loss or corruption which might occur! At your own risk…
Permalink to comment
GUEST
Jan Wegner
In step 4 above “Fix GRUB Installation”
in the section: “Ubuntu and Debian derivatives (For UEFI or Non-UEFI):”
sudo apt-get install --reinstall grub-efi
# ok
the following lineupgrade-grub
leads to a “upgrade-grub: command not found”
Do you meansudo update-grub
?
Sourcing file ‘/etc/default/grub’ …
…
Generating grub configuration file …
…
done
at least at my mint 21.1
Permalink to comment
ADMIN
Ray
Jan Wegner
Hi Jan,
Thank you for pointing this out. There was indeed a typo in the command. I’ve updated the instructions to use update-grub
instead of upgrade-grub
.
Permalink to comment
GUEST
DianaB.
Hi,
when I run “export $ROOT_PART="/dev/nvme0n1p7” I get the following response: “zsh: /dev/nvme0n1p7 not found.”
do you know why this is? And how can I fix it?
I’m using Manjaro.
Thanks a lot.
Permalink to comment
ADMIN
Ray
DianaB.
Hi, thanks for bringing this up. There was a typo in the command. You should remove the dollar sign in front of the variable in the export command:
export ROOT_PART="/dev/nvme0n1p7"
Permalink to comment
GUEST
Bernd Dreyer
What if Ubuntu menu entry disappeared after update Ubuntu update to Ubuntu 23.10.1 (Mantic Minotaur).The installation routine requests a decision of hold the old grub or not. I have voted for the old grub.
Please wait...