Shop Talk – Tools For Running LInux VMs On Azure

I’ve always rooted for the underdog – while my friends were excited about the Ford Mustang, the Pontiac GTO, or even the vaunted Chevy Nova, I was a fan of more modest means.  In high school, my grandfather passed down a very-immobile 1955 Plymouth Belvedere, and I thought it was cooler than any hot rod out there.  As an IT guy, I still continue to pull for the little guy – instead of learning Microsoft technologies, I started my career as a Linux administrator before branching out into infrastructure.  In this Shop Talk, we’ll detail two critical tools in order to get Linux VMs working on Azure; Linux Integration Services for Hyper-V and the Azure Linux Agent (waagent). 

The 1955 Plymouth Belvedere – A True Gentleman’s Ride
55_belvedere

Linux integration services (LIS) for Hyper-v

Microsoft has developed a series of tools known as Linux Integration Services for Hyper-V.  If you’re familiar with VMware Tools or Citrix XenServer tools, Linux Integration Server tools are the functional equivalent for Hyper-V.  Linux Integraton Services perform the same general services (driver support, time sync, and additional hypervisor support) . 

•Driver support: Linux Integration Services supports the network controller and the IDE and SCSI storage controllers that were developed specifically for Hyper-V.
•Fastpath Boot Support for Hyper-V: Boot devices now take advantage of the block Virtualization Service Client (VSC) to provide enhanced performance.
•Time Keeping: The clock inside the virtual machine will remain accurate by synchronizing to the clock on the virtualization server via Timesync service, and with the help of the pluggable time source device.
•Integrated Shutdown: Virtual machines running Linux can be shut down from either Hyper-V Manager or System Center Virtual Machine Manager by using the “Shut down” command.
•Symmetric Multi-Processing (SMP) Support: Supported Linux distributions can use multiple virtual processors per virtual machine. The actual number of virtual processors that can be allocated to a virtual machine is only limited by the underlying hypervisor.
•Heartbeat: This feature allows the virtualization server to detect whether the virtual machine is running and responsive.
•KVP (Key Value Pair) Exchange: Information about the running Linux virtual machine can be obtained by using the Key Value Pair exchange functionality on the Windows Server 2008 virtualization server.
•Integrated Mouse Support: Linux Integration Services provides full mouse support for Linux guest virtual machines.
•Live Migration: Linux virtual machines can undergo live migration for load balancing purposes.
•Jumbo Frames: Linux virtual machines can be configured to use Ethernet frames with more than 1500 bytes of payload.
•VLAN tagging and trunking: Administrators can attach single or multiple VLAN ids to synthetic network adapters.
•Static IP Injection: Allows migration of Linux virtual machines with static IP addresses.
•Linux VHDX resize: Allows dynamic resizing of VHDX storage attached to a Linux virtual machine.
•Synthetic Fibre Channel Support: Linux virtual machines can natively access high performance SAN networks.
•Live Linux virtual machine backup support: Facilitates zero downtime backup of running Linux virtual machines.
•Dynamic memory ballooning support: Improves Linux virtual machine density for a given Hyper-V host.
•Synthetic video device support: Provides improved graphics performance for Linux virtual machines.
•PAE kernel support: Provides drivers that are compatible with PAE enabled Linux virtual machines.

Details – Linux Integration Services for Hyper-V

Checking for LIS Installation

To validate that LIS is installed on your Linux OS, you’ll need to perform two steps – search for the required LIS kernel modules, and (if installed) validate the LIS kernel modules installed.  

Searching for LIS Kernel Modules

1.  From a command prompt or terminal session, execute the following command (with escalated privileges), keeping an eye out for kernel modules (files ending with the “.ko” extension).  In this example on my Ubuntu test VM, I get the following result –

azuremechanic@ubuntu:~$ sudo find / -name hv*.ko
[sudo] password for azuremechanic:
/lib/modules/3.19.0-25-generic/kernel/drivers/scsi/hv_storvsc.ko
/lib/modules/3.19.0-25-generic/kernel/drivers/net/hyperv/hv_netvsc.ko
/lib/modules/3.19.0-25-generic/kernel/drivers/hv/hv_vmbus.ko
/lib/modules/3.19.0-25-generic/kernel/drivers/hv/hv_balloon.ko
/lib/modules/3.19.0-25-generic/kernel/drivers/hv/hv_utils.ko

Validating LIS Kernel Module Information

1.  Using the kernel modules identified in the previous step, execute the modinfo command to get additional information about the installed kernel modules.  In this first example, we see the pre-installed kernel modules on my Ubuntu test VM.

azuremechanic@ubuntu:~$ modinfo /lib/modules/3.19.0-25-generic/kernel/drivers/scsi/hv_storvsc.ko
filename:       /lib/modules/3.19.0-25-generic/kernel/drivers/scsi/hv_storvsc.ko
description:    Microsoft Hyper-V virtual storage driver
license:        GPL
srcversion:     117D4F2367B3504348190F8
alias:          vmbus:4acc9b2f6900f34ab76b6fd0be528cda
alias:          vmbus:32264132cb86a2449b5c50d1417354f5
alias:          vmbus:d96361baa104294db60572e2ffb1dc7f
depends:        hv_vmbus
intree:         Y
vermagic:       3.19.0-25-generic SMP mod_unload modversions
signer:         Magrathea: Glacier signing key
sig_key:        6A:AA:11:D1:8C:2D:3A:40:B1:B4:DB:E5:BF:8A:D6:56:DD:F5:18:38
sig_hashalgo:   sha512
parm:           storvsc_ringbuffer_size:Ring buffer size (bytes) (int)
parm:           storvsc_vcpus_per_sub_channel:int
parm:           vcpus_per_sub_channel:Ratio of VCPUs to subchannels

Note the difference when using the newer 4.0 version, on a CentOS 6.7 VM with a manual LIS install.

[root@localhost microsoft-hyper-v]# /sbin/modinfo hv_storvsc
filename:       /lib/modules/2.6.32-573.el6.x86_64/extra/microsoft-hyper-v/hv_storvsc.ko
alias:          vmbus:4acc9b2f6900f34ab76b6fd0be528cda
alias:          vmbus:32264132cb86a2449b5c50d1417354f5
alias:          vmbus:d96361baa104294db60572e2ffb1dc7f
version:        4.0.11
description:    Microsoft Hyper-V virtual storage driver
license:        GPL
srcversion:     9458237FE2EE2CC29FBD76D
alias:          vmbus:4acc9b2f6900f34ab76b6fd0be528cda
alias:          vmbus:32264132cb86a2449b5c50d1417354f5
alias:          vmbus:d96361baa104294db60572e2ffb1dc7f
depends:        hv_vmbus
vermagic:       2.6.32-573.el6.x86_64 SMP mod_unload modversions
parm:           logging_level:Logging level, 0 – None, 1 – Error (default), 2 – Warning. (int)
parm:           storvsc_ringbuffer_size:Ring buffer size (bytes) (int)
parm:           storvsc_vcpus_per_sub_channel:int
parm:           vcpus_per_sub_channel:Ratio of VCPUs to subchannels

Manual LIS Installation

To perform a manual LIS installation for custom deployments, or in the event your distribution does not come with LIS drivers pre-installed, follow these steps (in this demo, performed on a CentOS 6.7 VM) – 

  1. Download LIS from in your preferred format (TAR or ISO formats are both offered by Microsoft; TAR will be used in this guide)
  2. Copy the LIS files to your Linux VM
  3. Extract the TAR file to a local directory –

[azuremechanic@localhost Downloads]$ tar zxvf lis4-0-11.tar.gz

   Quick refresher – the “zxvf” switches provide the tar command with some specific instructions.  These are noted below. 

   z – Instructs tar that the file is compressed with “gunzip” compression. 
   x – Extract all files in this archve
   v – Executes the tar command in verbose mode
   f – Instructs tar to use a specified archive (which we state after the options)

  4.  Perform the install by executing the install.sh script as root. 

[azuremechanic@localhost lis4.0.11]$ su
Password:
[root@localhost lis4.0.11]# ./install.sh
Removing Hyper-V daemons
Invoking release specific install file in directory RHEL67
Installing the Linux Integration Services for Microsoft Hyper-V…
Preparing…                ########################################### [100%]
    1:kmod-microsoft-hyper-v ########################################### [100%]
Preparing…                ########################################### [100%]
    1:microsoft-hyper-v      ########################################### [100%]
Saving old initramfs
Installing new initramfs
Adding KVP Daemon to Chkconfig….
Starting KVP Daemon….
Adding VSS Daemon to Chkconfig….
Starting VSS Daemon….
Adding FCOPY Daemon to Chkconfig….
Starting FCOPY Daemon….
  Linux Integration Services for Hyper-V has been installed. Please reboot your system.


5.  Reboot your system per the prompt.

6.  Validate the install per the previous step. 

Azure Linux Agent (waagent)

waagent is the Azure Linux Agent that controls communication between the underlying Azure Fabric and a Linux VM.  The list below is not exhaustive, but covers the primary functions of the Azure Linux Agent on an Azure Linux VM. 

  • Image Provisioning

    • Create a user account
    • Configure SSH authentication types
    • Deploy SSH public keys and key pairs
    • Sets the host name
    • Publishes the host name to the platform DNS
    • Reports SSH host key fingerprint to the platform
    • Manages the resource disk
    • Formats and mounts the resource disk
    • Configures swap space
  • Networking
    • Manages routes to improve compatibility with platform DHCP servers
    • Ensures the stability of the network interface name
  • Kernel
    • Configures virtual NUMA
    • Consumes Hyper-V entropy for /dev/random
    • Configures SCSI timeouts for the root device (which could be remote)
  • Diagnostics
    • Redirects the console to the serial port
  • SCVMM Deployments
    • Detects and bootstraps the VMM agent for Linux when running in a System Center Virtual Machine Manager 2012 R2 environment
  • VM Extension

Introduction – Azure Linux Agent User Guide

Installing waagent

No Linux distribution comes with waagent installed by default – you will need to obtain the Azure Linux Agent in one of two ways; using a package manager or by manually

Using A Package Manager

This is the recommended practice for obtaining and installing the waagent executable.  This will differ based on the distribution you are using – consult your distribution’s documentation for further detail.  In our example below, we will be using apt-get to install the waagent on an Ubuntu VM –

1.)  From a command-line or terminal session, execute the “apt-get install waagent” command.  This will also install any required prerequisites. 

azuremechanic@ubuntu:~$ sudo apt-get install waagent
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
   python-pyasn1
Suggested packages:
   doc-base
The following NEW packages will be installed:
   python-pyasn1 waagent
0 upgraded, 2 newly installed, 0 to remove and 11 not upgraded.
Need to get 79.4 kB of archives.
After this operation, 513 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1
http://us.archive.ubuntu.com/ubuntu/ trusty/main python-pyasn1 all 0.1.7-1ubuntu2 [44.2 kB]
Get:2
http://us.archive.ubuntu.com/ubuntu/ trusty/universe waagent amd64 1.3.2-1 [35.2 kB]
Fetched 79.4 kB in 0s (131 kB/s)
Selecting previously unselected package python-pyasn1.
(Reading database … 56497 files and directories currently installed.)
Preparing to unpack …/python-pyasn1_0.1.7-1ubuntu2_all.deb …
Unpacking python-pyasn1 (0.1.7-1ubuntu2) …
Selecting previously unselected package waagent.
Preparing to unpack …/waagent_1.3.2-1_amd64.deb …
Unpacking waagent (1.3.2-1) …
Setting up python-pyasn1 (0.1.7-1ubuntu2) …
Setting up waagent (1.3.2-1) …

2.)  Validate the version using the “waagent version” command

azuremechanic@ubuntu:~$ waagent version
WALinuxAgent-1.3.2 running on Ubuntu

Manual waagent Installation

In our final example, we’ll manually copy over the waagent executable and install it.  Again, we’ll use our Ubuntu VM to complete the process  –

  1. Copy the waagent file from the github repository to /usr/sbin.   
  2. Modify the permissions of the file using the chmod command

azuremechanic@ubuntu:~$ sudo chmod 755 /usr/sbin/waagent

3.   Run the file using the –install and –verbose switches

azuremechanic@ubuntu:~$ sudo /usr/sbin/waagent –install –verbose

4.  Validate the version using the “waagent version” command

azuremechanic@ubuntu:~$ waagent version
WALinuxAgent-2.0.15 running on Ubuntu

Supportablility

It is worth nothing that each of these tools supports a different subset of Linux distributions available.  The table below lists supported versions for each tool and any known dependencies required for install. 



Tool Linux Integration Services (v4.0) Azure Linux Agent (waagent)
Applicable Linux Distributions
  • Red Hat Enterprise Linux 5.5-5.11 32-bit, 32-bit PAE, and 64-bit
  • Red Hat Enterprise Linux 6.0-6.7 32-bit and 64-bit
  • Red Hat Enterprise Linux 7.0-7.1 64-bit
  • CentOS 5.5-5.11 32-bit, 32-bit PAE, and 64-bit
  • CentOS 6.0-6.7 32-bit and 64-bit
  • CentOS 7.0-7.1 64-bit
  • Oracle Linux 6.4-6.7 with Red Hat Compatible Kernel 32-bit and 64-bit
  • Oracle Linux 7.0-7.1 with Red Hat Compatible Kernel 64-bit
  • CoreOS
  • CentOS 6.2+
  • Debian 7.0+
  • Ubuntu 12.04+
  • openSUSE 12.3+
  • SLES 11 SP2+
  • Oracle Linux 6.4+
Dependencies None known/applicable
  • Python 2.6+
  • Openssl 1.0+
  • Openssh 5.3+
  • Filesystem utilities: sfdisk, fdisk, mkfs, parted
  • Password tools: chpasswd, sudo
  • Text processing tools: sed, grep
  • Network tools: ip-route

next steps/Additional documentation

This long Shop Talk covered both Linux Integration Services and the Azure Linux Agent, which are critical components to deploying custom Linux VMs in Azure.  The links below provide additional information on both tools we covered.  Keep in mind – while some distributions ship with Linux Integration Services pre-installed, Microsoft recommends that you deploy the latest versions of each tools to ensure optimized performance and compatibility for your Linux VMs. 

Linux Integration Services Version 4.0 for Hyper-V [HTTP]
github – Microsoft Azure Linux Agent [HTTP]
Azure Linux Agent User Guide [HTTP]
Azure-Endorsed Linux Distributions [HTTP]

Leave a Reply