Running Windows inside your Ubuntu 7.10 installation

Running Windows inside your Ubuntu 7.10 installation


For people making jump from Windows to Linux the biggest problem is adjusting to new environment and applications , now even though these days really good open source alternatives to applications on Windows platform are available but still many people prefer using Windows applications .

Now ,If you want to run Windows application on your Ubuntu installation there are two options available
  • You can use a virtualization software(like Qemu , Virualbox , VMware , bochs etc) which allows you to run full fledged installation of Microsoft Windows inside your Ubuntu desktop
  • Or you might use a application layer called wine to run Windows application natively on Linux . While most of the people would prefer wine to run their windows application because it does not require one to have a licensed copy of windows , however application support in wine is still patchy with some applications working flawlessly and some application not working at all . So well that leaves us to virtualization softwares .
Over the years there has been significant development in virtualization technologies . Now there are number of applications available both in open source and commercial domain that allows running of one operating system inside another operating system .

Some of such popular applications available on Linux platform are : Innotek VirtualBox , Qemu , Vmware , Win4Lin and Bochs .

In This article we discuss how to install Microsoft Windows XP inside Ubuntu using QEmu and Virtualbox .

Qemu : - Qemu is a processor emulator created by Fabrice Bellard , it allows full virtualization of a system inside another thus paving way of allowing one operating system to run inside another operating system . Qemu is open source and released under GNU Lesser General Public License (GNU LGPL)
Qemu has many features not available in similar such products like VMware , bochs etc like increased x86 emulation with accelerator module (kqemu) .

This is what qemu website has to say about qemu : -

QEMU is a generic and open source machine emulator and virtualizer.

When used as a machine emulator, QEMU can run OSes and programs made for one machine (e.g. an ARM board) on a different machine (e.g. your own PC). By using dynamic translation, it achieves very good performances.

When used as a virtualizer, QEMU achieves near native performances by executing the guest code directly on the host CPU. A host driver called the QEMU accelerator (also known as KQEMU) is needed in this case. The virtualizer mode requires that both the host and guest machine use x86 compatible processors.


We would be primarily showing you how to install Windows XP under qemu with accelerator module enabled .

VirtualBox : - InnoTek VirtualBox is a commercial PC Virtualization software similar to Qemu and Vmware and allows running of one operating system inside another . InnoTek VirtualBox though is a commercial software , however there is a limited free version of VirtualBox available too which we will discuss briefly in this article .


Installing Qemu : -

Before we start installing qemu we need to enable all of the Ubuntu repositories which could be done by following these steps : -

Enabling Additional Repositories


Now many applications need additional repositories to be installed or some to be enabled in Synaptic package manager so before trying out steps given below ensure that repositories in order.

Launch Synaptic Package Manager (System -> Administration -> Synaptic Package Manager ) , then in Synaptic package manager go to (Settings -> Repositories ) you will find window like this . Ensure that all the check boxes are marked leaving source code(if you want to you can enable this also but you are not going to need this unless you are software developer) the dialog box should look like this .
Dialog Box showing the repositories that should be enabled

After completing above step you will find a dialog box like this



Now , To install qemu type in the following command in the terminal window :

sudo apt-get install qemu

sudo apt-get install kqemu-source

sudo apt-get install module-assistant

sudo module-assistant auto-install kqemu

After completing above step the kqemu( accelerator module of qemu which allows you to run virtual operating system at near native speed should be compiled properly and ready to be used)

Now type in the following commands to configure kqemu

First we need to create /etc/udev/rules.d/60-kqemu.rules file and open it for editing , we can do it by issuing the following command in the terminal window :

gksu gedit /etc/udev/rules.d/60-kqemu.rules
After the file is opened in the gedit text editor add the following line in the file and make sure you add a newline at end of file too .

KERNEL=="kqemu", NAME="%k", GROUP="kqemu", MODE="0660"

now open the file /etc/modprobe.d/kqemu and modify the content of file to look like :

options kqemu major=0
Now after above step is completed we need to create a group "kqemu" and add all those users who would like to use kqemu to this group , we can do this by following the commands listed below :

To create group : -

sudo addgroup --system kqemu


Now once the group "kqemu" is created we need to add the users who would be using kqemu to this group we can do this by issuing the following command in the terminal window , remember to change $USER with the user's login name for example in my case it is "ambuj" (so command issued was sudo adduser ambuj kqemu ).

sudo adduser $USER kqemu

Now logout of the session and loggin again so that these changes are reflected properly .

After these steps are completed issue the following commands in this sequence to load kqemu module

Force udev to reload by :

sudo /etc/init.d/udev reload

and now finally to load kqemu module

sudo update-modules
sudo modprobe kqemu
Instead if you want kqemu module to load automatically insert "kqemu" in the file /etc/modules

gksu gedit /etc/modules

If you have followed steps properly you should have qemu with kqemu module working properly and now you could move forward and install Windows XP .


Installing Windows XP inside qemu


To install Windows or any other operating system we first need to create a virtual drive which is basically a file residing in your linux partition which would be used as a hard disk for your Guest operating system .

To create virtual drive for windows type in the following command in the terminal window (in the directory you want to create virtual drive and install windows)

qemu-img create win.img 4G
This would create a virtual drive by the name of win.img which is 4GB large . You might like to tinker with the size of the virtual drive or it's partition drive .


Installation of Windows XP taking place inside qemu

Now , put in the Windows CD in the drive and follow step no 1
If you have an iso from which you like to boot follow step no 2

Step no 1 :

qemu -localtime -cdrom /dev/cdrom -m 356 -boot d win.img

This command creates a virtual computer which boots from your local cd rom and has 356 MB of memory allocated as it's RAM .


Step no 2 (Follow this step instead of step 1 if you have an iso of Windows installation which you would like to boot )

If you have an iso of windows which you would like to use as CD Rom for your virtual computer type in the following command(replace cdwin.iso with the name of the iso you want to boot from)

qemu -localtime -cdrom cdwin.iso -m 356 -boot d win.img


Windows XP Running inside qemu



Important: - if you want to install Windows 2000 add an additional option "-win2k-hack" , if you proceed without adding this option the installer might fail with message "Not enough diskspace " even though there may be sufficient.



VirtualBox : -

First ensure that all the repositories are in order as mentioned in the step above . After ensuring that repositories are in order issue the following command to install VirtualBox : -

sudo apt-get install virtualbox
and after above step is completed launch VirtualBox from (Applications -> System Tools -> InnoTek VirtualBox )

Now entire interface of VirtualBox is very user friendly and wizard based so well there should not be any problem in installing guest operating system inside VirtualBox hence i am not listing procedure here .


Wizard Based Interface of VirtualBox

Article Written by : Ambuj Varshney (blogambuj@gmail.com)
For Linux on Desktop blog , http://linuxondesktop.blogspot.com
(C) 2007, Ambuj Varshney

Comments

  1. There is also VMware server. It is fairly easy to install and I found it to be quite a bit more stable then either qemu or VirtualBox. Not OSS though and only free for non-commercial use.

    ReplyDelete
  2. Anonymous9:40 AM

    From the instructions:

    First we need to create /etc/udev/rules.d/60-kqemu.rules file and open it for editing , we can do it by issuing the following command in the terminal window :

    gksu gedit /etc/udev/rules.d/60-kqemu.rules

    After the file is opened in the gedit text editor add the following line in the file and make sure you add a newline at end of file too .

    KERNEL=="kqemu", NAME="%k", GROUP="kqemu", MODE="0660"


    now open the file and modify the content of file to look like :

    options kqemu major=0


    Should these lines be in two different files? For the second line it just says "now open the file and modify the content ...". I'm not too familiar with udev yet.

    ReplyDelete
  3. Hey am really sorry i forgot to write the filename in this strp you should open file /etc/modprobe.d/kqemu and modify the content of file to look like :


    options kqemu major=0



    Really sorry abt that

    ReplyDelete
  4. Anonymous4:59 AM

    the sudo module-assistant auto-install kqemu fails for me
    The errorlog has the following statement:
    WARNING: could not find /usr/src/modules/kqemu/.kqemu-mod.o.cmd for /usr/src/modules/kqemu/kqemu-mod.o
    CC /usr/src/modules/kqemu/kqemu.mod.o
    LD [M] /usr/src/modules/kqemu/kqemu.ko
    make[3]: Map '/usr/src/linux-headers-2.6.22-14-generic' wordt verlaten
    make[2]: Map '/usr/src/modules/kqemu' wordt verlaten
    # Install the module
    install -D -m 0644 kqemu.ko debian/kqemu-modules-2.6.22-14-generic/lib/modules/2.6.22-14-generic/misc/kqemu.ko
    dh_installdocs
    dh_installchangelogs Changelog
    dh_compress
    dh_fixperms
    dh_installmodules
    dh_installdeb
    dh_gencontrol -- -v1.3.0~pre11-6+2.6.22-14.47
    dh_md5sums
    cd: 1: can't cd to debian/kqemu-modules-2.6.22-14-generic
    sh: cannot create DEBIAN/md5sums: Directory nonexistent
    dh_md5sums: command returned error code
    make[1]: *** [binary-modules] Fout 1
    make[1]: Map '/usr/src/modules/kqemu' wordt verlaten
    make: *** [kdist_build] Fout 2

    My system:
    uname -a:
    Linux 2.6.22-14-generic #1 SMP Tue Dec 18 08:02:57 UTC 2007 i686 GNU/Linux

    I have followed all the steps in the mentioned order.

    Anyone has also problems building the kqemu module?

    ReplyDelete
  5. Anonymous8:51 PM

    I just installed W2k on qemu and kvm before I'd learned about the existence of kqemu. Can I 'upgrade' the qemu install with kqemu, and if so will the existing W2k image be accelerated?

    Thanks!

    ReplyDelete
  6. Anonymous1:41 PM

    i've got this error message when installing virtual drive "You do not have enough space in '/dev/shm' for the 356 MB of QEMU virtual RAM.
    To have more space available provided you have enough RAM and swap, do as root:
    umount /dev/shm
    mount -t tmpfs -o size=372m none /dev/shm
    Or disable the accelerator module with -no-kqemu"

    whats is the correct syntax to disable the accelerator module

    thanks!

    ReplyDelete
  7. Anonymous12:28 AM

    Thanks,

    The instructions helps me in installing Windows XP inside Ubuntu 9.10 using QEMU

    ReplyDelete

Post a Comment

Amazon Ads