Tuesday, September 07, 2010

IT From All Angles

Minimize
May 27

Written by: Matthew.Mattoon
Thursday, May 27, 2010 

Matthew H. Mattoon – blog.allanglesit.com

As part of virtualization on Hyper-V, there is the ability to use Para-virtualized drivers instead of using built-in drivers for slower, emulated devices. Para-virtualized drivers are simply device drivers that are written for native virtual devices. In other words they are not emulating a pre-existing physical device. The Path to Enlightenment is simply the method you use to take an operating system and enable it to use these synthetic devices.

In this article we will be describing the different methods of enabling enlightenment on Ubuntu Linux for the following 3 categories: Ubuntu 9.04 and Earlier, Ubuntu 9.10, and Ubuntu 10.04. Each of these distribution versions has significant differences which require sometimes slightly and sometimes major differences in procedure.

Methods of Enlightenment

The first method of enlightenment for Linux on Hyper-V is the release package from Microsoft, the Linux Integration Components (LIC), as of the time of this writing there are versions 1.0, 2.0, and the release candidate of 2.1. If you are using Hyper-V 2008 R2, then you will need to use version 2.0 or greater of the LIC. All versions of the LIC include vmbus, netvsc, storvsc, and blkvsc. In the release candidate of version 2.1 Microsoft has additionally incorporated time sync, heartbeat, and integrated shutdown into the vmbus, additionally 2.1 includes code which allows for SMP (multiple processors). Prior to this version you only received the synthetic device drivers for SCSI (storvsc), IDE (blkvsc), and networking (netvsc) plus the underlying vmbus (vmbus) architecture which all of the previous components depend upon. The biggest drawback to the LIC is the support statement that Microsoft has made. Currently the targeted distributions are very narrow (though much wider than when first released). Now of course Ubuntu is not one of the supported distributions (that would just be too easy). Due to this the LIC installer can be a bit tricky on Ubuntu.

The second method is by using a Linux kernel version which is newer than 2.6.32. This kernel must be compiled with the Hyper-V drivers out of the staging tree of the kernel source code. It can either be self-compiled or installed via a kernel install package. The primary difference between the Linux Integration Components and the kernel modules is that the kernel modules have been renamed to follow kernel coding standards, as such all modules that exist in the LIC have been prepended with hv_ so the modules are named hv_vmbus, hv_netvsc, hv_blkvsc, and hv_storvsc. Additionally please keep in mind that self-compiled kernels are NOT supported by Canonical (the company behind Ubuntu). As such if your system is production you should not use this option unless you are willing to self-support. Additionally there were fixes rolled into version 2.6.32.6 which allow the hv_vmbus module to properly handle SMP (multiple processors), so please ensure that you are taking advantage of this. Ultimately using the newer kernel method is preferable in most cases since we are able to bypass Microsoft’s installer which does not support Ubuntu.

Mouse Integration

When a user uses Hyper-V Management Console or System Center Virtual Machine Manager to connect to a VM and they begin to interact with the desktop via the mouse, they find themselves in an interesting situation where they are unable to reclaim their mouse pointer from the VM without entering a somewhat cryptic keystroke ctrl + alt + left arrow. Mouse integration provides for seamless interaction between the VM and the workstation being used to connect to the VM. If a VM Connect window is selected AND the mouse pointer is inside of the boundary of the VM’s desktop then the mouse commands will be sent to the guest. If these conditions are not met then the commands are sent to the workstation.

Mouse integration is currently achieved by installing the inputvsc module which was included in Citrix’s Project Satori. This installer has the same support statement as the LIC, meaning it is not supported on Ubuntu (though in some cases it does work). The inputvsc requires the vmbus module to be both installed and operable. The requirement for the vmbus module is not fulfilled by using the kernel included modules due to the existence of the hv_vmbus as a replacement for the vmbus module.

Linux Integration Components - Future Versions

Currently the code for the Linux Integration Components version 2.1 RC is in the linux-next source code, so unless some problems are discovered to warrant their removal they will be included in 2.6.35, this means that we can rely on the actual kernel modules to provide the ability to use synthetic devices as well as timesync, integrated shutdown, and heartbeat.

 

Method 1 - Use 2.6.32 Modules from Default Install (Ubuntu 10.04 only)

Easy Install

YES

SMP-Safe

YES

Mouse Integration Compatible

NO

Integrated Shutdown

NO

Pre-Release Software

NO

Configure Modules to Load on Boot

Add the following to /etc/initramfs-tools/modules

hv_vmbus

hv_storvsc

hv_blkvsc

hv_netvsc

# update-initramfs -u

Configure Synthetic Network Interface

Add the following to /etc/network/interfaces

auto seth0

iface seth0 inet dhcp

 

Method 2 - Install 2.6.32 Kernel Image from Lucid Repository (Ubuntu 9.10 and Earlier)

Easy Install

YES

SMP-Safe

YES

Mouse Integration Compatible

NO

Integrated Shutdown

NO

Pre-Release Software

NO

Download Kernel Image

# wget http://us.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-image-2.6.32-31-server_2.6.32-21.32_amd64.deb

Install Kernel Image

# dpkg -i linux-image-2.6.32-31-server_2.6.32-21.32_amd64.deb

Configure Modules to Load on Boot

Add the following to /etc/initramfs-tools/modules

hv_vmbus

hv_storvsc

hv_blkvsc

hv_netvsc

# update-initramfs -u -k 2.6.32-21-server

Configure Synthetic Network Interface

Add the following to /etc/network/interfaces

auto seth0

iface seth0 inet dhcp

 

Method 3 - Install 2.6.18 Kernel Image for Direct Installation of LIC v2.0 (Ubuntu 9.04 and Earlier)

Easy Install

NO

SMP-Safe

NO

Mouse Integration Compatible

YES

Integrated Shutdown

NO

Pre-Release Software

NO

Download Kernel Image and Headers

Add the following to /etc/apt/sources.list (comment out after completed with installation)

##Repositories which contain older versions of the linux kernel (needed for the Hyper-V Linux IC)

deb http://ftp.us.debian.org/debian etch main

deb http://security.debian.org/debian-security etch/updates main

Install Kernel Image, Headers, and Prerequisites

# apt-get install build-essential linux-image-2.6.18-6-amd64 linux-headers-2.6.18-6-amd64

Install Linux IC v2.0 (Assumes Files are Pre-staged in /opt/linux_ic-20/)

# cd /opt/linux_ic-20

# ./setup.pl drivers

Install Linux Inputvsc (Assumes Files are Pre-staged in /opt/linux_ic-input/) - Optional for Mouse Integration

# cd /opt/linux_ic-input

# ./setup.pl input

Configure Modules to Load on Boot

Add the following to /etc/initramfs-tools/modules

vmbus

storvsc

blkvsc

netvsc

inputvsc #Optional for Mouse Integration

# update-initramfs -u

Configure Synthetic Network Interface

Add the following to /etc/network/interfaces

auto seth0

iface seth0 inet dhcp

Reboot

 

Method 4 - Install 2.6.18 Kernel Image to for Direct Installation of LIC v2.1 (Ubuntu 9.04 and Earlier)

Easy Install

NO

SMP-Safe

YES

Mouse Integration Compatible

YES

Integrated Shutdown

YES

Pre-Release Software

YES

Download Kernel Image and Headers

Add the following to /etc/apt/sources.list (comment out after completed with installation)

##Repositories which contain older versions of the linux kernel (needed for the Hyper-V Linux IC)

deb http://ftp.us.debian.org/debian etch main

deb http://security.debian.org/debian-security etch/updates main

Install Kernel Image, Headers, and Prerequisites

# apt-get install build-essential linux-image-2.6.18-6-amd64 linux-headers-2.6.18-6-amd64

Install Linux IC v2.1 (Assumes Files are Pre-staged in /opt/linux_ic-21/)

# cd /opt/linux_ic-21

# ./setup.pl drivers

Install Linux Inputvsc (Assumes Files are Pre-staged in /opt/linux_ic-input/) - Optional for Mouse Integration

# cd /opt/linux_ic-input

# ./setup.pl input

Configure Modules to Load on Boot

Add the following to /etc/initramfs-tools/modules

vmbus

storvsc

blkvsc

netvsc

inputvsc #Optional for Mouse Integration

# update-initramfs -u

Configure Synthetic Network Interface

Add the following to /etc/network/interfaces

auto seth0

iface seth0 inet dhcp

Reboot

Copyright ©2010 Matthew.Mattoon

Tags:

14 comment(s) so far...

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

So basically everything will be much easier with the 2.6.35 kernel, as nothing would need to be done apart from simply install a Ubuntu VM in Hyper-V? It would be as simple as installing a Windows OS in Hyper-V? What about mouse integration? Thanks for your help in me trying to understand this.

By Jason404 on   Wednesday, June 02, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Hi Jason,

The 2.6.35 kernel will incorporate additional features into the kernel, basically the LIC 2.0 = 2.6.32 and the LIC 2.1 = 2.6.35.

The Mouse Integration was not included in 2.1 so it will not be in 2.6.35 kernel.

-matt

By Matthew.Mattoon on   Wednesday, June 02, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Thanks for a great article! It sounds like Ubuntu 9.04 + LIC v2.1 is the best option right now? (until kernel 2.6.35 is released and packaged for Ubuntu)

Also, is there a way to verify that the integration components are working properly? (eg. check network speed somehow? check disk performance?)

By John Klimek on   Friday, June 04, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Hi John,

My personal preference is using 10.04 + the built-in kernel modules. The ease of use and support is the better alternative for me. When the 2.6.35 is released I will be using it over the 2.6.32.

-matt

By Matthew.Mattoon on   Friday, June 04, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Thanks again so much for your help Matt.

Do you think that Ubuntu with the enlightenment components is just as fast as Windows Server? (ignoring differences in operating systems; I'm wondering if they are both operating at near "native" speed, etc)

I'd think that Windows Server would perform better simply because it was created with Hyper-V in mind, etc.

By John Klimek on   Friday, June 11, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

For Ubuntu, you have to adjust /etc/udev/rules.d/70-persistent-net.rules too. For example:
...
# PCI device 0x1011:0x0009 (tulip)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:1d:d8:b7:1c:c5", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="seth0"

Now Ubuntu will present "seth0" instead of "eth0".

By Jurgen Lamsens on   Friday, June 18, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Will have a try with latest 2.6.35 release candidate just to see if I can get vSMP working - that + better shutdown integration are the thing I'm really waiting for. This looks ais it's going to (almost) in par with the level of integration Windows Guests have.

By Mat on   Saturday, June 26, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

I'm trying to install Ubuntu Server 9.04 and the linux-headers are not to be found anywhere and complain that either 1. the package doesn't exist or 2. it's a broken package. I've fumbled around with it for 2-3 hours and can't seem to get things to work properly.

Are there additional steps for server that are not being described in these step-by-step instructions?

Errors:
root@UbuntuServer:/usr/src# apt-get install linux-headers-2.6.18-6-amd64
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
linux-headers-2.6.18-6-amd64: Depends: linux-kbuild-2.6.18 but it is not installable
Depends: gcc-4.1 but it is not installable
E: Broken packages

By Shane on   Tuesday, July 06, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment - Debian Etch repositories archived

I came across the same problem as Shane. Finally figured out the Etch repositories were archived earlier this year (2010), shortly around the time Matthew made this post. For method 3 and method 4, change the lines:

##Repositories which contain older versions of the linux kernel (needed for the Hyper-V Linux IC)
deb ftp.us.debian.org/debian etch main
deb security.debian.org/debian-security etch/updates main

to:

##Repositories which contain older versions of the linux kernel (needed for the Hyper-V Linux IC)
deb archive.debian.org/debian/ etch main

A note about the archiving of old Debian respositories is located at www.debian.org/distrib/archive

I successfully implemented method 4 after the repository change.

The post does not mention it but both setup Perl scripts result in errors related to udevcontrol, a tool that has been deprecated and does not exist in Ubuntu 9.04. Ignore them and continue with the instructions to modify /etc/initramfs-tools/modules as instructed.

By Conan on   Monday, July 26, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Is there no real distinction in regards to Windows virtualization use between Windows 7 and Windows Server 2008 R2 OSes other than one being called Windows Virtual PC and the other is getting branded Hyper-V.
I thought they both utilized the same structure under the surface being the only two MS OSes that support Intel's Virtual Technology hardware.

and if the above is some what true, then wouldn't it be feasible to be use the Linux Integration Components for Win7 VPCs without any differences of an issue that those trying to setup LIC on R2?

I managed to get Mepis 8.5 installed on Windows 7 Virtual PC, it does recognize my systems's SMP with the 2.6.32-1-mepis-smp kernel, but it does not have mouse support and the integration seems to be limited to just the Ctrl+Alt+Del button which will activate the shutdown panel in the guest OS offering to shutdown, log off, or restart.

Where I am really confused here is reading what you wrote about vmbus and the hv_vmbus modules?

So the vmbus module is the kernel compiled type? Does this mean users running dated Linux guests VMs likely have to install LinuxIC while those with more recent Linux kernels wont?

I tried that /sbin/modinfo vmbus from the Konsole of Mepis and it said modinfo: could not find the module vmbus

So I then tried the '/sbin/modfinfo hv_vmbus' next and it listed the following:

filename: /lib/modules/2.6.32-1-mepis-smp/kernel/drivers/staging/hv/hv_vmbus.ko
license: GPL
alias: pci:v00001414d00005353sv*sd*bc*sc*i*
alias: dmi*:svn*MicrosoftCorporation*:pn*VirtualMachine*:rn*VirtualMachine*:
depends:
staging: Y
vermagic: 2.6.32-1-mepis-smp SMP preempt mod_unload 686
parm: vmbus_irq:int
parm: vmbus_loglevel:int

Does this mean I am running LinuxIC 2.0?

and back to that vmbus and hv_vmbus confusion. I tried to install that inputvsc file and got the message.

Vmbus driver not installed!
Please install it and rerun.

Is this because of the whole vmbus being kernal and hv_vmbus being LinuxIC? Any idea where I should begin to correct this?

By diamondmm on   Sunday, August 08, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Diamondmm -

Unfortunately you are incorrect about the underlying functionality of hyper-v vs virtual pc. These are two completely different platforms. Hyper-v is an actual type 1 hypervisor meaning that it interacts directly with the hardware without needing to proxy through an existing os. Virtual pc while it does now take advantage of VT this is different.

Thus you Linux ic questions are not applicable but I will clarify anyways. The Linux kernel developers renamed the modules that are included in the kernel to include hv_ so the modules without them are the actual Microsoft package.

By Matthew.Mattoon on   Sunday, August 08, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

I've been using method one on a number of 10.04 (64bit) Ubuntu installs for the past few months. Ubuntu has proven to be rock solid and very fast on Hyper-V...until now. This morning I discovered that one of my VMs had been updated to 2.6.32-24 (the default install was 2.6.32-21), and synthetic networking (seth0) is no longer working. Fortunately I was able to boot into 2.6.32-21 until I can find a fix for this.

As a test, I installed 10.10 alpha (build 2010-08-22), and it appears that networking is also broken on 2.6.35. Any ideas?

By Jason McInnes on   Sunday, August 22, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Jason, I'm using Ubuntu Server 10.04-1 with kernel 6.2.35-14 and my network adapter is working as eth1.

Try using ifconfig -a to see what is the name of your adapter.

By Anderson Cassimiro on   Saturday, August 28, 2010

Re: Ubuntu and Hyper-V: The Paths to Enlightenment

Thanks Matthew and Jurgen. I use method 1.
Instead of # update-initramfs -u I had to run # update-initramfs -k all -u
Interfaces in /etc/network/interfaces and /etc/udev/rules.d/70-persistent-net.rules need to be labeled the same, doesn't matter whether it's eth0, seth0 or eth1.
It would be easier though if synthetic network would label itself seth0 all the time.

By Timur on   Thursday, September 02, 2010

Your name:
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment   Cancel 

Search IT From All Angles Blog

Minimize