- Dual boot Windows 11 and Ubuntu
- Windows 11 is existing, on
nvme0n1
- Ubuntu Server 22.04 LTS is newly installed, on
nvme1n1
- Previously installed (and removed) multiple Linux on
nvme1n1
- Ubuntu installed shim boot files into existing EFI file system
nvme0n1p1
- The EFI file system is tainted with old boot files from previous installations
- The installed Ubuntu boot files, especially grub.cfg, is incorrect
- Ubuntu installed real boot files into
/boot aka nvme1n1p2, an ext4 file system partition, with vmlinuz, initrd, GRUB menu, etc.
- We should have the shim boot files point to the real boot files in
/boot
# List partitions
ls
# List content in partition
# Note the trailing slash
# Try different partitions, yours may not be (hd3,gpt2)
ls (hd3,gpt2)/
ls (hd3,gpt2)/grub
# Boot from (hd3,gpt2)
set prefix=(hd3,gpt2)/grub
set root=(hd3,gpt2)
insmod linux
insmod normal
normal
sudo mkdir /mnt/winboot
sudo mount /dev/nvme0n1p1 /mnt/winboot/
cd /mnt/winboot/EFI
# Observe!
ls
efibootmgr
# Remove obsolete EFI entries
sudo rm -rf debian
sudo efibootmgr -Bb 0000
# Show grub.cfg
cat ubuntu/grub.cfg
# Find partition UUID
# Note the UUID for the partition mounted at /boot, to be used in correct grub.cfg
lsblk -o NAME,SIZE,MOUNTPOINT,UUID
# Edit the grub.cfg
sudo vi ubuntu/grub.cfg
search.fs_uuid 00000000-0000-0000-0000-000000000000 root
set prefix=($root)'/grub'
configfile $prefix/grub.cfg