Install Linux Integration Services (LIS) on Hyper-V VM

PowerADM.com / Linux / CentOS / Install Linux Integration Services (LIS) on Hyper-V VM

If you are deploying a Linux virtual machine on a Hyper-V host, you must install Linux Integration Services (LIS) in the guest operating system. Hyper-V Linux Integration Services allow the guest OS to interact with the host: send its state to the hypervisor, perform backups via VSS, correctly reboot and shutdown the Linux guest. In this tutorial, we’ll take a look at how to install Hyper-V Linux Integration Services on popular Linux distros – CentOS, Debian, and Ubuntu.

LIS in Hyper-V is similar to the VMware Tools in ESXi and the QEMU guest agent in Proxmox.

Install Hyper-V Linux Integration Services on Ubuntu

Before installing Hyper-V Linux Integration Services in an Ubuntu virtual machine, you must add hv_modules to initramfs-tools:

# echo 'hv_vmbus' >> /etc/initramfs-tools/modules
# echo 'hv_storvsc' >> /etc/initramfs-tools/modules
# echo 'hv_blkvsc' >> /etc/initramfs-tools/modules
# echo 'hv_netvsc' >> /etc/initramfs-tools/modules

add hyper-v Linux Integration Services into initramfs-tools on ubuntu

Then update the apt packages:

# apt update && apt -y upgrade

Now you need to install the Hyper-V integration packages for Ubuntu:

# apt -y install linux-virtual linux-cloud-tools-virtual linux-tools-virtual
# update-initramfs -u
# reboot

Check that the LIS integration features are installed:

# lsmod | grep hv

The command will display a list of loaded Hyper-V modules.

check hyper-v services in linux guest VM

On Ubuntu 16.04, 18.04, 20.04, and 22.04 LTS, you can install the Hyper-V integration drivers that Microsoft uses for VMs in Azure:

# apt update
# apt install linux-azure

Check the version of the Linux Integration Services kernel modules with the command

# /sbin/modinfo hv_vmbus

filename: /lib/modules/2.6.32-71.el6.x86_64/extra/microsoft-hyper-v/hv_vmbus.ko
version: <strong>4.3.5</strong>

If you have an older version of LIS installed on Ubuntu, you can update it using the commands below:

# wget https://download.microsoft.com/download/6/8/F/68FE11B8-FAA4-4F8D-8C7D-74DA7F2CFC8C/lis-rpms-4.3.5.x86_64.tar.gz
# tar -xzf lis-rpms-4.3.5.x86_64.tar.gz
# cd LISISO/
# ./upgrade.sh
# reboot

Check the hv_vmbus version after the upgrade:

# /sbin/modinfo hv_vmbus

Enable Hyper-V Linux Integration Services on Debian

In Debian 9 and earlier, you need to manually add the Hyper-V LIS modules to the initramfs:

# nano /etc/initramfs-tools/modules

Add the following options:

hv_vmbus
hv_storvsc
hv_blkvsc
hv_netvsc

Install Hyper-V integration components and reboot Debian:

# apt-get install -t jessie-backports hyperv-daemons
# update-initramfs -u
# reboot

Linux Integration Services kernel modules are included in the default Debian 10 (Buster) distro, and you only need to install Hyper-V Integration Services from the official Debian repository:

# apt-get install hyperv-daemons
# reboot

The new Debian 11 (Bullseye) has both LIS and hyper-v daemons installed by default, so there is no need to install anything separately.

Check that the hyperv daemons are configured to start automatically:

# systemctl status hyperv-daemons.hv-*

How to install Hyper-V Linux Integration Services on CentOS?

Linux Integration Services components are already contained in the base CentOS image and don’t need to be installed separately (CentOS 6.4 and newer). However, there are several additional Hyper-V Guest Services that can improve the communication between Hyper-V and the CentOS guest:

  • VSS daemon (used for snapshot backups) – hypervvssd package;
  • File copy daemon (allows you to use PowerShell to copy files directly between VM and host via VMbus) and KVP data exchange service – hypervfcopyd package.

These services are installed from the base CentOS repositories:

# yum install hyperv-daemons
# yum list installed | grep hyperv

Start the service:

# systemctl enable hypervkvpd hypervvssd
# systemctl start hypervkvpd hypervvssd

After installation, reboot the VM and check that the Hyper-V VSS daemon service is running:

# systemctl status hypervvssd

On older versions of CentOS 6, Hyper-V Integration Services can be installed from the Linux Integration Services (LinuxIC) CD. Download LIS 4.3 ISO image from here Linux Integration Services v4.3 for Hyper-V and Azure.

Or you can install the Hyper-V integration component from the EPEL repository:

# yum install epel-release
# yum install hyperv-daemons
# reboot

Check that Hyper-V Integration Services are running on CentOS 6:

# service --status-all | grep hv_*

hv_fcopy_daemon is stopped
hv_kvp_daemon (pid 1121) is running...
hv_vss_daemon (pid 1329) is running...

If you try to back up a Linux VM with CentOS guests using any tool with VSS support, the log should contain lines from the hv_vss_daemon service:

# tail -f /var/log/messages | grep Hyper-V

Check that the hypervvssd service is running if VSS is not working properly:

# systemctl status hypervvssd

Managing Linux Integration Services in Hyper-V

After installing the Hyper-V Integration Components in a Linux VM, you can get information about the guest operating system from the Hyper-V host. To list the versions of the LIS components on Linux, run the following PowerShell command

Get-VM | Format-Table Name, IntegrationServicesVersion

PowerShell: Get-VM IntegrationServicesVersion

You can get the status of Hyper-V integration services on a specific VM:

Get-VMIntegrationService -VMName LinuxVM1
  • Guest Service Interface
  • Heartbeat
  • Key-Value Pair Exchange
  • Shutdown
  • Time Synchronization
  • VSS

Get-VMIntegrationService status with powershell

In this example, the Key-Value Pair Exchange shows “No Contact”. This may mean that the component is disabled in the guest Linux or disabled in the VM settings.

You can enable/disable the integration component for a VM using the commands:

  • Enable-VMIntegrationService -VMName LinuxVM1 -Name "Time Synchronization"
  • Disable-VMIntegrationService -VMName LinuxVM1 -Name "Time Synchronization"

Or you can enable/disable the specific integration service through the Hyper-V console (open VM settings and go to the Integration Services tab).

enable or disable hyper-v integration service

To copy files directly between Hyper-V and a Linux guest VM, you can use the PowerShell command:

Copy-VMFile -Name LinuxVM1 -SourcePath 'C:\pc\ifcfg-eth0' -DestinationPath '/etc/sysconfig/network-scripts/' -FileSource Host -Force

Enable Hyper-V Enhanced Session Mode for Ubuntu VM

You can use Enhanced session mode to connect to a Linux virtual machine on a Hyper-V host via RDP. In this mode, you will be able to use on Linux VM all the features that are available for Windows virtual machines in the Hyper-V connection console (clipboard, device redirection, large screen resolution, connection to an isolated VM via the vmbus, etc.).

In this example, we will enable Enhanced session mode on a virtual machine running Ubuntu 22.04 LTS:

  1. Check that the Generation 2 of Hyper-V virtual machines is used for the VM and Secure Boot support for Linux is enabled in the virtual hardware settings. In order for Secure Boot to work correctly, you need to change the template in the VM settings from “Microsoft Windows” to “Microsoft UEFI Certificate Authority”. If not, an error will be displayed during the VM boot:The image's hash and certificate are not allowed (DB).
    linux vm with gen2 and secure boot enabled
  2. Install Hyper-V  Linux Integration Services in the guest Ubuntu as described above;
  3. Install XRDP with XORGXRDP:
    $ wget https://raw.githubusercontent.com/Microsoft/linux-vm-tools/master/ubuntu/18.04/install.sh
    $ sudo chmod +x install.sh
    $ sudo ./install.sh
    
  4. Change the connection port in xrdp.ini:
    # nano /etc/xrdp/xrdp.ini
    

    port=3389

  5. Shut down the Ubuntu VM and use PowerShell commands to enable Enhanced session mode support on the Hyper-V host:
    Set-VMHost -EnableEnhancedSessionMode $true
    Set-VM -VMName yourUbuntuVM -EnhancedSessionTransportType HvSocket
  6. Now when you connect to your VM’s console through Hyper-V Manager, the advanced XRDP connection mode will always be used.
3 thoughts on “Install Linux Integration Services (LIS) on Hyper-V VM”
  1. Under Ubuntu Server version 24.04 running under Windows Server 2019 Standard HyperV you get the error message:

    PS C:\Users\Administrator.CODA> get-vmintegrationservice -vmname Ubuntu-Server-Phone-Backup

    VMName Name Enabled PrimaryStatusDescription SecondaryStatusDescription
    —— —- ——- ———————— ————————–
    Ubuntu-Server-Phone-Backup Guest Service Interface False OK
    Ubuntu-Server-Phone-Backup Heartbeat True OK
    Ubuntu-Server-Phone-Backup Key-Value Pair Exchange True OK The protocol version of the component installed in the virtual machine does not match the version expected by the hosting system
    Ubuntu-Server-Phone-Backup Shutdown True OK
    Ubuntu-Server-Phone-Backup Time Synchronization True OK
    Ubuntu-Server-Phone-Backup VSS True OK The protocol version of the component installed in the virtual machine does not match the version expected by the hosting system

    PS C:\Users\Administrator.CODA>

    According to the following, Microsoft says this is normal:

    https://learn.microsoft.com/en-us/troubleshoot/windows-server/virtualization/vm-integration-services-status-protocol-version-mismatch

    Is there any way to fix this or have the updated protocols simply not been ported into linux-virtual yet?

Leave a Reply

Your email address will not be published. Required fields are marked *