grub repair fails on dual boot

ubuntu-users-list at thomas.freit.ag ubuntu-users-list at thomas.freit.ag
Tue Apr 2 20:14:26 UTC 2024


Hi,

after some Windows 10 updates, dual boot (Windows 10 and Ubuntu 23.10) does not work any more on my Lenovo Ideapad 5. After turning on, grub does not get invoked and it boots directly into Win 
10. This happens sometimes, booting a USB live system and reinstalling grub usually works fine. However, this time reinstalling does not work. After attempted repair, still no grub is loaded 
on bootup and system ends in BIOS or boots Win 10 (depending on boot order).


What I did (# is the root shell prompt):

--cut
0) I used ventoy to boot a recent Ubuntu 23.10 live system, tried same steps with a Kali live image, same result.
1) Check partitions, nvme0n1p5 is /boot, nvme0n1p5 is  luks encrpyted and contains /:

# fdisk -l
Disk /dev/nvme0n1: 238.47 GiB, 256060514304 bytes, 500118192 sectors
Disk model: SKHynix_HFM256GDHTNI-87A0B
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 47E4BC4F-F2D3-4D9A-8CCE-9D973302D390

Device             Start       End   Sectors   Size Type
/dev/nvme0n1p1      2048    206847    204800   100M EFI System
/dev/nvme0n1p2    206848    239615     32768    16M Microsoft reserved
/dev/nvme0n1p3    239616 248991221 248751606 118.6G Microsoft basic data
/dev/nvme0n1p4 248991744 250058751   1067008   521M Windows recovery environment
/dev/nvme0n1p5 250058752 251058175    999424   488M Linux filesystem
/dev/nvme0n1p6 251058176 500117503 249059328 118.8G Linux filesystem


2) prepare the live system for grub (re)installation, make sure chroot has all necessary stuff
# cryptdisks_start nvme0n1p6_crypt
Starting crypto disk...
nvme0n1p6_crypt (starting)...Enter passphrase for /dev/nvme0n1p6:
nvme0n1p6_crypt (started)...done.

# mount /dev/mapper/nvme0n1p6_crypt /mnt/
# mount /dev/nvme0n1p5 /mnt/boot/
# mount /dev/nvme0n1p1 /mnt/boot/efi
# mount -o bind /dev /mnt/dev
# mount -o bind /sys /mnt/sys
# mount -o bind /proc /mnt/proc
# mount -o bind /dev/pts /mnt/dev/pts
# mount -o bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars

3) chroot and repair grub, mount anything in /etc/fstab, especially tmpfs on /tmp
# chroot /mnt
# mount -a
# mount
/dev/mapper/nvme0n1p6_crypt on / type ext4 (rw,relatime)
/dev/nvme0n1p5 on /boot type ext4 (rw,relatime)
/dev/nvme0n1p1 on /boot/efi type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=3691964k,nr_inodes=922991,mode=755,inode64)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noexec,noatime,size=2097152k,inode64)

# grub-install
Installing for x86_64-efi platform.
Installation finished. No error reported.

# update-grub
Sourcing file `/etc/default/grub'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-6.5.0-26-generic
Found initrd image: /boot/initrd.img-6.5.0-26-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
grub-probe: error: cannot find a GRUB drive for /dev/sda2.  Check your device.map.
Adding boot menu entry for UEFI Firmware Settings ...
done

# grub-install --recheck
Installing for x86_64-efi platform.
Installation finished. No error reported.
--cut

I tend to ignore the grub error regarding sda2, that is the USB drive, I am booting from (no need to install grub on that).

Anything I missed (iirc these steps worked the last years and several times on exactly this machine). Any help is appreciated.

Best regards,
Thomas



More information about the ubuntu-users mailing list