Slipstreaming Proxmox Virtio Drivers into Windows 10

Add drivers for VirtIO paravirtualized hardware to the Windows 10 installation media.


VirtIO Drivers are paravirtualized drivers for kvm/Linux (see http://www.linux-kvm.org/page/Virtio).

In short, they enable direct (paravirtualized) access to devices and peripherals for virtual machines using them, instead of slower, emulated, ones.

A quite extended explanation about VirtIO drivers can be found here http://www.ibm.com/developerworks/library/l-virtio.

Windows does not have VirtIO drivers included. However, the Fedora project provides CD ISO images with compiled and signed VirtIO drivers. These drivers must be downloaded and manually added during the Windows 10 installation.

This walkthrough details how to inject (slipstream) the drivers into your Windows 10 image – making installation a breeze!


Note: To complete this walkthrough, you will need a woking installation of Windows 10


Warning: The created ISO file currently does not support EFI BIOS. I am in the process of debugging this problem. Until resolved use the default SEABIOS option in Proxmox.


Download and install the Windows ADK

In order to modify the Windows Imaging Format (WIM) we need to install some tools that are part fo the Windows Assessment and Deployment Kit (Windows ADK).

Download the Windows ADK for Windows 10, version 2004

When you run the ADK installation tool, you will be presented with the following wizard steps.

Specify Location

Windows Kits Privacy

License Agreement

Select the features you want to install

De-select all options except for “Deployment Tools”.

Installing features

Installation complete

Download Windows 10

The next step is to download an ISO of the Windows 10 installation media. If you are running Windows the easiest way to do this is to use the Windows 10 Media Creation Tool.

Head to https://www.microsoft.com/en-ca/software-download/windows10

Click the Download tool now button.

Running the Media Creation Tool

Accept the License Agreement

Create installation media

Select Language, architecture and edition

Select 64-bit(x86) only, otherwise slipstreaming becomes more complicated.

Choose which media to use

Downloading…

After selecting the location to save the ISO (desktop is fine), the ISO file will be downloaded. This step will take some time because the file is close to 4gb.

Download complete

When the download is complete, click finish. We do not need to burn the ISO because Proxmox can read the file directly.

Download Windows 10 (on a non Windows machine)

If you try to download the Windows 10 ISO (https://www.microsoft.com/en-ca/software-download/windows10) on a machine that is not running Windows, the process is much simpler. You will automatically be redirected to the following page.

Select edition

Select product language

Finally select 64-bit Download

Downloading the VirtIO drivers

An ISO of the VirtIO drivers can be downloaded from:
https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso

Creating the working folder

  • Create a working folder – I tend to use c:\win10.
  • Mount the Windows 10 ISO file by double clicking it.
  • Copy all the files from the Windows 10 ISO into your working folder.
  • Create a folder called drivers inside your working folder
  • Mount the VirtIO drivers ISO by double clicking it.
  • Copy all the files from the VirtIO ISO into the drivers folder.

After completing these steps, you will have a folder structure that looks like this –

Install.esd vs Install.wim

Microsoft has started distributing Windows 10 builds in the install.esd format as opposed to insall.wim. The ESD (Electronic Software Download) is better for most end users because the file is significantly smaller due to better compression; however it is problematic for us because it cannot be directly modified.


Note: If you did not download the Windows 10 ISO using the above method and your working folder already contains a file called install.wim in the sources folder, you can skip the following step.


Converting install.esd to install.wim

Right click the new Start Menu item “Deployment and Imaging Tools Environment” and choose “Run as Administrator“.
Note: This item is inside the Windows Kits folder.

CD to the sources directory inside your working folder.

cd c:\win10\sources

The install.esd file can contain multiple Windows editions. Run the following command to list all the editions inside your image.

dism /Get-WimInfo /WimFile:install.esd

Your output will look something like this ..

Find the index number of the Windows 10 edition that you need. In the above example I want Windows 10 Pro; therefore Index 6.

Extract the desired Windows edition and convert it to the WIM file format.

dism /export-image /SourceImageFile:install.esd /SourceIndex:6 /DestinationImageFile:install.wim /Compress:max /CheckIntegrity

Image exporting can take a long time. Depending on your computer hardware, it takes about 10-30 minutes to complete. Go and make a cup of tea.


Optional: You can add multiple editions to your install.wim file ..

dism /export-image /SourceImageFile:install.esd /SourceIndex:1 /DestinationImageFile:install.wim /Compress:max /CheckIntegrity

Now delete the install.esd file (we no longer need it)

del c:\win10\sources\install.esd

Injecting the drivers

Now that we have an install.wim file, we can inject the VirtIO drivers into it. The basic process is –

  • Mount the Windows Edition (Index) inside the WIM file to a folder – this extracts all the files inside the WIM
  • Add the drivers to the mounted folder
  • Unmount the image, committing the changes made to the folder back to the image.

This process needs to be done to all the editions inside both boot.wim and install.wim.


Note: Boot.wim is the Windows Pre-installation (WinPE) environment that is used to run setup. It is basically a cutdown version of Windows that does not contain any of the shell. Boot.wim contains two images one for 32bit and one for 64bit.

We need to inject the VirtIO drivers into the boot image so that the devices can be detected in WinPE and install.wim so that the devices can be installed.


Using the Script

To simplify this process, I have created a script. If you wish to run these commands one by one, obviously you can – the script just makes things easier.

Create a file called virtioslip.cmd

notepad c:\virtioslip.cmd

Paste following script into the file

@echo off
rem //----------------------------------------------------------------------------
rem // virtioslip.cmd
rem //----------------------------------------------------------------------------
rem // my script to automate arch installations
rem //----------------------------------------------------------------------------
rem // Gareth Jones - gareth@gareth.com
rem //----------------------------------------------------------------------------

set WIN10=%1
set DRIVERS=%2
set EDITIONS=%3
set MOUNT=%temp%\mount

rem //----------------------------------------------------------------------------
rem // create temporary mount directory
rem //----------------------------------------------------------------------------
md %MOUNT%

rem //----------------------------------------------------------------------------
rem // iterate through images in boot.wim injecting drivers
rem //----------------------------------------------------------------------------
for /l %%x in (1, 1, 2) do (
    dism /Mount-Image   /ImageFile:%WIN10%\sources\boot.wim /MountDir:%MOUNT% /Index:%%x
    dism /Add-Driver    /Image:%MOUNT% /Driver:%DRIVERS% /Recurse
    dism /Unmount-Image /MountDir:%MOUNT% /Commit
)

rem //----------------------------------------------------------------------------
rem // iterate through images in install.wim injecting drivers
rem //----------------------------------------------------------------------------
for /l %%x in (1, 1, %EDITIONS%) do (
    dism /Mount-Image   /ImageFile:%WIN10%\sources\install.wim /MountDir:%MOUNT% /Index:%%x
    dism /Add-Driver    /Image:%MOUNT% /Driver:%DRIVERS% /Recurse
    dism /Unmount-Image /MountDir:%MOUNT% /Commit
)

rem //----------------------------------------------------------------------------
rem // remove temporary mount directory
rem //----------------------------------------------------------------------------
rd %MOUNT%

rem //----------------------------------------------------------------------------
rem // make iso
rem //----------------------------------------------------------------------------
oscdimg -b%WIN10%\boot\etfsboot.com -m -o -u2 -lWinVirtio -udfver102 -bootdata:2#p0,e,b"%WIN10%\boot\etfsboot.com"#pEF,e,b"%WIN10%\efi\microsoft\boot\efisys_noprompt.bin" %WIN10% winvirtio.iso

Running the script to add the VirtIO drivers and create a new ISO image

Inside your Deployment and Imaging Tools Environment, run the virtioslip.cmd, passing in your working folder, drivers folder and the number of editions you exported. For example-

c:\virtioslip.cmd c:\win10 c:\win10\drivers 1

After some time a new file called winvirtio.iso will be created in you current folder.

Installing Windows in Proxmox

Copy this file to your Proxmox server and run your Windows installation.

scp win10virtio.iso root@IP:/var/lib/vz/template/iso/

Job done.

References:
1. Virtio: An I/O virtualization framework for Linux – https://developer.ibm.com/articles/l-virtio/
2. Paravirtualized drivers for kvm/Linux – http://www.linux-kvm.org/page/Virtio
3. Proxmox : Windows VirtIO Drivers – https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers
2. Download and install the Windows ADK – https://docs.microsoft.com/en-us/windows-hardware/get-started/adk-install
3. Download Windows 10 – https://www.microsoft.com/en-ca/software-download/windows10
4. How to Convert ESD to WIM File on Windows 10 – https://theitbros.com/convert-windows-esd-file-to-windows-wim-file/

Leave a Reply