Skip to main content

Overview

I was recently working with a customer on migrating some Rocky Linux VMs running on vSphere hosts to some Hyper-V hosts using Veeam Backup and Replication.  After the migration to Hyper VM, the customer received the following error when the VM tried to boot.

 

The issue is that the VM can’t boot in Hyper-V because it is having trouble finding the boot image and mounting the root file system. On further inspection, it was discovered that the Linux VM was missing the required Hyper-V drivers.  

Windows-based VMs do not run into this issue as they already have the required drivers available at boot.

 

Before Veeam can boot a migrated Rocky Linux VM in Hyper-V, the Rocky OS needs to have the proper Hyper-V drivers installed in the intramfs.img. Once the Hyper-V drivers are added to the initramfs.img the VM can boot and function correctly in the Hyper-V environment.   

 

This issue can be fixed after the VM is migrated by booting it to a Live CD and then adding the drivers. Veeam KB 2669—https://www.veeam.com/kb2669—details this procedure.

Another way is to prep the VM before the migration happens. I detail the required steps for Rocky Linux below.

 

Note: This blog post will focus on just the Rocky distribution, but the process is essentially the same for other distros. Consult your distro documentation and support for commands specific to your distro(s).

 

Procedure

The Rocky Linux distribution contains the Microsoft LIS (Linux Integration Services) drivers needed to boot on the Hyper-V hypervisor. These drivers need to be added to the initramfs.img before migration.

Before running the commands to add these drivers, it is recommended that you disable any running EDR/AV program to prevent it from blocking any modifications to the initramfs, img, or boot loader (grub).

Here are the Hyper-V drivers that need to be added.

Hyper-V Drivers:

  • hv_vmbus
  • hv_storvsc
  • hv_netvsc
  • hv_utils

The following steps will add the necessary Hyper-V drivers to the initramfs.img, ensuring that the Rocky Linux VM can boot and function correctly in the Hyper-V environment.

Step1.

Run the following commands to add the drivers to the initramfs.img: 

Command:

#Add Hyper-V Drivers:
dracut -f --add-drivers hv_vmbus --add-drivers hv_storvsc --add-drivers hv_netvsc --add-drivers hv_utils

 

Step 2.

Now let’s verify that the drivers were added successfully.

#Verify Drivers in Initramfs:
lsinitrd /boot/initramfs-$(uname -r).img | grep hv_

 

This command will return a list of Hyper-V drivers installed in initramfs.img.

 

Step 3.

Know you need to remove any old kernels and to clean up the boot loader.

#Remove old kernels and clean up /boot:  
dnf remove --oldinstallonly
df -h /boot

Step 4.

Once you have the vSphere VM prepped with the Hyper-V drivers, back it up one more time, then perform the recovery or migration process to Hyper-V through the Veeam server.  Your Rocky Linux VM will now boot! 

 

Don’t forget to enable your EDR/AV service on the migrated VM(s).

Conclusion

In conclusion, ensuring that the Hyper-V drivers are added to the initramfs.img is a crucial step before migrating a Rocky Linux VM from vSphere to Hyper-V using Veeam. This preparation guarantees that the VM will boot and operate seamlessly in the new environment, thereby facilitating a smooth and efficient migration process.

 

For more information regarding migrating VMs from vSphere to Hyper-V, please consult the Veeam Hyper-V Migration guide! https://www.veeam.com/resources/wp-veeam-hypervisor-migration-guide.html

 

Great post Joe.  Who knew adding these prior to migration was the solution.  😎


Thanks for sharing Joe….having initial migration conversations in my env. I assumed something like this would happen as I’m testing out XCP and have somewhat similar behavior there (not only with drivers, but having to change the boot type to uefi when importing into XCP).

Will bookmark this!


Very useful, thank you ​@vmJoe !


No doubt that this post are gonna help people in the future.

Thanks for share Joe!


Comment