After more investigation, it turns out that the OS was indeed installed in legacy BIOS mode, which is why it wasn't being found in the BIOS as a bootable device. I enabled legacy mode in the BIOS to see what would happen, and, unfortunately, I just got a black screen on boot, so something wasn't quite right there.
I wanted to give just converting it from BIOS to UEFI a try. Even though you sometimes can't transplant a drive from one computer to another as Nmath says in the comments, I've done this myself several times and never with any major issues beyond proprietary hardware drivers, which can simply be installed, so I decided to do it again. This was also much simpler than doing a fresh install.
This was my process:
- Boot a Live USB with Ubuntu (and make sure it's in UEFI mode, which it obviously will be if the BIOS has legacy mode disabled).
- Backup my partition table with
sfdisk -d /dev/nvme0n1 > mbr-backup.txt
in case something goes wrong.
- Convert the partition from MBR to GPT with
gdisk /dev/nvme0n1
, then w
to write the new partition table.
- With GParted, resize the first partition to leave 550 MB before it and add a new FAT32 partition to the beginning and add the EFI and BOOT flags to it.
- Run
boot-repair
and do the default repair following all prompts.
Fortunately, Ubuntu does a great job of detecting hardware changes. I took the drive from a computer with an Nvidia graphics card installed and put it into another with Intel graphics and everything just works out of the box.