Skip to content

Instantly share code, notes, and snippets.

@ryumada
Last active December 20, 2024 04:16
Show Gist options
  • Save ryumada/c692512b671237b9e945a27c81c0cbe0 to your computer and use it in GitHub Desktop.
Save ryumada/c692512b671237b9e945a27c81c0cbe0 to your computer and use it in GitHub Desktop.
How to fix missing grub from Boot Menu after windows install or update

How to fix missing grub from Boot Menu after windows install or update1

Boot your computer using USB Bootable Linux

Burn Linux Live CD ISO into your USB drive. then boot to it.

Then, install grub-efi-amd or grub-efi-ia32 based on your system specification.

sudo apt install grub-efi-amd

OR

sudo apt install grub-efi-ia32

Locate and Mount your Linux root drive

using

sudo fdisk -l

or Using any Partition Manager Software

See this image Pasted image 20230304073530

As you can see, my linux root folder is in /dev/sda10 with ext4 format. I've also labeled my disk to root_linux, so it'll be easily to found.

Mount the disk,

sudo mount /dev/sda10 /mnt

Make sure all other necessary folder in in your /mnt folder. If they are placed in other partition, you could mount those.

sudo mount /dev/sdaX /mnt/boot
sudo mount /dev/sdaY /mnt/var
sudo mount /dev/sdaZ /mnt/usr

Mount EFI System Partition

Next, find your EFI System Partition. You can use sudo fdisk -l command to find it.

...
Device         Start       End   Sectors   Size Type  
/dev/sda1       2048   1187839   1185792   579M Microsoft basic data  
/dev/sda2    1187840   1800191    612352   299M EFI System  
/dev/sda3    1802184 294404039 292601856 139,5G Microsoft basic data
...

As you can see above, my EFI System partition is on /dev/sda2. You can mount it.

sudo mount /dev/sda2 /mnt/boot/efi

Mount Another System file23

If /dev, /proc, /run, and /sys are empty in /mnt folder, you could --rbind from Live CD root. This also will solve error grub-install: warning: EFI variables are not supported on this system...

for i in /sys /proc /run /dev;
do sudo mount --rbind "$i" "/mnt$i";
done

Alternatively, manually mount efivarfs virtual system to /sys/firmware/efi/efivars after you've sudo chroot /mnt:

mount -t efivarfs none /sys/firmware/efi/efivars

OR you could --rbind from Live CD root, but you will need to do this outside chroot:

sudo mount --rbind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars

chroot into /mnt directory

sudo chroot /mnt

Reinstall and Update Grub

grub-install
update-grub

Reboot

exit
sudo reboot

[OPTIONAL] Go to your UEFI Bios Menu, then make sure your Linux Boot Manager placed on the first sequence

Footnotes

  1. Severance, S. (2011, December 17). Answer to “How can I repair grub? (How to get Ubuntu back after installing Windows?).” Ask Ubuntu. https://askubuntu.com/a/88432/1091674

  2. Udo. (2022, March 6). Reinstall GRUB (grub-install: Warning: EFI variables are not supported on this system.) [Forum post]. Unix & Linux Stack Exchange. https://unix.stackexchange.com/q/693101/498611

  3. telcoM. (2022, March 6). Answer to “Reinstall GRUB (grub-install: Warning: EFI variables are not supported on this system.).” Unix & Linux Stack Exchange. https://unix.stackexchange.com/a/693111/498611

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment