Install Hyper-V device drivers

Before provisioning a virtual machine (VM) image as an Azure VM, you must install Hyper-V device drivers. Microsoft provides these network and storage device drivers in their Linux Integration Services (LIS) for Hyper-V package.

Before you begin

Procedure

  1. Verify if the system has Hyper-V device drivers:
    # lsinitrd | grep hv
    drwxr-xr-x   2 root     root            0 Aug 12 14:21 usr/lib/modules/3.10.0-932.el10.x86_64/kernel/drivers/hv
    -rw-r--r--   1 root     root        31272 Aug 11 08:45 usr/lib/modules/3.10.0-932.el10.x86_64/kernel/drivers/hv/hv_vmbus.ko.xz
    -rw-r--r--   1 root     root        25132 Aug 11 08:46 usr/lib/modules/3.10.0-932.el10.x86_64/kernel/drivers/net/hyperv/hv_netvsc.ko.xz
    -rw-r--r--   1 root     root         9796 Aug 11 08:45 usr/lib/modules/3.10.0-932.el10.x86_64/kernel/drivers/scsi/hv_storvsc.ko.xz

    In case, all the drivers are not installed or even the hv_vmbus driver is listed, complete the remaining steps.

  2. Create the hv.conf file in the /etc/dracut.conf.d directory and add the following driver parameters:
    # vi hv.conf
    add_drivers+=" hv_vmbus "
    add_drivers+=" hv_netvsc "
    add_drivers+=" hv_storvsc "
    add_drivers+=" nvme "

    Ensure that you have added spaces after and before the double quotes add_drivers+=" hv_vmbus " to load unique drivers, in case other Hyper-V drivers already exist in the environment.

  3. Regenerate the initramfs image:
    # dracut -f -v --regenerate-all

Results

  1. Reboot the machine.
  2. Verify installation of drivers:
    # lsinitrd | grep hv

What to do next