Bobcares

“No Bootable Device” Error in KVM for Windows VMs | Fixed

by | Oct 19, 2024

Learn how to fix the “No Bootable Device” Error in KVM for Windows VMs. Our KVM Support team is here to help you with your questions and concerns.

“No Bootable Device” Error in KVM for Windows VMs | Fixed

If you have been running into a “No Bootable Device” error while booting a Windows VM in KVM, you have come to the right place.

According to our Experts, this error indicates issues related to the boot device configuration or the integrity of the boot media.

"No Bootable Device" Error in KVM for Windows VMs | FixedThis is how the error will look like:

Boot Failed: Could not read from cdrom (code 0003)
No Bootable Device

This error typically results from improper boot configuration or missing disk initialization.

An Overview:

Understanding the Boot Process in KVM

KVM, like other hypervisors, uses a specific boot sequence to load the operating system within virtual machines. The boot sequence involves checking each defined device (hard disk, CD-ROM, network) in a particular order until a bootable device is found.

Unlike physical machines, where boot errors can be linked to hardware faults, KVM boot errors are often caused by misconfigurations in virtual hardware, such as incorrect disk formats or missing boot files.

KVM requires well-defined device mappings to load the operating system, and any discrepancy (like misconfigured disk controllers or boot order) can result in the “No Bootable Device” error.

Depending on the guest operating system and VM configuration, KVM can use either BIOS or UEFI firmware for booting.

Common Causes of the “No Bootable Device” Error

  • The boot sequence may not be configured properly, causing KVM to attempt booting from a non-bootable device.
  • The virtual disk containing the Windows OS may not be attached to the VM or could be incorrectly configured.
  • The virtual disk may not be initialized, or Windows installation may not start.
  • An incompatible virtual disk format or controller type (SATA, IDE, Virtio) may prevent booting.
  • A damaged or missing Windows bootloader can cause this error.

Troubleshooting the “No Bootable Device” Error

1. Check Boot Device Order

  1. If we are using Virt-Manager, open the VM’s settings by right-clicking on the VM and selecting Show Virtual Hardware Details.
  2. Then, in the Boot Options tab, check the boot sequence.
  3. Now, ensure that the virtual hard disk is the first boot device. Here’s how to arrange the boot order:
    • First: Hard Disk (make sure the virtual disk with Windows is selected).
    • Second: CD-ROM (if you’re using it for installation).
    • Third: Network (optional).

    If we are using the command-line tool virsh, we can edit the VM’s XML configuration file:

    sudo virsh edit vm_name

    Look for the <os> section and modify the <boot dev> elements to ensure the correct device is set to boot first:


    <os>
    <type arch='x86_64' machine='pc-i440fx-2.9'>hvm</type>
    <boot dev='hd'/>
    <boot dev='cdrom'/>
    </os>

  4. In this example, the hard drive hd is the first boot device, and the CD-ROM cdrom is the second.

2. Verify Disk Attachment

  1. Ensure the virtual disk is correctly attached in the Storage tab of Virt-Manager.
  2. Confirm the disk format is compatible with KVM (e.g., QCOW2, RAW).
  3. If missing, add the disk via Add Hardware > Storage.

3. Configure the Correct Disk Controller

  1. Disk Controller Type:
    • For older Windows versions, use IDE/SATA during installation.
    • For newer versions, use **Virtio** but ensure drivers are installed during installation.
  2. Switch from Virtio to IDE/SATA in the Storage section if the VM fails to recognize the disk.

4. Repair or Reinstall Windows Bootloader

  1. Boot from a Windows installation ISO and enter “Repair your computer”.
  2. Run these commands in the Command Prompt:

    bootrec /fixmbr
    bootrec /fixboot
    bootrec /rebuildbcd

  3. This will repair the MBR, boot sector, and rebuild the BCD.

5. Disk Initialization and Partitioning

  1. Boot from the Windows installation ISO and initialize/partition the virtual disk.
  2. Proceed with the installation, ensuring the disk is the primary boot device.

6. Inspect VM Logs for Errors

  1. Use virsh to access VM logs:

    sudo virsh console <vm_name>

  2. Check system logs for specific errors:

    sudo journalctl -xe

7. Final Steps: Reinstalling Windows

If the issue persists, we may need to reinstall Windows:

  1. Attach the Windows ISO to the virtual CD-ROM.
  2. Set the CD-ROM as the primary boot device.
  3. Complete the Windows installation.
  4. After installation, ensure the boot order is set to prioritize the virtual hard disk.

Tips for Disk Management in KVM

  1. QCOW2 is generally recommended for KVM due to its support for features like snapshots and compression, making it a good choice for most use cases.
  2. Use RAW format when performance is more critical than storage efficiency, as RAW is faster but lacks advanced features.
  3. Use the Virt-Manager GUI to attach or detach disks easily. Go to the “Add Hardware” option and select “Storage” to add a new disk or edit an existing one.
  4. Ensure proper device mapping by setting the right device type (Virtio, SATA, IDE) and specifying the correct bus type.
  5. When adding new disks, always verify the changes in the VM’s storage settings before starting it.
  6. Use qemu-img to convert between disk formats. For example, convert a VMDK to QCOW2 using the following command:

    qemu-img convert -f vmdk -O qcow2 original.vmdk converted.qcow2

  7. Always create a backup before making format changes to avoid data loss.
  8. Use Virtio drivers for optimal performance, as they provide higher throughput and lower latency compared to other controllers like IDE or SATA.
  9. Install Virtio drivers during the Windows installation process or add them later using the Windows device manager.
  10. For performance-critical applications, consider enabling writeback caching or using dedicated disks for log files to reduce I/O latency.
  11. Use snapshots to create consistent restore points, especially before making major changes to the virtual machine or the operating system.

[Need assistance with a different issue? Our team is available 24/7.]

Conclusion

The “No Bootable Device” error in KVM can be addressed by checking the boot sequence, verifying disk attachments, and repairing the bootloader. Ensuring correct configurations and monitoring logs can prevent this error from reoccurring.

In brief, our Support Experts demonstrated how to fix the “No Bootable Device” Error in KVM for Windows VMs.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF