Notes on manually installing grub

Submitted by Rork on Mon, 01/02/2023 - 21:17

Trouble with installing the grub boot loader, the Kubuntu 22.04 LTS installer failed and I had to do it by hand.

This failed also in my first attempt with grub ending up in grub-rescue looking for /boot/grub/i386-pc/normal.mod. I did not have a /boot/i386-pc directory, only /boot/grub/x86_64-efi. Not sure what had gone wrong there. So in my second attempt I installed i386-pc specifically on my linux partition (/dev/sda5; hd0,msdos5) from the kubuntu live usb:

sudo mount /dev/sda5 /mnt
sudo grub-install --boot-directory=/mnt/boot --target=i386-pc /dev/sda

Now I should've done something smart and configure the new grub installation. However, I didn't do that and ended up at the grub command. So I had to load linux manually and ended up in initramfs with the error message " root not specified". So reboot and specify root now.

set root=(hd0,msdos5)
ls /boot
linux /boot/vmlinuz-5.15.0-43-generic root=/dev/sda5
initrd /boot/initrd.img-5.15.0-43-generic
boot

Now Kubuntu started as expected and I could update my grub-configuration.

sudo update-grub

Reboot and Kubuntu started like a charm.

Tags