How to Safely Convert a UEFI Bootable Linux VM Disk to BIOS (SeaBIOS) for KVM
Step-by-Step Guide: Converting UEFI Linux VM to BIOS on KVM Safely

Migrating virtual machines between hypervisors often presents challenges, especially when moving from VMware ESXi (which often uses UEFI firmware) to KVM-based platforms like SolusVM, which typically default to legacy BIOS (SeaBIOS). If you simply convert and import the disk, you may encounter frustrating boot errors such as "Booting from Hard Disk..." with no further progress.
This guide provides a safe, step-by-step process to convert a Linux VM disk from UEFI boot to BIOS, preserving your data and minimizing downtime.
Why Does This Happen?
UEFI and BIOS are different firmware types.
A VM created on VMware may use UEFI, but KVM (and SolusVM) often expect BIOS (SeaBIOS).OS bootloaders are installed differently for UEFI and BIOS.
UEFI boots from an EFI System Partition (/boot/efi), while BIOS boots from the MBR using GRUB or similar bootloaders.A disk converted from VMDK to QCOW2 may be unbootable if the boot mode/fimware doesn’t match.
Identifying Your Boot Mode
On the Original VMware Host
Check VM Settings in vSphere/ESXi:
Edit the VM.
Look for "Boot Options" or "Firmware."
If set to "EFI" or "UEFI," your VM uses UEFI. If "BIOS," it uses legacy BIOS.
Check the Filesystem:
Mount the disk image (VMDK/QCOW2) on another Linux machine or VM.
Look for
/boot/efi. If this folder exists and is populated, your VM likely used UEFI.
guestmount -a server-48.bikiran.net-flat.qcow2 -i --ro /mnt ls /mnt/boot/efiIf you see files here, it's UEFI.
Steps to Convert UEFI to BIOS Boot
Warning:
Always back up your VM's disk image before proceeding.
These steps assume a Linux guest. For Windows, the process is significantly different.
1. Prepare a Rescue Environment
Boot the VM using a Linux live CD/ISO (e.g., Ubuntu Live).
Attach the converted QCOW2 disk if it isn't already.
2. Use an Automated Script
To simplify and reduce risk, use the following bash script. This script will:
Detect your root partition.
Mount it and chroot into your system.
Install GRUB for legacy BIOS boot.
Remove
/boot/efimount from/etc/fstab.Clean up and unmount everything.
Save this as convert-uefi-to-seabios.sh:
#!/bin/bash
# convert-uefi-to-seabios.sh: Convert a Linux VM from UEFI boot to legacy BIOS boot (SeaBIOS).
# Usage: sudo bash convert-uefi-to-seabios.sh /dev/vda
set -e
DISK="$1"
if [[ -z "$DISK" ]]; then
echo "Usage: $0 /dev/vdX (replace with your disk device, e.g., /dev/vda)"
exit 1
fi
# Find Linux root partition (assume it's the largest Linux partition)
ROOT_PART=\((lsblk -lnpo NAME,SIZE,TYPE,FSTYPE | grep -E "ext4|xfs|btrfs" | sort -rk2 | head -n1 | awk '{print \)1}')
if [[ -z "$ROOT_PART" ]]; then
echo "Could not detect Linux root partition. Please specify manually."
exit 1
fi
echo "Mounting root partition: $ROOT_PART"
mkdir -p /mnt/root
mount "$ROOT_PART" /mnt/root
if [ -d /mnt/root/boot/efi ]; then
echo "/boot/efi detected. Proceeding with UEFI to BIOS conversion."
else
echo "No /boot/efi found. The system may already use BIOS boot."
umount /mnt/root
exit 0
fi
echo "Binding system filesystems..."
mount --bind /dev /mnt/root/dev
mount --bind /proc /mnt/root/proc
mount --bind /sys /mnt/root/sys
echo "Chrooting into system..."
chroot /mnt/root /bin/bash <<'EOT'
set -e
echo "Installing GRUB for BIOS..."
grub-install --target=i386-pc --recheck /dev/vda
echo "Updating GRUB config..."
update-grub || grub2-mkconfig -o /boot/grub2/grub.cfg
echo "Removing /boot/efi entry from /etc/fstab..."
sed -i '/\/boot\/efi/d' /etc/fstab
echo "UEFI to BIOS conversion completed inside chroot."
EOT
echo "Cleaning up /boot/efi..."
rm -rf /mnt/root/boot/efi
echo "Unmounting filesystems..."
umount /mnt/root/sys
umount /mnt/root/proc
umount /mnt/root/dev
umount /mnt/root
echo "Done. Please detach the ISO and try to boot with SeaBIOS (legacy boot)."
3. Run the Script
Make it executable:
chmod +x convert-uefi-to-seabios.shExecute (replace
/dev/vdaas needed):sudo ./convert-uefi-to-seabios.sh /dev/vda
4. Switch the VM Firmware to SeaBIOS
- In SolusVM/KVM, ensure the VM firmware is set to BIOS/SeaBIOS (not UEFI/OVMF).
5. Reboot and Test
Reboot the VM.
The VM should boot from the hard disk using BIOS/SeaBIOS.
Troubleshooting
Disk Uses GPT Instead of MBR:
BIOS boot with GPT is possible (with a BIOS boot partition), but many tools expect MBR. Seek advanced guidance if you’re using GPT.OS Is Windows:
This script is for Linux guests. For Windows, the process is very different and more complex.No OS Found:
Double-check that GRUB is installed to the correct disk and that the root partition is correct.Still Not Booting?
Attach the disk to another VM, check/boot/grubcontents, or review/var/log/libvirt/qemu/<vmname>.logfor errors.
Conclusion
Migrating VMs between platforms is never truly "plug and play," especially when firmware and boot mechanisms differ. This guide and script should make converting your Linux VM from UEFI to BIOS for KVM much easier and safer. Always back up your data, and proceed with caution!
CONTACT:
I’m Kumar Bishojit Paul, the Founder and CEO of BIKIRAN. If you need further assistance, please leave a comment. I’m interested in helping you.
Have questions or need a version for GPT partitioned disks or Windows? Leave a comment!
🏢 About Bikiran
Bikiran is a software development and cloud infrastructure company founded in 2012, headquartered in Khulna, Bangladesh. With 15,000+ clients and over a decade of experience, Bikiran builds and operates a suite of products spanning domain services, cloud hosting, app deployment, workflow automation, and developer tools.
| SL | Topic | Product | Description |
|---|---|---|---|
| 1 | Website | Bikiran | Main platform — Domain, hosting & cloud services |
| 2 | Website | Edusoft | Education management software for institutions |
| 3 | Website | n8n Clouds | Managed n8n workflow automation hosting |
| 4 | Website | Timestamp Zone | Unix timestamp converter & timezone tool |
| 5 | Website | PDFpi | Online PDF processing & manipulation tool |
| 6 | Website | Blog | Technical articles, guides & tutorials |
| 7 | Website | Support | 24/7 customer support portal |
| 8 | Website | Probackup | Automated database backup for SQL, PostgreSQL & MongoDB |
| 9 | Service | Domain | Domain registration, transfer & DNS management |
| 10 | Service | Hosting | Web, app & email hosting on NVMe SSD |
| 11 | Service | Email & SMS | Bulk email & SMS notification service |
| 12 | npm | Chronopick | Date & time picker React component |
| 13 | npm | Rich Editor | WYSIWYG rich text editor for React |
| 14 | npm | Button | Reusable React button component library |
| 15 | npm | Electron Boilerplate | CLI to scaffold Electron.js project templates |
| 16 | NuGet | Bkash | bKash payment gateway integration for .NET |
| 17 | NuGet | Bikiran Engine | Core .NET engine library for Bikiran services |
| 18 | Open Source | PDFpi | PDF processing tool — open source |
| 19 | Open Source | Bikiran Engine | Core .NET engine — open source |
| 20 | Open Source | Drive CLI | CLI tool to manage Google Drive from terminal |
| 21 | Docker | Pgsql | Docker setup for PostgreSQL |
| 22 | Docker | n8n | Docker setup for n8n automation |
| 23 | Docker | Pgadmin | Docker setup for pgAdmin |
| 24 | Social Media | Bikiran on LinkedIn | |
| 25 | Social Media | Bikiran on Facebook | |
| 26 | Social Media | YouTube | Bikiran on YouTube |
| 27 | Social Media | FB n8nClouds | n8n Clouds on Facebook |






