Hyper-V Guests: Mouse Integration on Linux VMs

Hyper-V Guests: Mouse Integration on Linux VMs

This is a follow-up article which will allow you to get mouse control within the Guest OS without having to ‘capture’ your mouse. Now generally this is not necessary, since Linux in the Datacenter is generally without a GUI, however I use Hyper-V on my Laptop and have a Linux Desktop Guest which this makes it helpful for.
Now in order to do this you will need the linux integration components previously installed. I discussed this in a previous article for Ubuntu and Debian (found here). Additionally I plan on having a follow up article for CentOS, RHEL, and Fedora (however I am slightly slow on these since I am not as familar with them).
I have verified this installation on Debian 5 and Ubuntu 9.04. I have not verified this procedure on previous versions of Ubuntu. When I release my articles on installation of Hyper-V Integration Components on other Linux Distributions I will post updates to ensure these instructions are compatible with those distributions, or I will post reasons that they are not.
If you have the linux integration components installed then that will ensure you have all of the prerequisites for building the input module. This is important as the inputvsc module is dependent on the vmbus module.

STEP 1 – Prestage Files
Download iso image from xen.org
http://www.xen.org/files/Satori/inputvsc.iso
Mount iso image as the guests cdrom.
Elevate permissions to root (on Ubuntu use sudo -s)
$ su –
Make directory for install files
# mkdir /opt/inputvsc
Copy install files
# cp -R /media/cdrom/* /opt/inputvsc/

STEP 2 – Install InputVSC Module
Change directory into install directory
# cd /opt/inputvsc
Execute Install Script
# ./setup.pl inputdriver
Verify the error you receive is the expected error by viewing drvinstall.err (the error should occur when ‘installing the udev inputvsc rules’ – This means that the module will not be loaded automatically)
# cat drvinstall.err

STEP 3 – Verify and Test Module
Load module manually
# modprobe inputvsc
Verify module is loaded
# lsmod | grep inputvsc
You should now be able to control your internal mouse without capturing.

STEP 4 – Configure Module to Automatically Load
Open /etc/initramfs-tools/modules
# nano /etc/initramfs-tools/modules
Add the following to the end of the file

inputvsc

Rebuild initrd image
# update-initramfs –u

STEP 5 – Reboot and Verify Automatic Loading of Module
Reboot
# reboot
Verify module is loaded
$ lsmod | grep inputvsc
OK and we are all done.
Now that this is done I have noticed a few issues on Debian 5 which I will be attempting to sort out. Ubuntu 9.04 did not have any of these issues. The internal mouse tracked just fine with the external mouse.

  • On startup when at the login screen the first time I click in the guest it captures the mouse. However if I uncapture and click again it does not capture (this is all pre-login).
  • I also have noticed that the guest mouse does not track exactly with my mouse, it is still usable but kind of a pain.
  • The guest viewer window needs to be selected in order to have mouse control within the guest.