Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save Francesco149/dc156cfd9ecfc3659469315c45fa0f96 to your computer and use it in GitHub Desktop.
Save Francesco149/dc156cfd9ecfc3659469315c45fa0f96 to your computer and use it in GitHub Desktop.

scenario: you have a windows vm failing to boot with INACCESSIBLE_BOOT_DEVICE and changing the disk type to ide or something else causes another bsod. how to you get it to boot up again without a physical machine?

download the stable virtio drivers from here, in iso form: https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso

add the iso to your qemu/virt manager config as a cd/dvd drive

windows should send you to the recovery mode screen, but if it doesn't you might have to run a windows install iso to get to it.

now open a command prompt from the recovery mode and do

loaddrv D:\viostor\w10\amd64\viostor.inf
dism /image:c:\ /add-driver /driver:d:\viostor\w10\amd64\viostor.inf

close the prompt and try to boot. if that still fails, you might need to rebuild the BCD (this happened in my case). so go back to recovery mode, open a cmd prompt and do:

loaddrv D:\viostor\w10\amd64\viostor.inf
bcdboot C:\Windows

you should be able to boot the vm now

in my case, I was converting a raw disk image from a physical install to a virtual machine, and this is what I had to do to get it to boot on qemu + ovmf

@mackshot
Copy link

Thank you. One note loaddrv has to be drvload

@KasemJaffer
Copy link

Thanks! It fixed the problem for me.

@codiflow
Copy link

codiflow commented Aug 14, 2022

Thanks a lot for this hint – it makes sense and most of the other "hints" I found on the internet were not fixing the issue where it was caused.
Currently it's working so far that I get the following screen and after pressing F8 followed by 7 it tries to start the system. I still might have another issue to solve. Just leave that here for others.

grafik

Here you find the same tutorial a bit more in detail: https://portal.nutanix.com/page/documents/kbs/details?targetId=kA00e000000kAWeCAM

@frosit
Copy link

frosit commented Jan 15, 2023

Thanks! Helped me a lot.

If you get an error while trying to execute above commands, check your disk letter assignments. You can use diskpart for this to check it and correct it. Just ensure your main partition is on C or adjust the commands with the right letters.

> diskpart # to get into diskpart

list disk  # show all disks
select disk {number} # Select the disk
list vol # show volumes

## To remove a letter from a volume, select it and remove it
## to assign a letter to a volume, select it and assign

select vol {number}
remove letter {letter} # e.g. C or F etc.

# to assign
assign letter {letter}

Also be careful with that bcdboot command and don't run it if not needed and uncertain of how it works. The boot files could be elsewhere and if they are not on C this creates additional boot files and that might mess up your overall installation but that really depends on what your doing. Just a warning as I spend quite some hours messing with boot files in the past, can't say it was a joyful time. (Win10+Win11 dual boot related)

p.s. I use shortcuts in the above command line example, you can execute both lis dis and list disk or for example execute sel vol instead of select volume.

@sickdyd
Copy link

sickdyd commented Sep 25, 2023

The instructions above solved my problem and the VM starts successfully.

Is there a way to automate this? We have a bunch of images and it would be nice to inject drivers programmatically.

@havengit
Copy link

Very Thanks for share the methord

@Djrfatjf
Copy link

I’m so freaking dumb, how am I add the iso to my qemu/virt manager config as a cd/dvd drive?

@PlayF0R3v3R
Copy link

I’m so freaking dumb, how am I add the iso to my qemu/virt manager config as a cd/dvd drive?

Add hardware - Storage - Device type: CDROM - Select or create custom storage: find your .iso by "browse local"

@Fuckingnameless
Copy link

i cant even use diskpart or chkdsk there are no disks listed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment