红联Linux门户
Linux帮助

Running Windows Vista on Debian Linux with VirtualBox

发布时间:2007-11-06 00:17:59来源:红联作者:bitrated
All of my laptops are now running Debian based Linux. It works great. Linux handles all my daily works well. However, there are occasions where I need a Windows machine. For example, I recently need to deliver a lecture on a system that runs only on Windows. Also, in the past, we developed a system that works only on Windows, and I still need to demonstrate it from time to time. Of course, the solution is to run Windows on a virtual machine on top of Linux. In the last couple of years, I have been using VMware for this purpose. However, I was not very impressed by its performance. I remember last year during a presentation, the virtual machine was so slow that my demonstration was negatively impacted by it.

Open source edition

Yesterday I read a review saying that VirtualBox performs better than VMware, so I decided to try it out. It turns out to be a good experience. The installation is easy enough on Debian. I use sid (still in development, a.k.a. unstable) version of Debian, the open source edition (OSE) of VirtualBox is in the pool already. So I installed it with synaptic. VirtualBox's GUI is somewhat similar to VMware. It's very easy to create a virtual machine (VM). Just select OS type of the guest system, VirtualBox will make suggestions on several virtual machine parameters such as memory size and hard-disk size, etc. I selected Windows Vista (BTW, according to Microsoft, only Vista business and ultimate editions are legal to use in virtual machines, see here) as my guest system, it suggested 512MB memory and 20GB hard-disk. For a choice of WindowsXP, it suggested 192MB memory and 10GB harddisk. Of course, these are just recommended minimums. User can change it anytime after the virtual machine is created.

After creating a VM, I set out to install Vista. After starting the VM, it says the kernel module couldn't be found: I forgot to build VirtualBox's kernel module. This requirement is similar to VMware, where kernel module has to be built for the running kernel. I believe this will put many potential users off. Here, I think Debian installation script should build the module automatically. Another possibility is to let Linux mainline kernel having these modules built in. I read somewhere that the future seems to head to that direction (see kvm). For Debian, building and installing a kernel module cannot be simpler. Just use module-assistant, issue one command as root:

m-a a-i virtualbox-ose-source
, and it's all done. To load the module on boot, add a line vboxdrv in /etc/modules. Now you need to add yourself to the vboxusers group and reboot, or you will get an error “VirtualBox kernel driver not accessible, permission problem …”. After rebooting, I started the virtual machine and were ready to install Vista. Now I got a small problem. My Thinkpad X61 laptop does not have CD/DVD, and I only has a portal CD writer, not a DVD reader, but my never-used-before Vista business edition (my wife got it for free by participating in some Microsoft activities, in case you want to know) is on a DVD. Fortunately, VirtualBox allows an ISO image to be mounted as an CD/DVD. One of my desktop machines has a DVD writer, so I ripped the Vista DVD into an ISO image, and copied it over to my laptop. Problem solved. Now I could install Vista in the virtual machine. The installation of Vista on VM is uneventful, except that Vista does not have the network driver for the VirtualBox's virtual network card - an AMD PCNET card. Following this suggestion, I downloaded and built an ISO image for the driver, and installed it in Vista. Now I got a functional Vista on top of Linux.

I did not do any formal benchmarks since it has been done, but I can confirm that Vista seems to be running well in VirtualBox. It feels smoother than a Win2k in VMware on my Thinkpad X31. What I like about VirtualBox is its support of tight integration between host desktop and guest system. To get integration, from the Devices menu, click “Install Guest Additions” and allow Vista to install them. Once installed, VirtualBox support a "seamless mode", where the guest system's desktop background is supressed, only application windows are shown. This feels like the guest system applications behave just like regular applications on the host desktop. In my case, Vista coexists very well with my KDE desktop running Compiz-Fusion 3D desktop. I have a few screenshots above showing off some Windows Vista applications on Compiz-Fusion. I guess the fluid and dynamic nature of the interaction has to be seen with a video to appreciate. However, I am not going to make one at this moment since my laptop is not powerful enough for getting a good recording frame-rate, and I don't have a video camera at hand. In addition, VirtualBox has a built-in clipboard that supports direct copy/paste between guest and host systems, which I find very useful. Of course, shared directories can be created so that host and guest system can share files (does not work with Vista yet, see below). All these features make VirtualBox the nicest free virtualization solution I've seen for desktop use.

Binary edition for personal and evaluation use

VirtualBox also offers a commerical edition that has USB and remote desktop protocol support. This edition is closed source, but free binaries can be downloaded for personal and evaluation use. Some people said that it's faster. So I uninstalled the open source edition and installed the Debian binary of this non-open-source version. The installation is easier, since the installation script automatically build the kernel module for you. I tried the USB functionality in Vista guest, and it did NOT work as I expected. I inserted a USB key, first the Linux host picked it up as usual, and offered me to open it as a folder. I chose "Do nothing". VirtualBox also picked it up, and I could right click the USB icon to mount it. Once I did, Vista found it, and started searching for a driver. Unfortunately, it could not find a driver for it. I thought that USB keys were standard devices and there shouldn't be a need for drivers in Vista. I tried to mount my fingerprint reader, no luck either. I don't know this is a problem of Vista or VirtualBox, it does not work out. What's more, after this around of meddling, the virtual machine became less stable as before. Update: I tried to work out the USB feature again. This time it works. There are two things need to be done: 1. Change the udev rule for usb_devices in /etc/udev/rules.d/020_permission.rules from mode 0664 to 0666, so everyone can access it. Also, change /etc/fstab, so the usbfs line has mode 666 as well. Although this sounds like a security risk, I don't think it's a big deal. My machine is a laptop, not a server, if they can use your usb devices, they have already broken in. 2. Set up filters for the devices in VirtualBox GUI. If you plug the device in, it actually fill in values for filters for you. It's pretty nice. However, I think better documentation is needed.

One thing that does not work on both editions (version 1.5.2) is the shared folders feature for Vista guest. VirtualBox's user manual said that only Win2k, WinXP, Linux 2.4 and 2.6 guests are supported for shared folders. I found that's to be true. I hope they will add support for Vista guest in the near future.
文章评论

共有 0 条评论