Thursday, 20 March 2025

Set up dual boot with Grub2 after messing things up

Working on a project recently, I made the mistake of thinking that a pre-built Ubuntu Core image could be written over an existing Ubuntu Desktop ext4 partition to switch the OS. Well first of all, Ubuntu Core pre-built images are for entire disks and include their own partitions including a bootloader that can self-heal the OS partition. So yeah... after doing this the grub2 bootloader I had installed on an EFI partition do longer found any OS to boot since it's `/boot/grub/grub.cfg` file was gone.

Following the suggestion in the post linked above, I created an Ubuntu Server USB Key installer and installed that on the partition I'd designated for Ubuntu. I had to specify manual layout instead of whole disk and choose the partition to be `/` but other than that, it was a normal Ubuntu server install. Sadly though, unlike when I installed Ubuntu Desktop the first time through, it did not notice the Windows 11 partition or offer to set up dual boot.

After some RTFM I found a bit about how the update-grub command by default runs os-prober to find and add other operating systems to the grub config at boot time. Simply running update-grub in my Ubuntu Server environment seemed to do the trick and Windows Boot Manager was found and added as a non-default option in the Grub2 boot menu. I rebooted, tried choosing Windows and it worked. Then again and back into Ubuntu Server by default. All is well.

No comments:

Post a Comment

Modern Ubuntu web kiosk using chromium as the browser engine

 I have been working to prepare a digital atlas exhibit for the Natillik Heritage Centre in Gjoa Haven, Nunavut, Canada. Working with Indig...