October 5th, 2015
QEMU: Run guest OSes on a locked-down Windows machine
If you have a locked-down machine at your work place, as I do, then you will know the pains of having to work within the constraints of having only portable applications and if there is no portable versions of the application, you will be out of options. Being the ‘rebel’ as always, I wanted to circumvent this and install my own applications – without raising any alarm at my system administrator’s end. This means seeking out portable versions of VM-like solution to achieve my objectives.
A quick search online revealed that it is possible to do it. I was visiting a few websites, and while they specifically talk about linux and qemu, I was looking for a qemu on a window 7 machine. So putting things together, I managed to run a Window XP (or for that matter, any OSes) on a qemu-able host.
First, you probably need a qemu run-time to start with. This run-time must be ‘installer-free’ (err. sort of. if it is portable, it would not trigger your User Access Control in Vista or windows 7 for special access rights). I got mine from http://www.davereyn.co.uk/download.htm. So installing the file under the section “Zip File Edition (Unzip and run! can be used with USB Pen sticks/Drives” as they do not need to be installed, just unzip to a directory where you want it to be, and you are ready to rock!
Next, you will need to find an OS image to boot from. The idea here is to use an OS installer contained in an ISO image file. I had a free Windows XP Home CD lying around the house from a de-commissioned notebook, so this was pretty convenient. All I needed was to use MagicISO, burn the CD to an iso image, and I now have an ISO image of the Windows XP Home installer.
I assumed that your PC is a locked down version, so we will use the command-line version instead of the qemu manager. If yours is not a locked-down version, then you can use qmanager or even other options such as VirtualBox or something that does similar things.
Navigate to the sub-directory of qemu in the installed qemu, I first have to create a virtual disk for this new “virtual PC”. This is easily done by running the following commands:
qemu-img create hdd.img 20G
So the essence of this statement is to create a virtual hard disk to install the virtual PC. The hard disk size is set at 20G. If you can, set aside more space, because creating a larger hard disk later may take more effort and time. So choose a larger size if you can afford the space 🙂
Once created the virtual hard disk with 20GB of space, the next thing you will want to do, is to install the guest OS into the qemu virtual PC environment. To emulate a real CD-ROM, you will need to tell qemu to read a CD-ROM from a virtual CD-ROM. This is done by running qemu with the following parameters:
qemu -hda hdd.img -cdrom winxp.iso -m 256M
This assumes that your virtual hard disk file is called hdd.img, and your guest OS’ installer is stored in an ISO image file called winxp.iso.
The -m 256 basically tells qemu to allocate 256MB of running memory for the OS. For Windows XP, 256MB is a reasonable size, but you can allocate more if you wish to.
qemu will then boot in the windows XP installer CD (so you have to make sure that your ISO image is a bootable installer, just to be sure).
Follow the instruction on the screen, and you should be on your way to installing the Windows XP OS in your qemu environment.
A few tips here. If you want to switch to Full Screeen – CTRL + ALT + F (toggle).
The built-in cirrus logic graphics card can take a screen resolution of up to 1280x1024x16 bit color depth. Any larger, you might wish to use the -vga std switch to cater for that.
Once you have installed the Window XP OS, you can run qemu without mounting the CD-ROM iso.
So a simple command should do the job:
qemu -hda hdd.img -m 256M
The next question you ask, is how to transfer files between the host OS (locked-down) and the new Windows XP OS?
Well, a quick and dirty way, is to install a portable FTP server on the host, and then connect to the host’s FTP server to do file transfers.
For this purpose, I chose the Quick and Easy FTP Server from here : http://www.portablefreeware.com/?id=1362
Then configure the server with the directory where I want to transfer the files, and started the server.
From the Windows XP Home guest OS, I just to issue a command in the Windows Explorer:
ftp://ip-address of the host machine/
Enter the username and password, and you will see the contents of the shared directory.
Feel free to transfer files from the host to the guest by using the Ctrl-C key and Ctrl-V!
So in essence, you would have a working Virtual PC working in your locked-down PC, all without the need to use any administrator rights at all!
I hope you will find this useful, especially with those who really needed to run an application which need administrator rights. Now you can – in your own Virtual PC inside this locked-down PC/notebook!
Cheers and have a good time qemu-ing!