Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to install Windows 7 on a virtual machine on my 64 bit Ubuntu Karmic box. I get to the point of selecting my language settings and clicking 'install now', but a short while later I get a blue screen of death.

I've tried a few variations, including using the 32 bit (fails very quickly). The virt-install command I've tried includes this:

sudo virt-install --connect qemu:///system -n ksm-win7 -r 2048 \
--disk path=/home/kief/VM-Images/ksm-win7.qcow2,size=50 \
-c /var/Software/Windows7/Full/64bit/SW_DVD5_SA_Win_Ent_7_64BIT_English_Full_MLF_X15-70749.ISO \
--vnc --os-type windows --os-variant vista --hvm

The limited info I could find suggested that 'vista' should work as the --os-variant, I haven't found any values specific to windows 7.

Here's my blue screen:

alt text

I've found very little by Googling, so I'm guessing this isn't a case of KVM simply not supporting Windows 7.

Thanks for any help.

Update:

I have been able to successfully create a Windows 7 VM using the graphical "Virtual Machine Manager" app, although I don't really understand the cause of the problem with the VM created with virt-install. Comparing the configuration files under /etc/libvirt/qemu provides some clues, although I don't know enough to interpret them properly. The interesting differences in the two VM configurations are:

--- win7-virt-install.xml
+++ win7-vmm.xml
-<domain type='qemu'>
+<domain type='kvm'>
@@ -21 +21 @@
-    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <emulator>/usr/bin/kvm</emulator>
@@ -23 +23 @@
-      <source file='/home/kief/VM-Images/ksm-win7.qcow2'/>
+      <source file='/var/lib/libvirt/images/ksm-win7x64.img'/>

I'm not sure if this means the working VM is not using qemu at all, or if there is some other difference in the way it's used with kvm.

Update2:

So I've answered my own question (mostly) below. A KVM VM needs to use KVM's own CPU emulation rather than qemu's in order for me to get Windows 7 installed. I'm not sure whether there is something that can be done to get it working on a qemu-emulation CPU, or whether a newer version will support it. But at least it is possible to get it running on a KVM VM.

share|improve this question

5 Answers 5

Here's the easy way

Unless you have some specific why you'd install a GuestOS using virt-install, here's the 'easy' way to do it without virt-install.

I have a working VM with Windows 7 installed. Here's how I created it.

Step 1: Create the virtual disk image

qemu-img create -f qcow2 vdisk.img 100g

This creates a virtual disk in the qcow2 format. Setting the partition size to 100g (gigabytes) will not allocate 100gb of physical hard disk space. The virtual partition will only take as much space as the data it contains. The 100g just makes it so you'll (hopefully) never need to increase the size. Increasing a qcow2 image's default size is still a pain in the a** to do.

Step 2: Install the OS

If you're using an actual physical cd-rom to load the OS, use the following command.

sudo kvm -m 750 -cdrom /dev/sr0 -boot d vdisk.img

If you're using a disk image to load the OS, use this command.

sudo kvm -m 750 -cd-rom /path/to/image/image.iso -boot d vdisk.img

Here's the breakdown of the commands:

  • kvm - calls the kernel virtual machine (obvious)
  • -m 750 - allocates 750mb of memory for the virtual machine
  • -cd-rom sets up the cd-rom. For a physical disk use same disk as your HostOS. For a image, provide a path to the image file.
  • -boot d boots the virtual machine from the cd-rom

I set the memory footprint for the initial load to 750 to be conservative so I can be sure that the install finishes without running out of memory. For subsequent loads I usually set it to 512.

*Note: AFIAK, the kvm command only works in more recent versions of Debian/Ubuntu or their derivatives. If it doesn't work the equivalent (and more common) command is qemu-system-x86_64 or qemu-kvm for 32 bit.*

After you've gone through the whole install process the VM should reboot into a working OS. To load the VM again just launch this command:

kvm -m 512 vdisk.img

With whatever command line switches you need to mount additional physical disks, hardware, etc. To find info on command line switches check kvm --help.

If you don't understand the difference between 'paravirtualization' and 'native virtualization' Matthias' has already made a great explanation of the differences.

For a more 'in depth' explanation of this process read this article.

share|improve this answer

The 0x1e exception is KMODE_EXCEPTION_NOT_HANDLED, which is usually either a hardware-related or device driver-related fault. My guess is that, for whatever reason, Windows is not liking the emulated hardware from the virtual machine.

Have you tried using VirtualBox? They have a release for Karmic Koala, and they support Windows 7 (I'm running Win7 right now on a Windows XP box).

share|improve this answer
    
Thanks, I want to stick with KVM, as we are using it with Eucalyptus. This is as much a learning exercise for me as a pragmatic need to have Windows 7 running. –  Kief Nov 19 '09 at 9:43

The reason for this problem with installing windows with the qemu virtualization is the difference between qemu "paravirtualization" and KVMs "native virtualization". Paravirtualization means that it simulates a CPU and needs a special kernel on the side of the client (virtual system) so that this systems knows how to.call the CPU functions correctly. That is the reasons for not all systems being able to run using qemu without KVM.

On the other side, virtual systems using KVM can directly access the CPU (because KVM uses AMD/Intel Hardware Virtualization support). In that case no special kernel is needed. The downside is that the host needs to have a modern CPU which supports this Hardware Virtualisation (called SVM on AMD and VT-x for Intel) and that the client system must be able to run on that CPU (not a problem, as most systems can run on a x86), reducing portability.

share|improve this answer
1  
+1 great explanation of the differences between 'paravirtualization' and 'native virtualization' –  Evan Plaice Jul 29 '10 at 5:12

After some research and consultation with a colleague, the issue seems to be with qemu CPU emulation. My virt-install command created the KVM virtual machine using qemu's CPU emulation. VMM created a KVM virtual machine using KVM's own CPU emulation (albeit still using qemu to emulate other parts of the PC, as the current version of KVM uses qemu for this).

By adding the --accelerate parameter to my virt-install command, I'm able to create a VM and install Windows 7 on it.

So, the answer seems to be that Windows 7 cannot be installed on a virtual machine using qemu-kvm-0.11.0 CPU emulation, but this can be worked around by using KVM's own CPU emulation. This is done using the --accelerate option to virt-install. The configuration file parameter will be <domain type="kvm"> rather than <domain type="qemu">.

share|improve this answer
    
thanks for this! I edited the xml file as suggested, substituting kvm for qemu and installed Win7 64bit without issue! (running on Fed12 64bit) –  Rupert Jul 6 '10 at 8:41

The other difference I see from above is that KVM should be 32bit emulation only... or at least with your XML diff that stands out.

Looks like 64bit support has been added to KVM, so qemu-system-x86_64 with --accelerate might/could give you both KVM and 64bit, provided your kernel is built for it by your distribution.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.