search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Building your own Debian Kernel packages for Hyper-V Support
Posted in Linux Server, Virtual Machine Manager | 24 Comments | 45,762 views | 07/01/2011 16:51

If you have a kernel image for your Linux virtual machine, it’s easy to upgrade your kernel for Hyper-V support.

1) Install a clean Debian virtual machine (Use emulated Ethernet card and 1 vCpu)

2) Use commands below to update your virtual machine:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
nano /etc/apt/sources.list (edit your source list if it needs)
apt-get update
aptitude update
apt-get install openssh-server (for ssh support)
apt-get install build-essential 
apt-get install ncurses-dev kernel-package fakeroot
apt-get install linux-headers-`uname -r`
apt-get install linux-source-`uname -r | awk -F"-" '{print $1}'`
cd /usr/src
wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.36.tar.bz2
bzip2 -d linux-2.6.36.tar.bz2
tar xf linux-2.6.36.tar
cd linux-2.6.36
cp /boot/config* ./.config
make menuconfig

At menuconfig, go to:

Device Drivers -> Stagging Drivers

Now choose Microsoft Hyper-V Client Drivers

After that you can enter to exit with saving changes.

Use commands below to continue:

1
2
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-hyperv kernel_image kernel_headers

After this process, you will find your two .deb files in /usr/src directory.

Possible problems:

1) You may get this error when you try to compile kernel.

1
2
3
4
5
6
This is kernel package version 11.015.
The UTS Release version in include/linux/version.h
"" 
does not match current version:
"2.6.26-hyperv" 
Please correct this.

Please check this page to fix this issue:

2) You may get this error when you try to compile kernel.

1
2
3
4
lguest.c:21:25: error: sys/eventfd.h: No such file or directory
lguest.c: In function ‘create_thread’:
lguest.c:1021: warning: implicit declaration of function ‘eventfd’
make: *** [lguest] Error 1

Please check this page to fix this issue:

If you get different problems, please report to me.


Comments (24)

Marco

January 28th, 2011
13:21:59

Hi Yusuf,

thanks for this how-to, works like a charm :-D

Cheers

Marco


Blake

March 28th, 2011
11:43:22

Thank you so much for this guide, it worked perfect with kernel 2.6.38.2 on Debian 6.0.1

Cheers :)


Dmitry

April 20th, 2011
06:59:44

Hi Yusuf!
I have HyperV SP1 and Debian 6.0.1. I make this guide step by step and have a problem. Sqeeze boot too long with the new kernel (about 2 minutes).
Running lsmod | grep ‘hv’ show’s me that:
hv_timesource
hv_vmbus

and repeating message in console “task modprobe blocked for more than 120 seconds”

What wrong ? :)


Gilles

April 21st, 2011
15:39:15

Why, oh WHY ? downloading a kernel from an untrusted source ?
> wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.36.tar.bz2

This step is absolutely useless (aptitude already downloaded it) and potentially harmful.

Also replacing the kerning is probably not the better way to handle Hyper-V, as it prevents future kernel updates on the machine.
A better way is to compile the kernel by just issuing “make” and copy the kernel modules:

mkdir /lib/modules/2.6.32-5-686/kernel/drivers/staging/hv/
cp drivers/staging/hv/hv_vmbus.ko /lib/modules/2.6.32-5-686/kernel/drivers/staging/hv/
cp drivers/staging/hv/hv_storvsc.ko /lib/modules/2.6.32-5-686/kernel/drivers/staging/hv/
cp drivers/staging/hv/hv_blkvsc.ko /lib/modules/2.6.32-5-686/kernel/drivers/staging/hv/
cp drivers/staging/hv/hv_netvsc.ko /lib/modules/2.6.32-5-686/kernel/drivers/staging/hv/
depmod
echo hv_vmbus>>/etc/modules
echo hv_storvsc>>/etc/modules
echo hv_blkvsc>>/etc/modules
echo hv_netvsc>>/etc/modules

the new ethernet interface will be eth1. eth0 is still the old one. Don’t forget to configure it in /etc/network/interfaces.


Gilles

April 21st, 2011
15:42:34

sorry, in the previous comment I didn’t see that the wget command was downloading the kernel from kernel.org.

So it is not “potentially harmful”, it is just “useless”.

Cheers.


admin

April 24th, 2011
22:59:45

Hello Gilles,

Thanks for your comments. I’ll try that soon.

Hello Dmitry,

I haven’t tried that on Debian 6 yet. You can try Gilles’s way. If it works for you, please leave a comment.

Thanks.

Yusuf.


Dmitry

April 26th, 2011
18:42:12

Hi, all!
Thanks for comments :)
Well, I have try to follow Gilles’s post and make this steps:
1) wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.4.tar.bz2
2) unpack the kernel and “make menuconfig”
3) just “make”
4) cp drivers/staging/hv/*.ko /lib/modules/2.6.32-5-686/kernel/drivers/staging/hv/
5) depmod
6) cat /etc/modules
loop
hv_blkvsc
hv_netvsc
hv_storvsc
hv_timesource
hv_utils
hv_vmbus

Ok, try to reboot. System start quickly and what we have:
#lsmod | grep ‘hv_’
Nothing, hm, ok.
#cat /var/log/messages | grep ‘hv_’
hv_timesource: disagrees about version of symbol module_layout
hv_vmbus: disagrees about version of symbol module_layout

Well, the new modules version is from a different kernel version.
#uname -r
2.6.32-5-686

Hmm… WTF? :)


Dmitry

May 2nd, 2011
17:29:10

Is anybody here? :)


admin

May 3rd, 2011
22:04:11

Hi Dimitry,

I think Gilles should reply your problem :)

Also Blake says it works on Debian 6. Maybe you miss something?

Yusuf.


Dmitry

May 5th, 2011
18:19:13

Hi, Yusuf!
I follow the Gilles’s manual step by step :) Well, I have no idea yet :(


Sean

May 6th, 2011
12:05:41

Coincidentally I found this article and am following the same process (without any kernel development experience) and get the same warnings/errors. Let me know if you find a solution.


Hyper-V 上の CentOS 5.5 に統合サービスをインストール « COMPNET

June 2nd, 2011
05:59:37

[…] […]


Emrah AK

July 6th, 2011
16:23:10

Merhabalar, bu anlatimlarda bahsi gecen ayarlamalar ESX icinde gecerlimi?


Debian on HyperV

July 15th, 2011
14:12:07

[…] […]


Dniel Costa

September 21st, 2011
14:35:18

Hi!

Do you know how to enable dynamic memory on an Debian Squeeze Hyper-V Virtual Machine?

I enable that on the VM Settings, but it requires Guest OS Support.

Thank You!

Daniel Costa


Alion

January 4th, 2012
10:28:21

Hallo all, I have a same problem as Dimitry. Can you help mi please

thank You


Andrew

February 13th, 2012
03:05:37

1) wget -c http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.4.tar.bz2
2) unpack the kernel and “make menuconfig”
3) just “make”
4) cp drivers/staging/hv/*.ko /lib/modules/2.6.32-5-686/kernel/drivers/staging/hv/

Well, Differnet versions of the kernel in question here… You are downloading 2.6.38 and installing the drivers in 2.6.32, also different versions of GCC compared to the one the kernel was originally compiled with will stop you using Gilles suggestions – see /var/log/messages i.e. “Linux version 2.6.32-5-amd64 (Debian 2.6.32-39) (dannf@debian.org) (gcc version 4.3.5 (Debian 4.3.5-4)” gcc 4.3.5 isnt the current one – 4.4.5…. an old post i know but people are still finding this so i thought i’d add my 2c worth!

… good luck guys!


Debian Squeeze に Hyper-V 統合サービスをインストールする » Netarium

February 21st, 2012
04:29:16

[…] Building your own Debian Kernel packages for Hyper-V Support […]


marcus

March 1st, 2012
15:19:48

hi Yusuf,
nice howto but i have a problem !
I follow the howto with 3.2.9 kernel the old kernel is 2.6.32-5-amd64.
the installation was ok but after new start, starts the old kernel
sorry for my english i hope u now what i meen


marcus

March 2nd, 2012
16:12:37

sorry for double post,

all ok i have install 2 .deb and all is ok with kernel 3.2.9 thanks i am an beginner at debian.


muzi

September 3rd, 2012
16:09:10

Hi Guys

I want to enable hyper-v support in debian-6.0.4 , the default kernel comes with newly installed is 2.6.32.5, can i build custom kernel by downloading the same kernel source of 2.6.32 or need to at least 2.6.36 or upper version ?, kindly suggest thanks


Criando um Kernel Linux preparado para Microsoft Hyper-V « Arquivo |-VSA-|

November 30th, 2012
18:31:48

[…] de uma versão para o Debian 6. Pesquisando um pouco mais no blog dele mesmo, acabei encontrando um outro post, onde ele ensinava a compilar um kernel de sua preferência, habilitando os drivers necessários […]


Tim Small

March 30th, 2013
17:47:36

If you are running Debian 6.0 (Squeeze), You can use the Debian 7.0 (Wheezy) kernel from the Debian “backports” project – see http://backports-master.debian.org/Instructions/ – this is the Wheezy kernel which has been packaged to work on Squeeze, and includes the Hyper-V extensions. Works well for us…


Alon Or

December 22nd, 2015
13:27:28

If you are running Debian 6.0 (Squeeze), You can upgrade to 7.0 (Wheezy), it’s so simple:
just answer Y every time.
apt-get update
apt-get upgrade
nano /etc/apt/sources.list replace every squeeze with wheezy, ctrl+x, Y,enter.
apt-get update
apt-get upgrade
apt-get dist-upgrade
reboot
your new kernel will be selected, login, then you can “lsmod | grep hv” and see the hyper-v modules loaded (hv_vmbus, hv_netvsc, hv_blkvsc, hv_storvsc), connect your non-legacy network adapter and do “ip show link” then you’ll see it (you can be sure by checking the MAC).
But why stay there?, now you can go to Debian 8.2 (jessie) by following the same instructions but this time use “jessie” on your sourcelist.
I wasn’t able to go directly from 6 to 8.
If you have trouble with “public key is not available” then follow instructions from here: http://stackoverflow.com/questions/1139127/how-to-trust-a-apt-repository-debian-apt-get-update-error-public-key-is-not-av
Enjoy.



Leave a Reply