Skip to content

Instantly share code, notes, and snippets.

@extremecoders-re
Last active January 2, 2024 15:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save extremecoders-re/5122fa11734152175ea494cebb3f9fc0 to your computer and use it in GitHub Desktop.
Save extremecoders-re/5122fa11734152175ea494cebb3f9fc0 to your computer and use it in GitHub Desktop.
Windows VPS on SolusVM not booting due to VirtIO drivers not being loaded at boot time

This writeup describes the process to fix Windows not booting on a VirtIO disk. The VPS only boots when changing the "Disk Driver" to IDE on SolusVM. When the disk device is VirtIO windows fails to boot with an INACCESSIBLE_BOOT_DEVICE error.

The issue was likely caused due to installation of OSFMount software previously.

Creating a full disk image

Before starting, a full disk image of the VPS may be taken for safety. Enable rescue mode in SolusVM. It will then display the SSH connection credentials. Connect to the server using the same credentials from another server which has sufficient disk space to store the full disk image. Run lsblk to list the disk drives attached to the system. To inspect the disk manually, run mount in readonly mode as shown.

# mount -o ro /dev/vda1 /mnt

Individual files can then be copied out if necessary using scp, rsync, File Zilla etc. When done unmount the partition.

# umount /mnt

To take a full disk image (logout from the VPS if necessary) run the following command locally on the system where the backup image will be stored.

ssh root@10.0.0.1 "dd if=/dev/vda bs=4M conv=sparse | gzip -1 -" | dd bs=100M of=diskimage.gz

The entire process will take hours to complete depending on the size of the disk and the network speed. Hence if the backup VPS is geographically near to the broken VPS the process may be faster.

On Windows dd can be downloaded from http://www.chrysocome.net/dd. The block size parameter may be changed/increased for faster transfer speeds. Once done rescue mode may be disabled on the VPS.

Injecting drivers to the boot environment

Make sure the Disk Driver is set to virtio in SolusVM. Reboot the VM. From henceforth use the VNC feature in SolusVM to access the VPS. Windows would fail to boot and load the recovery environment instead. At this point start the Shell from the Recovery Environment. The shell would usually start from the X:\ drive. To change to other drive simply type C:\, D:\ etc.

The drive letter mappings can also be found out by running

wmic logicaldisk get deviceid, volumename, description

At this stage trying to change to the primary partition like C:\ would result in a "Device not ready" or similar error. It indicates that is the primary partition. Windows can't read it as it is using VirtIO and the drivers for it are not loaded.

Next mount the VirtIO drivers ISO file from SolusVM. This is available in the "Drivers" tab on SolusVM dashboard. Once mounted, run the following command to load the viostor driver as follows.

drvload d:\viostor\2k19\amd64\viostor.inf

2k19 is for Windows Server 2019

Now changing to the primary partition would not show an error as the driver is already loaded. Run dir to confirm it is indeed the primary partition. The usual files and directories under C:\ should be visible.

The next step is to inject the VirtIO storage driver to the Windows Boot environment. This can be done by running the following command

dism /image:c:\ /add-driver /driver:d:\viostor\2k19\amd64\viostor.inf
  • The drive letter after /image is the primary partition where Windows is installed. The C:\ drive in a Standard Windows installation
  • The path to viostor.inf points to the virtio ISO image loaded in the CD drive

At this point exit the recovery command prompt and shut down the system. Remove the VirtIO ISO from the CD drive and restart the system. The VPS would be up and running normally now.

General References

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