Running Windows on Eucalyptus (Improved)

I’ve previously written about running Windows on Eucalyptus here, using a method that involved using parts of the Windows boot chain to create a Eucalyptus ramdisk.  This works well enough, but can be quite time-consuming to set up.

I’ve since come up with a better way, using only open source components, which means I can make it all freely available!  And in addition, there’s a perl script included to create randomised Windows access credentials.  Read on…

Creating the image

As before, you need to create a KVM base image of the Windows variant you’re wanting to install.  I haven’t tried a Xen equivalent, but there’s no reason that it shouldn’t work also.  Vital prerequisites are:

  • The virtual disk of the base image MUST  be configured as SCSI, as this is what Eucalyptus expects.
  • The disk should have a minimum of two partitions: the first contains the operating system installation; the second can be as small as you wish, and is present to instruct Eucalyptus not to try to run Linux disk operations on the image (thanks to EtienneG for this tip; see comments on the previous post).
  • Ensure that Remote Desktop is enabled, or you won’t be able to access the running image
  • If using Eucalyptus 1.6 (perhaps as part of the UEC), you’ll need to install the e1000 network driver to the image.  Instructions for this are here.

Installing the random credential generator

Download the win-euca-blobs tarball from http://launchpad.net/euca-blobs/0.1/win-euca-img-0.1/+download/win-euca-blobs-0.1.tar.gz .  Extract the tarball, and copy the AWS directory to the root of the Windows image C:\ drive (if you wish to put this elesewhere, you’ll need to modify the path in AWS\set-admin-password.bat).

Next, install a perl runtime onto the image (I’ve used the ActiveState one found here, which is free, and seems to work well).

Finally, add AWS\set-admin-password.bat as a startup script for the virtual image, following the instructions found on this page.  You can test the script by adding the following lines to the libvirt xml of your image, in the <devices> section:

<serial type=”file”>
<source path=’/tmp/console.log’/>
<target port=’1’/>
</serial>

On next startup of the VM, something like the following should spit out in /tmp/console.log

** Access Credentials **

Username: administrator
Password: ef11kr4o

I’ve tested the above script on Windows XP, and I’d imagine it should also work just fine on Server 2003 and Windows 2000.  Beyond that, mileage will vary.  And, if anyone more Windows-savvy would like to re-implement the script in .vbs or similar and contribute it, I’ll gladly update the posting!

Create the bundle

Finally, bundle your image using the memdisk and win-grub.img files supplied in the win-euca-blobs tarball, using something like:

mkdir kernel
ec2-bundle-image -i /path-to/memdisk -d ./kernel –kernel true
ec2-upload-bundle -b kernel -m ./kernel/memdisk.manifest.xml
EKI=`ec2-register kernel/memdisk.manifest.xml | awk ‘{print $2}’`
echo $EKI

mkdir ramdisk
ec2-bundle-image -i /path-to/win-grub.img -d ./ramdisk –ramdisk true
ec2-upload-bundle -b ramdisk -m ramdisk/win-grub.img.manifest.xml
ERI=`ec2-register ramdisk/win-boot.img.manifest.xml | awk ‘{print $2}’`
echo $ERI

mkdir image
ec2-bundle-image -i path-to/<windows_disk>.img -d ./image –kernel $EKI –ramdisk $ERI
ec2-upload-bundle -b image -m ./image/<windows_disk>.manifest.xml
EMI=`ec2-register image/<windows_disk>.manifest.xml | awk ‘{print $2}’`
echo $EMI

Launch it!

The image should start in the same way as any other.  To retrieve the login credentials, run ec2-get-console-output (or similar – I’m using eucatools these days).

18 Responses to “Running Windows on Eucalyptus (Improved)”

  1. mike Says:

    hello,
    thanks for your posting. i’m trying to do the same thing with eucalyptus & windows 2003 server vm image. the image works on kvm but when i try to get it on eucalyptus it doesn’t.

    my problem is that when i try the win-grub or when i made my own boot disk via the floppy method for the ramdisk, they both complain about not finding the windows kernel on the partition.

    to be specific, i get an error 13: “Invalid or unsupported executable format” from grub via the win-grub method and a “windows could not start because the following file is missing or corrupt: ntoskrnl.exe” error via the boot disk method.

    so the windows kernel can’t be located. something is going on that its not pointing to the windows image appropriately.

    any ideas or help you could provide?

  2. Christian Says:

    Hello,

    have you created the two partitions with the Windows-Installer?

    Is the Windows-Instance running stable inside your Eucalyptus infrastructure?

    Can you start and shutdown the instance with the euca-tools?

    Best Regards,
    Christian

  3. mike Says:

    yes, ive created 2 partitions, both are formatted, one having the windows install and i added them on kvm as scsi devices.

    Eucalyptus labels the instance as running but when i VNC into it i see the error upon boot trying to locate the kernel

    yes, i can start/stop the instance via the euca-tools

    Thanks for your help

  4. Anon Says:

    Thanks for this blog posting!

    Would you be able to update it with information on how to create the win-grub.img file?

    Thank you again!

  5. Peter Says:

    When I try to bundle, in ubuntu 9.10 server x64 I get the following error when I run the first bundling command.

    ec2-bundle-image -i /path-to/memdisk -d ./kernel –kernel true

    missing mandatory parameter –cert

    It is looking for the eucalyptus cert to attach to the kernel bundle command….

    Do I just grab it off the CC of eucalyptus and add the parameter with pointer to the cert ?

  6. charliezon Says:

    Hi ajmf,

    Following your method, and now an instance of windows xp is running in my Eucalyptus cloud. But I can’t ping or be logged into it via remote login.

    When creating the image, I followed these instructions:
    dd if=/dev/zero of=/home/fcloud/winxp-image/windowsxp.img bs=1024k count=4096
    kvm -m 512 -cdrom /home/fcloud/winxp-image/winxp.iso -boot d -drive file=/home/fcloud/winxp-image/windowsxp.img,if=scsi,boot=on

    The disk is SCSI and there are two partitions. The remote login is also enabled. The only exception is the e1000 network driver is not installed to the image because I couldn’t find it through that link.

    I followed almost all of your remain instructions except the “libvirt xml” because I can’t find it(Sorry).

    Then upload and register it to the Eucalyptus. Fortunately, I can launch an instance of this image through Eucalyputs. But unfortunately, I can’t ping or be logged in it.

    Do your have any ideas and would you please help me?
    Thank you sincerely in advance.

  7. samof76 Says:

    i have created windows ami using, your method and able to raise the instance. But i an unable to reach the instance, ping or anything else i have setup the security groups correctly.

    It would be nice if there is more elaborate stuff on this.

  8. freemind Says:

    Were you able to attach volumes & take snapshots ?

  9. samof76 Says:

    Thanks a lot for a great guide. I have given a more detailed description http://www.linux-kvm.com/content/how-do-you-use-e1000-option-windows-guest of the same!

    Thanks!

  10. samof76 Says:

    Sorry this is the blog post that i have done http://cloudbuzz.wordpress.com/2009/12/24/windows-on-eucalyptus/

  11. Existing problems of using Windows VM on Eucalyptus « Charliezon's Blog Says:

    […] https://ajmf.wordpress.com/2009/10/14/running-windows-on-eucalyptus-improved/ […]

  12. Modify computer name when launching windows VM on Eucalyptus « Charliezon's Blog Says:

    […] instance trackback If you have tried to launch more than one windows instances following the method mentioned in my last post, you might come across a warning that told you there was already a […]

  13. FreeMind Says:

    Hi,
    I am trying to bring up UBUNTU Jaunty as a Dom0 using Xen Hyperviser.
    Getting Dom0 networking running with a Static IP fails. I am getting
    SIOCSIFADDR No Such Device
    eth0:ERROR while getting interface flags:No Such Device
    Following some pointers on other blogs I removed the entries in the /etc/udev/persistent-rules.d/70-percent-net.rules file.
    I also tried the eth0 renamed as eth1
    I tried adding e1000e module support even then I was getting the same error.
    I have 64bit hardware. I tried the above on 32-bit Ubuntu as well as 64 bit.
    But that error still remains.
    Any idea what is causing that?

    Thanks in advance for your help.

    Regards,
    Freemind

  14. Alan Says:

    Hello.

    As part of a POC I am trying to get a Windows image up. I ran into a problem. The image would come up pending and then terminated or “Teardown”. I am also getting this “WARN NetworkStateHandler | Response from cluster [DemoCluster]: NOTSUPPORTED” in the cloud-output.log file. Do I need to have Eucalyptus configured in “managed mode” to get this up? Any suggestions will definitely be appreciated. I made a base image of Windows 2003 server using Xen. This is how I bundled it:

    # mkdir kernel
    # euca-bundle-image -i /home/abui/createwindowsimages/memdisk -d ./kernel –kernel true
    # euca-upload-bundle -b w2003srver-kernel-bucket -m ./kernel/memdisk.manifest.xml
    # euca-register w2003srver-kernel-bucket/memdisk.manifest.xml

    # mkdir ramdisk
    # euca-bundle-image -i /home/abui/createwindowsimages/win-grub.img -d ./ramdisk/ –ramdisk true
    # euca-upload-bundle -b w2003srver-ramdisk-bucket -m ramdisk/win-grub.img.manifest.xml
    # euca-register w2003srver-ramdisk-bucket/win-grub.img.manifest.xml

    # mkdir image
    # euca-bundle-image -i /home/abui/createwindowsimages/w2003srver.img -d ./image –kernel eki-65AD1390 –ramdisk eri-EA2315A5
    # euca-upload-bundle -b w2003srver-image-bucket -m ./image/w2003srver.img.manifest.xml
    # euca-register w2003srver-image-bucket/w2003srver.img.manifest.xml

    Thanks!

  15. Douglas Says:

    First off: thanks a lot for the guide.

    I’m wondering if you happen to know anything about an issue I’m having getting win2k3 on UEC/eucalyptus.

    I can’t seem to register memdisk/boot floppy as kernel/ramdisk images on Eucalyptus/UEC. The image IDs I get back are emi-XXXXX instead of eri/eki. Attempting to run the instance by specifying the –kernel/–ramdisk options using the memdisk/boot floppy image fails with an error about Eucalyptus not recognising them as valid kernel/ramdisk images.

    • ajmf Says:

      Sorry if this is too late for you, but – you did specify the –kernel true and –ramdisk true switches when bundling the kernel / ramdisk images?

  16. Hiren Says:

    We are unable to access Windows2003 image through Remote Desktop. We have enabled the remote desktop settings in the image. Apart from this, we are also able to run Windows XP (through remote desktop) and Linux (through ssh) images. We even do not see anything abnormal in log files.

    Appreciate your sparing of valuable time,
    Thanks in advance,
    Hiren

Leave a reply to mike Cancel reply