Thursday, April 05, 2007

Linux in a virtual machine

Woo hoo I'm writing this using Firefox on Linux running in a vitual machine on my Windows XP computer. About a week ago a work colleague had to resort to a virtual machine to get a piece of software running that was not compaitble with his new Vista laptop. That sparked my interest so I thought I would play around a bit. Every virtual machine needs an operating system so I thought I'd have a go at getting Linux running in a virtual machine while I was at it. Since I had limited experience of either virtual machines or Linux I could kill two birds with the one stone.

Linux comes in many flavours but the flavour of the month for noobs like myself is called Ubuntu. It's an easy to install complete package using the clean and simple Gnome interface. Better still I happened to have an install CD from Ubuntu version 6.06 that I had downloaded a few months back but never got around to using.

My first choice of virtual machine was Microsoft Vitual PC 2007. This has the great advantages of being completely free and ludicrously easy to use. Microsoft don't claim to support Linux but several people have reported success at getting Ubuntu to work under VPC 2007 so I thought it was wirth a shot. Download - install - run - creaste new virtual PC. There are very few parameters to enter basically just the size of memory and hard disk for the virtual machine. When you start the virtual machine it looks for a boot disk in the CD drive and it happily booted the Ubuntu install CD. First attempt gave a corrupted screen however but googling around pointed to the need to start Ubuntu ins "safe graphics" mode. Bingo I was running Linux. Ubuntu runs from the CD on first boot and it is painfully slow so I installed it to the virtual hard drive. It ran quite successfully but things were a little slow. The mouse in particular was unresponsive and the mousewheel didn't work at all. Initially I got no sound but I did find a fix on Google. This was a bit messy involving editing a system file to tell it about the Soundblaster 16 that Virtual PC emulates. There doesn't seem to be a "root" log in in Ubuntu so in order to change system files you need to use a "sudo" command to run the editor. A bit messy but I figured it out eventually. One reboot later and I had sound. Sadly the sound was very scratchy and not really worth the effort. Perhaps virtual PC would work better with microsoft products but with an unresponsive mouse and poor sound I wasn't too impressed with Linux performance.

As far as I can make out the market leader in virtualisation is a company called VMware. Internet buzz suggested that VMware is faster and more flexible than virtual PC but VMware's flagship products are not free. Wikipedia however revealed an interesting fact. VMware do offer a free "player" for download that can run virtual machines created on their commercial products. Better still it turns out there are a number of free applications that can create virtual machines that run just fine with VMware player. I tried two a web based application called EasyVMX and a downloadable app called VMXbuilder. EasyVMX is easier to use offering three levels of sophistciation. The easiest level is about as easy as virtual pc 2007. VMXbuilder seems to be more flexible and I actually prefer it.

In use VMware player is about as simple as Virtual PC 2007 just open the player select the virtual machine you want and you are off. It seems to run a lot more quickly though. The system is very useable with no mouse lag and a working mousewheel. Ubuntu automatically recognised the default sound system and the sound was much better than the scratchy sound I got from Virtual PC. I was using 512M of virtual memory and 10Gb of virtual disk for both tests. I even managed to connect Ubuntu to my windows network and connected to a shared printer although in order to do this I had to change the ethernet setup from the default NAT (where the virtual machine hides behind the host machines IP address) to bridged (where the virtual machine talks directly to the network. Sadly in messing around I managed to uninstall the sound card and I haven't yet found out how to re-install it. Plug and Play doesn't seem to be a big concept in the Linux world. My biggest gripe with VMplayer is that it doesn't stretch the virtual display in full screen mode. Perhaps this is a setting I haven't figured out yet. I am sure Virtual PC could do this. Even allowing for this I have to say that VMware player seems to be the better option for Linux.

Is all this useful? Probably not. It might be handy to be able to run some old game using an old version of windows but in my eperience the community are fairly quick to come up with emulators and such that will allow you to play whatever you want on the latest flavour of Windows. Unix is fun and I have to say that Ubuntu looks and feels very polished. Installing new hardware is a bit painful but apart from that everything seems very straightforward. I really love the idea of a free operating system. That said I cannot think of a reason to use it. Windows does everything I want and many of the best Linux applications have been ported to Windows (eg Open Office, The Gimp, Tuxpaint). I do think we owe a huge debt to those who provide free software however and the computing world would be a much less friendly place if the whole GNU / Linux phenomenon had not taken place.

EDIT: Well I got the sound working again - it was a simple matter of enabling sound in the vmx file. Getting full screen mode is a knottier problem. It seems to be a feature (bug!) of the current implementation of VMware player. Perhaps this is a deliberate ploy to convince people to buy one of the commercial packages. There is a kind of a work around - the vmx file has a flag that allows you to enter fullscreen mode when you first start the virtual machine. This works but if you go back to windows you cannot return to full screen mode.

2 comments:

havard said...

Hi, I just finished reading your story about virtualization. And it was a great read!

Neither virtualization or getting started with a new operating system is a trivial task, and I quite enjoyed your detailed description of the experience.

You got the fact that VMware Player doesn't create virtual machine. This also means that Player doesn't have the need to include the drivers for new virtual machines either. This is the source for some of your negative experience. The most noticable is the lack graphics drivers.

Unfortunately, VMware prohibits redistribution of these drivers (called VMware Tools), so you will have to Google for them.

Good luck with both Linux and virtualization.

Havard from http://www.easyvmx.com

mbp said...

Thanks Harvard. I have to say I was amazed at how easy the whole process is. Easyvmx is a terrific tool and the forum is a great information resource - thank you for providing it.