64

I have installed a Windows 10 virtual machine using an IDE disk and would now like to change the disk to use the Virtio driver.

For other versions of Windows, the approach in this question seems to be sufficient - How to migrate an IDE VM to a virtio VM?

However with Windows 10, this leads to an INACCESSIBLE_BOOT_DEVICE issue.

I am aware that the preferred approach is the use the Virtio device from the start and install the appropriate virtio driver when prompted. Unfortunately I was having some separate issues with changing the CD in KVM (I couldn't get 2 CDROM devices to work either).

Is there any way to correct this issue without reinstalling?

Similar issue here - https://me.m01.eu/blog/2015/03/windows-10-kvm-and-iscsi/#comment-36090

Graeme
  • 915

7 Answers7

70

All the answers are correct but you may need to perform few additional steps after you have installed virtio drivers. Here are the steps I followed:

  1. Configure boot disk as SATA and start the VM.

  2. Open an elevated command prompt and set the VM to boot into safe mode by typing

    bcdedit /set "{current}" safeboot minimal
    
  3. Shut-down the VM and change the boot device type to virtio.

  4. Boot the VM, it will enter in safe mode. Booting into safe mode automatically enables and loads all boot-start drivers will be enabled and loaded, including virtio. Since there is now a miniport installed to use it, the kernel will now make it part of the drivers that are to be loaded on boot.

  5. To disable safe mode for the next boot, run in an elevated command prompt:

    bcdedit /deletevalue "{current}" safeboot
    
  6. Shut down.

  7. Reconfigure the boot disk to virtio and start the VM.

llegolas
  • 709
51

A fairly simple answer is provided - and may work in many cases, along with hints at other options. If (like me) you're not able to switch to IDE and forced to use VirtIO, then the following alternative approach might work:

  1. Add the virtio driver ISO to VM.
    • Required: The latest driver ISO can be pulled out of the RPMs found at https://fedorapeople.org/groups/virt/virtio-win/repo/latest/
    • Suggested: Also add the windows 10 DVD/CD ISO and boot form that if Startup repair isn't available to you or failing to load the driver and make the Windows 10 OS volume available.
  2. Use Troubleshoot -> Advanced Options -> Command Prompt either from a failed boot recovery menu or boot off windows 10 DVD/CD and get into a command prompt from repair mode option.
  3. Identify your driver latter mappings via wmic logicaldisk get deviceid, volumename, description
    • In my case virtio-win install ISO (CD-ROM Disc) was assigned to E: Your case will vary!
  4. Load the driver via the CLI e.g. drvload e:\viostor\w10\amd64\viostor.inf.
    • After loading the driver, run wmic logicaldisk get deviceid, volumename, description again.
    • F: was where the windows install became mounted in my case. Your cases will vary!
  5. Use the DISM command to inject the storage controller driver
    • E.g. dism /image:f:\ /add-driver /driver:e:\viostor\w10\amd64\viostor.inf
    • As above, change drive letter assignments according to your own environment.

Avoids needing to fiddle with making special windows boot CDs/Images and "patches" the actual windows install image on the fly.

Note further:

  • While it's possible to use startup repair, one time I did have problems with the drvload command suggesting a reboot was needed. It didn't seem to load the Windows 10 OS volume and a reboot was pointless since I got stuck back at the startup repair screen needing to load the driver again, hence it was more robust using a Windows ISO to boot.
  • One time, with a hybrid Windows 10 instance I can boot on bare metal, or in qemu/libvirt (using raw storage and virtio), I upgraded while running on bare metal and it messed up my virtio drivers when I next booted virtually. Startup repair and dism in this case worked without needing the Windows 10 install DVD.
  • If you do boot from the Windows Install DVD/ISO, be careful to avoid Windows 10's DVD eagerness to restore or reinstall everything...

Credit for DISM approach: Using dism to add drivers

tonymanou
  • 3
  • 3
JPvRiel
  • 1,651
14

The steps to follow in general are :

  1. Install the VirtIO drivers in the VM
  2. Set the system disk of the VM to use VirtIO
  3. If the VM does not boot, execute Startup Repair or even Repair Install

The procedure in detail is :

  1. Return the boot disk to IDE.
  2. Make sure the windows VM is shutdown.
  3. Download the VirtIO drivers ISO from here.
  4. Mount it on the CD drive for the VM.
  5. Add a storage device which is of the VirtIO type. The size allocation doesn't matter since you are using it to install the drivers.
  6. Start the Windows VM. It will try to install the drivers. If it doesn't, open the Device Manager and you should see the SCSI device listed with the exclamation point icon beside it. You can choose to update the driver and point to mounted ISO's appropriate directory. Once installed, don't reboot but shutdown the machine.
  7. In the virt-manager settings for Windows, change the storage type from IDE to VirtIO.
  8. You can remove the storage device you had created earlier. It is not longer needed.
  9. Start Windows, it should boot up and install the SCSI drivers. You will need to reboot after it does.
  10. If the VM does not boot but the drivers are installed, you might try to do :

    1. Startup Repair that can fix certain system problems that might prevent Windows from starting.
    2. The last solution: Repair Install while booting from the Windows 10 ISO. This will keep all applications and user settings, just refreshing Windows and boot. Use a recent Windows 10 ISO.

If the last step is unfortunately required, one more difficulty that might be encountered is if the Windows boot CD cannot understand the VirtIO disk because these drivers were not included in it by Microsoft. In this case, one needs to create a custom boot CD/USB that contains these drivers, but make sure that you start from a Windows ISO that is of the same level as the installation by getting the latest one (currently 1511).

Here are some tutorials on how to slipstream drivers in Windows :

harrymc
  • 498,455
13

the answer from harrymc works fine for me.

the following steps I followed:

  1. Install the virtio driver in windows
  2. Add a additional "dummy" virtio disk. Reboot and check if the "dummy" works.
  3. If Step 2 works, then switch the boot disk to virtio.
  4. Reboot
  5. Remove the additional "dummy" virtio disk
  6. ...
sdhd
  • 131
8

It is unfortunately possible to have driver perfectly installed and STILL get "inaccessible boot Device." The reason is a bit shocking (I find): a Win 10 installation "remembers" the drivers that were required when it was first installed, and by default WILL NOT load other storage drivers at boot time. This is done, it seems, to "piracy" -- it makes it difficult to run the "same" installation on different hardware. There is some great documentation on this "feature" in this post from the gentoo forums. The essence is as follows:

The Drivers that are targeted for forbidden-to-load-at-boot can be determined as follows: Within the registry key Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services there is one subkey for every driver known to the installation. The name of this subkey is just the name of the driver. Within each driver subkey, there will be a subkey "STARTOVERRIDE" if that driver is to be prevented from loading at boot. In particular, within the STARTOVERRIDE subkey there is a parameter whose name is "0" . IF the value of this parameter is "3", it will not be loaded at boot time. Setting this value to 0 instead will 'override' behavior.

I myself just go to Computer\HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services and search for "STARTOVERRIDE". Each time i find it, if there is name under it called "0" with value "3", I change to "0". This seem to be overkill, you only need to change the drive that needs to load. In my case there are several of them, and I never remember which, so I just do an "F3-search" within that 'services' section.

And one final tip which isn't needed for current, signed, virtio storage, but might be to someone else reading this if they want to use a more experimental driver that is not (yet) signed: I found that EVEN after doing the above trick, I ALSO needed to boot into the advanced options screen and choose F7 ("disable driver signature verification"). Annoyingly, it wasn't enough to set the bcd flag to disable driver verification, because the driver needs to load before the machine reads the BCD and finds out that it doesn't need to verify the signature.

All in all, not Microsoft's most shining hour. You really have to hate your users if you'd rather give legit users a made-up artificial Blue-Screen than allow people to (say) replace a SATA disk with an NVMe disk and have it "just work."

6

Wow, lot's of shenanigans. Why not just using Arch Wiki's QEMU approach? First have your virtio-win-0.1-81.iso ready. Download from RedHat.

1 - Create a fake (dummy) disk with $ qemu-img create -f qcow2 fake.qcow2 1G.

2 - Keeping your windows boot drive as IDE or SATA or whatever, add the new fake drive as a secondary drive, but the driver for that one should be virtio.

2a - if using libvirt, add the fake drive by editing the xml of the VM and add the following to :

<disk type='file' device='disk'>
  <driver name='qemu' type='qcow2'/>
  <source file='/full/path/to/fake.qcow2'/>
  <target dev='vda' bus='virtio'/>
</disk>

2b - if using QEMU directly start your VM with $ qemu-system-x86_64 -m 512 -drive file=windows_disk_image,if=ide -drive file=fake.qcow2,if=virtio -cdrom virtio-win-0.1-81.iso

3 - start your VM and install the viostor driver from the Win .iso.

4 - Once installed, shut down the windows VM, remove the xml configuration (if libvirt), delete the fake.qcow2 and start your Win VM.

5 - Enjoy!

0

Messing with Qemu settings/Virt-manager isn't necessary. Just do the below.

  1. Open VM post install.

  2. Go to page here, install virt stable iso INSIDE the vm: https://github.com/virtio-win/virtio-win-pkg-scripts/blob/master/README.md

  3. Right click the iso file, and select mount. It will now show as mounted, and you can update driver by driver in Device Manager.