Monday, June 2, 2025

Ubuntu GRUB not loading - boot manager repair

1. Check if Linux is in MB BIOS. Del or F11 and choose boot priority: 1. Ubuntu, 2. Windows.

2. If no GRUB (GRand Unified Bootloader), boot Linux from MB boot menu F11.

3. No boot from /boot/efi partition? Boot from USB drive > Try Kubuntu.

Ctrl + Alt + T

sudo su

cp /../boot/efi/EFI/BOOT & Ubuntu to /boot/efi partition, if u have.


blkid

efibootmgr

lsblk

lsblk -o NAME,FSTYPE,PARTUUID,MOUNTPOINT

parted -l


blkid | grep -i efi

grep -i efi /etc/fstab


cat /etc/fstab

Don't make mindlessly unnecessary changes to fstab:

# /etc/fstab: static file system information.

#

# Use 'blkid' to print the universally unique identifier for a device; this may

# be used with UUID= as a more robust way to name devices that works even if

# disks are added and removed. See fstab(5).


# <file system>             <mount point>  <type>  <options>  <dump>  <pass>

UUID=*********                              none        vfat        defaults            0 2

UUID=****************** /           ext4    defaults                            0 1

/swapfile                                 swap        swap    defaults                            0 0

tmpfs                                       /tmp        tmpfs   noatime,    mode=1777       0 0

UUID=****************** /boot/efi   vfat    defaults                            0 0


Example:

Your EFI partition is /dev/nvme0n1p2

Your Ubuntu root is on /dev/nvme0n1p6

You’re using UEFI, not legacy BIOS


Mount partitions:

sudo mount /dev/nvme0n1p6 /mnt

sudo mount /dev/nvme0n1p2 /mnt/boot/efi


Mount required virtual filesystems:

sudo mount --bind /dev /mnt/dev

sudo mount --bind /proc /mnt/proc

sudo mount --bind /sys /mnt/sys


Optional (for network access):

sudo cp /etc/resolv.conf /mnt/etc/resolv.conf


sudo chroot /mnt


grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu

update-grub


exit

sudo umount -R /mnt

sudo reboot


mount /dev/nvme0n1p6 /mnt

mount /dev/nvme0n1p2 /mnt/boot/efi

mount --bind /dev /mnt/dev && mount --bind /proc /mnt/proc && mount --bind /sys /mnt/sys

chroot /mnt

grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu

update-grub

exit && reboot


root@kubuntu:/# grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu

Installing for x86_64-efi platform.

grub-install: warning: EFI variables cannot be set on this system.

grub-install: warning: You will have to complete the GRUB setup manually.

Installation finished. No error reported.


efibootmgr --create --disk /dev/nvme0n1 --part 2 --label "ubuntu" --loader '\EFI\ubuntu\grubx64.efi'

EFI variables are not supported on this system.


ls /sys/firmware/efi

config_table  efivars  esrt  fw_platform_size  fw_vendor  mok-variables  runtime  runtime-map  systab

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu

[sudo] password for user:

Installing for x86_64-efi platform.

Installation finished. No error reported.


sudo update-grub

Sourcing file `/etc/default/grub'

Generating grub configuration file ...

Found linux image: /boot/vmlinuz-6.8.0-60-generic

Found initrd image: /boot/initrd.img-6.8.0-60-generic

Found linux image: /boot/vmlinuz-6.8.0-58-generic

Found initrd image: /boot/initrd.img-6.8.0-58-generic

Found memtest86+ 64bit EFI image: /boot/memtest86+x64.efi

Warning: os-prober will not be executed to detect other bootable partitions.

Systems on them will not be added to the GRUB boot configuration.

Check GRUB_DISABLE_OS_PROBER documentation entry.

Adding boot menu entry for UEFI Firmware Settings ...

done


sudo os-prober


If os-prober doesn't output anything, you may need to enable it (uncomment):

sudo nano /etc/default/grub

GRUB_DISABLE_OS_PROBER=false

sudo update-grub


sudo efibootmgr


Fix efibootmgr boot order:

sudo efibootmgr -o 0004,0000


sudo efibootmgr

BootCurrent: 0004

Timeout: 1 seconds

BootOrder: 0004,0000,0005

Boot0000* Windows Boot Manager


sudo efibootmgr -b 0005 -B

BootCurrent: 0004

Timeout: 1 seconds

BootOrder: 0004,0000

Boot0000* Windows Boot Manager


cat /boot/grub/grub.cfg | less


If GRUB EFI files are present but there's no EFI boot entry, re-add it manually:

sudo efibootmgr --create \

--disk /dev/nvme0n1 --part 2 \

--label "ubuntu" \

--loader '\EFI\ubuntu\shimx64.efi'


Then set it first:

sudo efibootmgr -o XXXX


Disable Fast-boot in Windows, because it messes dual boot.


If everything fails, boot into the Live USB, install boot-repair, and run it:

sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt update

sudo apt install -y boot-repair && boot-repair

sudo reboot

No comments:

Post a Comment