23

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

  • +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 '16 at 19:01
  • 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 '16 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 '16 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 '16 at 21:21
  • @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 '16 at 10:51
14

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. Open an elevated command prompt and set the VM to boot into safe mode by typing

    bcdedit /set {current} safeboot minimal

  2. shut-down the VM and change the boot device type to virtio.

  3. boot the VM. It will enter in safe mode.

    Note: In Safe mode all boot-start drivers will be enabled and loaded, including the virtio driver. 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 and not disable it again.

  4. in the booted VM reset the bcdedit settings to allow the machine to boot into the Normal mode by typing (in elevated command prompt again):

    bcdedit /deletevalue {current} safeboot

  5. Done.

  • 1
    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. – Charles Green Oct 5 '17 at 18:13
  • 2
    @CharlesGreen {current} is literal, you type in as-is. – Marc.2377 Feb 17 '18 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/… – Andrew Olney Feb 27 '18 at 17:35
  • I tried with bcdedit /set {current} safeboot network in step one to avoid the logon problem, I also first created a local user to be extra safe and I don't really think the problem applied to me anyway, but since the machine is connected to a domain and I don't have controll of everything I wanted to make sure I didn't do anything wrong. And the network parameter did at least not spoil the process. – HackerBaloo Aug 6 '18 at 14:23
  • how do you do 1), that is, the elevated prompt? – Frederick Nord Feb 7 at 0:44
10

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 :

  • 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 '16 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 '16 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 '16 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 '16 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 '17 at 18:08
10

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 both windows 10 DVD/CD ISO and virtio driver ISO to VM.
  2. Boot off windows 10 DVD/CD and get into a command prompt from repair mode option.
  3. Load the driver via the CLI e.g. drvload e:\viostor\w10\amd64\viostor.inf
    • In my case e: was where the virtio install ISO got assigned.
    • After loading the driver f: was where the windows install became mounted.
  4. 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, for this niche case, I'd suggest avoiding startup repair (which failed for me). It didn't seem to know how to include vistor.inf after loading it, and if you do try it, be careful to avoid Windows 10's DVD eagerness to restore or reinstall everything...

Credit for DISM approach: Using dism to add drivers

  • 1
    Alternative to 4: Right click the inf file -> Install. – rbs Sep 7 '17 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 '18 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 '18 at 19:15
4

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
  3. Switch the boot disk to virtio
  4. Reboot
  5. Remove the additional "dummy" virtio disk
  6. ...
  • 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 '16 at 21:19
  • 1
    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 '18 at 5:23
1

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

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.