Learn how to configure Linux to run on Microsoft's Virtual PC.
Many enterprises need to run both Windows and Linux workstations or servers for testing or for cross-platform purposes. You may be surprised to learn that it's possible to install and run Linux within Windows using Microsoft's recently released Virtual PC 2004. The virtual machine emulator runs on Windows XP Professional, Windows 2000 Professional, or Windows XP Tablet PC Edition hosts.
A Microsoft product that supports Linux?
Linux users expressed much concern and confusion after Microsoft announced in January 2003 that it had purchased Connectix Corp., maker of Virtual PC. The December 2003 release of Microsoft's Virtual PC 2004 only added to the misunderstandings.
Because the product's documentation for installing and running Linux was absent, this seemed to confirm that Microsoft had entirely removed Linux guest support. Fortunately, this isn't the case. Microsoft simply offers no official support for installing its competition: BSD, UNIX, Linux, NetWare, and Solaris. But these operating systems will install on Virtual PC and run well.
However, missing from the retooled Microsoft product is Virtual Machine Additions for Linux. These additions, after being installed on guest operating systems, accelerate virtual machine performance and make possible such niceties as file sharing, copying/pasting, and dragging/dropping between guest and host OS; changing the guest system's automatic mouse pointer focus; undo disks; and differencing disks. (Virtual PC's competitor, VMWare, does offer nearly identical tools for Linux guests.) But even without the virtual machine acceleration and other conveniences, Linux's performance is not bad.
For the purposes of this article, I'm not going to run you through the process of obtaining and installing Virtual PC. I'm just going to show you how to configure Virtual PC to support Linux. For more information about Virtual PC, see the article "Build Your Skills: Create an entire test lab on one system using Virtual PC."
Virtual PC installation
Installing Virtual PC presents no difficulties on a Windows/Intel host. There have been some reported incompatibilities with AMD processor systems, but Microsoft is working on a fix.
Once installed, VPC has a clear user interface in the Virtual PC Console (Figure A). The console lists guest operating systems as they are installed and provides quick access to settings. Once it's started, guests open in separate windows. This is in contrast to the VMWare tabbed interface.
|The Virtual PC Console is a clear user interface and start center for installing and launching virtual machines.|
You can set global Virtual PC program options by selecting File | Options (Figure B). It's helpful to configure the performance settings so that Virtual PC has priority when running in the foreground, and give host processes priority when VPC is running in the background. I also find it helpful to turn off automatic screen size resolution, since this confuses some guest operating systems.
Virtual PC quirks
Virtual PC runs well on my laptop, which is close enough to the minimum system requirements that I'm pleasantly surprised. However, the program is not without its annoyances. Some of these include:
- If you minimize the Virtual PC Console, it seems to disappear. To recover the console, right-click its icon on the taskbar and select Show Virtual PC Console.
- Virtual PC incorrectly reports the size of my external hard drives. However, this glitch does not appear to affect the installation of virtual machines or how they run. The misreading may be due to the fact that Virtual PC does not directly support USB and IEE 1394, though it recognizes them through the host BIOS. (I use USB and IEE 1394 external storage for VPC guest systems.) Don't fret if you have a USB mouse and keyboard. VPC recognizes them as PS/2 devices. Unfortunately, other devices such as CD and DVD-ROMs and cameras can't be used in a VPC machine.
- Perhaps due to the problem with USB/IEE 1394 support, Virtual PC will set an incorrect file time/date stamp when saving to a shared folder on the host machine. (File sharing can't be enabled under Linux anyway, so this won't be a problem for you.) This error is unconfirmed by Microsoft at this time.
- Occasionally, Virtual PC will not start a virtual machine, reporting that there is not enough allocated virtual memory. Sometimes this is in spite of the fact that Task Manager reports enough memory being available. Closing and restarting Virtual PC seems to solve the problem. You may also solve the memory problem by closing host applications, stopping unneeded processes, and reducing the amount of memory allocated to the virtual machine.
Configuring a new Linux virtual machine
I performed my test installation of Linux using Red Hat 8.0. It was actually a bit easier than installing with VMWare, since it was possible to use the graphical, rather than the text-based, installation program. (VMWare requires text-only installation of Red Hat, followed by the installation of the VMWare tools package in the guest before the X graphic system configuration.)
To begin the Linux installation, click the New button on the Virtual PC Console. The New Virtual Machine Wizard will start. Click Next, select Create A Virtual Machine, and click Next again.
In the text box, type a drive, folder, and name for the new virtual machine. If the folder doesn't exist, Virtual PC will offer to create it for you. Click Next. From the lengthy drop-down list of supported guest operating systems (all Microsoft-based, plus OS/2), choose Other and then click Next.
Virtual PC will recommend an amount of RAM to allocate for the virtual machine, based on your system. Accept the default value or choose the option to modify the value. When you opt to adjust the default value, a slider bar will appear. RAM can be allocated in 1-MB increments. Note that you can also reallocate RAM for each guest whenever it is powered down. Click Next.
In the Virtual Hard Disk Options screen, choose the option A New Virtual Hard Disk, and then click Next. In the text box, type in a drive, folder, and name for the new virtual hard disk. If you choose to use a different folder than the one in which you created the new virtual machine configuration file a few screens ago, Virtual PC will offer to create it for you if it doesn't already exist. Click Next.
You will be presented with a summary screen. Use the Back button to return to any settings you want to modify; otherwise, click Finish. Your new virtual machine will now appear in the console. Not Running will appear below the name. You're now ready to install Linux.
Highlight the virtual machine. Select Settings if you want to make any adjustments. For example, under Networking, select NAT (Network Address Translation) from the drop-down list to create a hands-free configuration of network sharing between the virtual and host NIC.
When you're finished modifying the configuration, place the first Linux installation CD in the CD-ROM drive and click the Start button in the Virtual PC Console. The new virtual machine will power on in a separate window.
You may get an error message that the system can't boot, as follows:
Reboot and Select Proper Boot Device
Or Insert Boot Media in Selected Boot Device.
If you do, you need to specify the location of your CD-ROM. In the Linux virtual machine window, select CD. Your CD drives will be listed, as well as the option Capture ISO Image. Choose Use Physical Drive X:, where X is the drive containing the Linux installation CD. The Linux CD installation program will load (Figure C).
|With the CD-ROM selected, the Linux installation program will boot in the new virtual machine.|
To enter information into the installation program, click the mouse pointer in the Linux window to give focus to the guest OS. Whenever you need to return the focus to the host OS, pressing the right-hand [Alt] key will release the pointer. To install the guest operating system in Full Screen mode, press the right-hand [Alt][Enter] key combination. The same key combination will cancel Full Screen mode when you need to access the host operating system. Configure the Linux installation as usual for your system, noting the following:
Setting video emulation
Regardless of the actual video card your physical hardware uses, the Linux installation program will probe and find an S3 Trio64 card. This is normal. S3 Trio is the virtual graphics driver emulated by Virtual PC.
Dealing with a VM Additions warning
If you receive the message "Virtual Machine Additions is Not Installed on the Machine," click OK to dismiss. There are no additions for Linux.
Configuring a mouse
Choose the generic type of PS/2 mouse supported by Virtual PC, which is a two-button wheel mouse or a two-button mouse.
Selecting a system type
Red Hat 8.0 allows you to choose a preconfigured system (desktop or workstation server) or a custom installation. Select the type of installation you prefer.
Partitioning and formatting a virtual disk
A confusing and anxious step during any virtual OS installation occurs when the guest installation program prompts you to partition a virtual hard drive. In the installation program, it appears as if actual physical hardware is about to be erased. This won't happen.
Partitioning will not affect the rest of the hard disk. It will simply create a file on your hard drive that contains the virtual partition. Partition the "drive" with no worries.
Note that unless you originally specified your virtual hard drive to be created at a fixed size, the size of the virtual disk will grow dynamically as needed. (As I mentioned earlier, if Virtual PC incorrectly reports the drive size, it appears that you can ignore this information.)
When you get a message that reports the device as unreadable, click Yes to initialize the drive, as shown in Figure D.
|Though it's a scary step, initialize the drive. Virtual PC drives are simply large files that appear to be physical drives to the guest operating system.|
During network configuration, accept the default Ethernet card eth0. Accept the DHCP settings unless you know you need to manually configure IP settings.
Configuring a firewall
On the Red Hat firewall configuration screen, the default medium security setting should be adequate. After you've entered your configuration choices, the Red Hat setup program will format the Linux file system and start unpacking and installing the Linux kernel and packages you chose. All should proceed as normal for a hardware install, with the exception that setup will take considerably longer through the virtual machine than through hardware.
X system configuration
Toward the end of the installation, you'll be asked to configure the Linux X system graphical interface. The configuration program should detect an S3 Trio64 card, as noted above. Accept this card.
If the card is sensed with 4 MB of video memory, change the value to 8 MB to match the virtual driver; otherwise, your screen may become truncated. Choose 16- or 32-bit color (24-bit color is not supported).
Recovering from a bad X config
If you run into problems with the X graphic system, try reconfiguring it as follows:
- Adjust the size of graphic memory. Make sure you try 8 MB first.
- Change the emulated video configuration from S3 Trio64 to VESA 2.0 drivers, if available on your Linux install. Some people report this solution may run better than the virtual S3 Trio drivers.
- In the monitor selection, accept the default value of unprobed monitor.
- Red Hat lets you test your settings before proceeding. Doing so during my install gave a successful test. However, immediately following the test, the Virtual PC screen came back half-size, and I couldn't continue with the installation.
- If this happens during your setup, try resetting the virtual machine by choosing Action | Reset. Since Linux is all but installed at this point, you should be able to start Linux, though it will default to the console rather than the graphic mode.
- If Linux reports problems with the file system, restart and, when prompted, select Forced System Integrity Check. Linux should self-repair the journaling system.
- Log in with the account you gave during configuration, and manually configure your X system. At the command line, enter redhat-config-xfree86 or the X system configuration command used on your Linux distribution.
- Linux should then load normally.
Time sync correction
Unlike the supported Windows operating systems, Linux guests in Virtual PC are not able to sync the system time with the host. There used to be a workaround to this problem for the Connectix version of Virtual PC, but it no longer works. The current workaround is to configure Linux to use NTP (Network Time Protocol) over the network to sync the time with an Internet-based time server.
To do so, select the Date/Time Properties configuration from the main menu, or type at a terminal prompt (in Red Hat) redhat-config-date. When the interface opens, check the box marked Enable Network Time Protocol. Select a server from the drop-down list. The NTP daemon will start and sync the time.
To run sound with Linux under Virtual PC, you'll need to set up Linux to recognize a SoundBlaster SB 16 sound card. Doing so may require that you run the program sndconfig in a terminal screen. If your system didn't install the program by default, you'll need to do so manually.
Run sndconfig as superuser in a terminal window. Choose SoundBlaster 16 from the drop-down list. Suggested card settings are:
- I/O Port: 0x220
- IRQ: 5
- DMA 1: 1
- DMA 2: 5
- MPU I/O: 0x330
If the sound card test doesn't play a sound, try adjusting your speaker volume. Prompt to create a new configuration file if one already exists.
There are a few standard methods for squeezing extra performance out of your Linux guest OS. These apply across the board to any OS running under Virtual PC:
- Run virtual machines in Full Screen mode or in the foreground so that they receive a higher priority.
- Invest in RAM. The ability to assign beaucoup RAM to both the host and guest operating systems will result in faster virtual machine performance.
- If possible, use a separate hard drive for your virtual disks. If you do, data throughput will be higher for both host and guest OSs.
- Defragment your drive before installing virtual disks. In addition, consider creating a fixed-size disk. Disks that must grow dynamically are slower due to the extra file operations.