56

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

7
  • 1
    +1. I couldn't figure out this issue myself. Following various workarounds for previous versions of Windows, I tried installing the VirtIO driver on the Windows VM after plugging in a VirtIO block device, but I still got INACCESSIBLE_BOOT_DEVICE blue screen. I ended up reinstalling on a VirtIO boot device.
    – Deltik
    Mar 27, 2016 at 19:01
  • 2
    Because I’m lazy, I’ll post it as a comment for you to verify: Add an additional disk, with virtio “controller”. Install driver when Windows asks you to. No need to create partitions or anything. Then switch the boot disk to virtio. Because a controller driver instance is now installed (very important), it should work.
    – Daniel B
    Mar 31, 2016 at 18:53
  • @DanielB: That's exactly what I did. It appears that your suggestion works for previous versions of Windows, but not Windows 10.
    – Deltik
    Apr 1, 2016 at 8:01
  • Hm, okay. Well I guess then I have the single best way not to solve your problem (lol): Just modify the Windows ISO and include the drivers. Keep in mind it needs to remain bootable. That way you can (hopefully) install straight to virtio.
    – Daniel B
    Apr 1, 2016 at 21:21
  • 1
    @DanielB: The VirtIO driver can be loaded in the installation process with a separate driver disc. If Windows 10 is installed with the VirtIO driver, there is no problem. It's just that the existing instructions on the Internet to switch Windows from IDE to VirtIO do not work for Windows 10 KVM virtual machines.
    – Deltik
    Apr 3, 2016 at 10:51

7 Answers 7

58

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.

10
  • 3
    Fantastic! This was the missing bit for me. I used bcdedit /set safeboot minimal, omitting the {current} because I was not sure what was supposed to go in there. Oct 5, 2017 at 18:13
  • 2
    @CharlesGreen {current} is literal, you type in as-is.
    – Marc.2377
    Feb 17, 2018 at 23:09
  • Problem if you have PIN login because password login can require network access. I'm reinstalling Windows as a result. answers.microsoft.com/en-us/windows/forum/windows_10-security/… Feb 27, 2018 at 17:35
  • 1
    The command I used was bcdedit /set safeboot. Using the suggested "{current}" spits an error. However, I ended up in safe-mode with the requested Virtio-driver, disabled safe-mode and lived happily ever after with a Virtio-disk. Jan 24, 2020 at 8:05
  • 2
    If you're using the admin powershell, you quote the {current}: bcdedit /set "{current}" safeboot minimal May 18, 2020 at 19:53
38

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

5
  • 1
    Alternative to 4: Right click the inf file -> Install.
    – rbs
    Sep 7, 2017 at 10:22
  • Also, watch out for windows update breaking this. As per a reddit post, "the update erased my VirtIO drivers": reddit.com/r/VFIO/comments/6b06y5/…. This might happen in the corner case when you run your Windows install as both a dual boot and a VM and apply the update when on native hardware...
    – JPvRiel
    Jan 14, 2018 at 12:12
  • 1
    This, plus the answer below. I had to do the boot into Safe Mode (bcdedit /set {current} safeboot minimal) and then remove the Safe Mode boot (bcdedit /deletevalue {current} safeboot), and then restart. After that, it worked with Windows Server 2016 Essentials.
    – G Trawo
    Jan 25, 2018 at 19:15
  • I want to vote this up twice. Installing the .inf file by right clicking on it did not work. The rescue shell in the repair / troubleshoot / start shell path brought me to a place I could use the above commands. My system is booting from my virtio disk now, and doesn't have to deal with the overhead of emulating an ide controller
    – cjac
    Apr 16, 2020 at 23:42
  • Tried @llegolas's safeboot answer first, though a good one, did not cut it. Trying this on Win10_22H2 was exactly as stated, had to do it with installation iso booted, since the automatic repair screen (even though same visual interface and terminal) was not working. Thanks. Edit: One difference is that I ran wmic logicaldisk get description, deviceid, size, volumename as it lets seeing which one is the bigger/system partition, but if iso is sata1, virtio is sata2 and windows disk is virtio1 no need to change disk ids.
    – cbugk
    Oct 27 at 23:24
12

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 :

6
  • This answer would work (and does work for other versions on Windows), except that on step 9, when you try to boot there is an INACCESSIBLE_BOOT_DEVICE error (this is where I was when I posted the question). A startup repair (10.1) does not work and step 10.2 is not actually possible. A repair install can only be done by first booting the system, without the CD, then running setup.exe on the CD. This is what the link in the question describes and as far as I am aware there is no other way to do it.
    – Graeme
    Apr 10, 2016 at 12:42
  • Exactly what other information am I supposed to supply? I have told you repeatedly that the option isn't there. The problem here is that you continually insist that it is. If it is the case that there are 'dozens of others in various articles found on the Internet', reference one. Link one article that describes how to boot from the CD and start a repair install - without first booting the installed system and running setup.exe on the CD. Link one article from a reliable source that proves you are not outright lying and I will apologise and give you your precious upvote.
    – Graeme
    Apr 10, 2016 at 16:45
  • See for example this video on how to do Startup Repair on Windows 10 from the installation media. If not, try to use the Command Prompt. As I said above, you might need s slipstreamed ISO - I have no idea if WIn10 installation contains the VirtIO drivers.
    – harrymc
    Apr 10, 2016 at 20:20
  • Or you may adapt the drvload method for adding the VirtIO drivers to the booted Windows PE installation image.
    – harrymc
    Apr 10, 2016 at 20:29
  • 2
    While the above answer sounds good and looks simple, unfortunately with my VM using the pc-q35-2.5 machine emulation/type, it's not possible to add an IDE controller.
    – JPvRiel
    Apr 18, 2017 at 18:08
10

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. ...
4
  • Please don't add "thanks" as answers. Invest some time in the site and you will gain sufficient privileges to upvote answers you like, which is the Super User way of saying thank you.
    – DavidPostill
    Jun 29, 2016 at 21:19
  • 2
    This is an underrated answer - in Proxmox Windows 10 had trouble initializing, even after installing all of the drivers. I had to create a small 1 GB disk as a VirtIO block device, start the VM, verify that it was appearing correctly, and then shut down + change the main drive to VirtIO. Windows 10 didn't correctly detect the HDD driver, so I had to coax it to load it on boot before making the switch.
    – Albert H
    Mar 19, 2018 at 5:23
  • 1
    This is the best answer! I think it could be streamlined though: 1: before booting, add second "dummy" virtio disk 2: boot vm, download drivers, open device manager, update driver for second disk 3: shut down VM, remove second disk, update main disk device type to virtio fedorapeople.org/groups/virt/virtio-win/direct-downloads/…
    – ThankYee
    Jan 6, 2020 at 12:49
  • This is the solution that worked for me, and is also one of the easiest. :)
    – Geoff
    Dec 16, 2020 at 15:42
7

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."

4
  • Thanks for giving so many details, this is the most workable solution! One regfile to import and solve it all. Nov 19, 2019 at 2:12
  • 1
    You can use this powershell one-liner to change all of them: gci hklm:/system/ControlSet001/Services/*/StartOverride | Set-ItemProperty -name 0 -val 0 May 27, 2020 at 15:43
  • 1
    This is the only solution that worked for me. There were so many STARTOVERRIDE's set to 3 so I made a wild guess that my IDE drive was being serviced by pciide and changed that alone and it worked fine. @RafaelKitover, I could not find that gci command in my installation.
    – AnthonyK
    Nov 1, 2020 at 15:21
  • The specific driver under ControlSet001\Services that is needed to allow booting from a virtio boot disk is the one called "viostor" Sep 14, 2021 at 3:11
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.