Just moozing

Before you can check your notes, you must make them…

Windows 7 in QEMU/KVM

with 7 comments

With my new hardware, I can use KVM for hardware acceleration and I am currently doing some testing. This post is about installing and using Windows 7 in a QEMU/KVM.

Creating the virtual machine

Some default value does not work well. E.g. I had the hard disk as IDE – it worked, but was bad for performance.

I create the virtual machine using virt-manager (version 0.9.1) – sometimes directly on the server and sometime on my laptop. The manager locks from time to time. I think it is related to network timeouts, but that is just a guess. Server OS is Debian Wheezy.

The windows 7 version I have is the enterprise version. I think it is a bad choice for virtualization, but that is what our IT department had to offer. The system requirements can be found here. Btw. I am using the 64 bit version.

Create the VM

  • Use the Window 7 ISO as installation media.
  • OS type is windows/windows 7
  • Minimum reqs says 2 Gb, so that’s what it gets and I give it 4 cores.
  • Disk image is 25 Gb qcow2
  • Network is a bridged network connected to the servers cabled ethernet
  • The VM starts immediately – “force off” it, we need to change some more settings.

I use qcow2 because I don’t want to allocate all the disk space at once, since I am planning on cloning this machine a lot. Also, it support snapshots, which I know I will be using later.

You need to download the ISO with the VirtIO drivers from Redhat (direct link) in order to install windows with this hard disk controller. Just do it before installing. Changing the hard disk controller after installation broke my first windows 7 installation and installation is much faster with VirtIO.

Change the settings

  • IDE disk 1: link, link
    1. Advanced options -> disk bus: VirtIO
    2. Perfomance -> Cache mode: none
    3. Performance -> IO mode: native
  • Add an extra cdrom drive:
    1. Use “Add hardware” button
    2. Storage -> Device type: IDE cdrom
    3. Select managed or other existing storage -> browse and choose the VirtIO-win-xx.iso
  • Add audio hardware:
    1. Use “Add hardware” button
    2. Sound -> Model: ich6
  • Video -> video: VGA (must not be QXL)
  • Display VNC -> VNC server type: spice
    • yes, add spice agent channels

Reading online, I was my impression that spice is the way to go in terms of performance for graphics in virtual machines – it seems designed for it. It is linked to the QXL video driver which (again, my impression) is the best graphics performance for VMs.

Now we are ready to install windows. Start the VM.

Installing windows

Installation is as installations go except for the hard disk drivers sindce no hard disk is found and the drivers need to be loaded. Luckily we have them in the secondary cdrom drive (path in my setup is d:\win7\amd64) and choose the one called “Red Hat VirtIO SCSI controller”.

You should now have 24.4 Gb of unallocated space to install windows on. Installation should be as OS installations go.

When windows is installed, I always start by a manual installation of updates. This is a habit developed from experiences with installing 100+ updates and then reverting all of them when something goes wrong. It is just a waste of time . So I install them by size – largest first.

VirtIO Devices

In Control panel -> system -> device manager, there are currently two unknown devices, being other -> PCI device and other -> PCI simple communication controller. That is the balloon device and a VirtIO serial device which correspond to the other two driver on the VirtIO CD used earlier.

To take advantage of the balloon driver, change the setting for the virtual machine and set Memory -> current allocation to something less than the maximum. My windows 7 installation uses 582 Mb or RAM, so I, conservatively, set the current allocation to 1024. It will then adjust it on the fly if the windows VM needs more memory.

QXL

Compared to standard VGA, QXL is a better graphics system, so we will be using that. In the VM settings, change Video -> Model to QXL.

The driver is found on the spice homepage in the download section. It is the spice guest tools that we want to install. Download and run it.

I get an saying “Windows requires a digitally signed driver”. On other versions of windows, I am told that you get a red box saying “do you want to use an unsigned driver”, and you are just to yes to that, and it will work.

I use the enterprise edition, so that doesn’t work for me.

After a reboot, Windows refuses to use the driver because it is not signed. Actually, it is signed but it is not WQHL.

This site gave me an ugly hack, but it works. Running an administrative command prompt (cmd.exe as administrator) and typing


bcdedit -set loadoptions DDISABLE_INTEGRITY_CHECKS
bcdedit -set TESTSIGNING ON

I now have a windows 7 enterprise running in my KVM with VirtIO drivers and QXL. And a text in the corner saying something about test mode 🙂

Wishlist/Todo

Just a reminder list, should any of you want to post links to easy solutions.

  • share folder with host machine
  • persistent “current memory” across VM restarts
  • QXL running in normal mode (as opposed to test mode)
  • Movie maker. It will not run stating that the requirements are not fulfilled and when I check the homepage, it all seems to be in order !?
  • users from an LDAP server.
Advertisements

Written by moozing

November 30, 2012 at 09:00

Posted in Tech

Tagged with , ,

7 Responses

Subscribe to comments with RSS.

  1. […] done that before, this time it was very difficult because of a broken hard disk. I mostly followed my own guide from last […]

  2. Thanks for this! Helped me a lot.

    Marco

    November 11, 2014 at 13:06

  3. The better way to disable signature check is: On Boot Press F8, Then choose “disable signature check”
    Voilla gone forever

    Phil2Sat

    January 29, 2016 at 15:34

  4. Wow so that means anyone not using RHEV with the actual WHQL driver and just the non-certified one either doesn’t notice their display driver isn’t there (at least when running enterprise) or they disabled one of the core pieces of windows horribly weak security protections.

    Don’t get me wrong, i’m thankful to you for the advice, but the fact that this is necessary and accepted outside of a lab is just horrific. I hope we some day find a way to stop things like this.

    darkfader

    April 4, 2016 at 20:47

    • I whole heartedly agree – signing stuff in windows make sense from a security point of view, and actively disabling it is a problem.
      There are a lot of problems with windows, and most of it arise from the fact that it is used by a lot of people, including a lot of non-technical people, which makes it a prime target.
      Also, if you are a non-technical person, you would probably not do windows in KVM.

      An on a side note, I currently use windows 8.1 in my VMs, and I don’t need to disable it.

      moozing

      April 4, 2016 at 21:03

      • Thanks for the info – I had a un-fun time with Win10. It seems RHEL7 comes with valid drivers so in the long run I’ll buy 1(one) RHEL license and give it a shot.

        darkfader

        April 11, 2016 at 00:57


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: