I know this is old (sorry for necro) but I found no guide out there that actually work for my Ubuntu 16.04, and I struggled with @Lukas S's answer, as well as with the official Ubuntu UEFI to BIOS guide (@karel's answer). Posting it here rather than editing the Ubuntu wiki guide as this askubuntu question pops up earlier in all search engines.
In fact, I'm surprised either of those 3 guides can actually work for anyone as-is because UEFI systems do not (typically) have the grub-i386-pc files needed for
grub-install to work, so they fail at that step. Boot-repair also fails when trying to repair (saying "grub-pc cancelled"). Probably the authors of these guides had those files somehow, maybe from previous struggles.
My setup was a typical EFI system, which is actually an old Ubuntu 16.04:
- /dev/sda1=fat32 (esp,efi) partition
- /dev/sda2=Linux system
- /dev/sda3=swap (unimportant, you don't have to have this)
- the Linux system on sda2 lacks the /usr/lib/grub/i386-pc folder which has the modules needed for BIOS boot and grub-install
My disk is also GPT, and this is perfectly fine - no need to convert gpt to msdos.
Steps that I had to do to successfully convert from UEFI to BIOS:
delete the sda1 partition
recreate one which is unformatted but with the bios_grub flag. Note: Gparted is iffy, in that when I chose "unformatted" when creating it, it gave me a fat32 one (which
grub-install doesn't like). I had to right-click "format to" and chose "cleared", then applied, then added the "bios_grub" flag.
boot in BIOS mode (important!) from a Ubuntu live CD. I used Xubuntu 20.04.3. It's important to boot in BIOS mode because that will give you the grub-i386-pc files you need later.
mount /dev/sda2 /mnt/sda2
for f in sys dev proc; do mount -o bind /$f /mnt/sda2/$f; done
rsync -a /usr/lib/grub/i386-pc /mnt/sda2/usr/lib/grub/ (important! no / after i386-pc)
chroot /mnt/sda2 /bin/bash
Done. Rebooted and the system now boots in BIOS mode from the hard drive.
My 16.04 now has newer grub-pc-i386 files in /usr/lib/grub, but it's not bothered. It's encouraging to know this procedure work cross distribution versions. I plan to upgrade to 20.04 anyway.
p.s. Someone should probably also edit the the official Ubuntu wiki ...