How To: Run Windows And Linux On A Single System

and

Why do it? The disadvantages of Windows are well known. It's a malware magnet, and some reports say its instability has survived even into the recently-released Vista version. At the same time, Windows runs on the overwhelming majority of desktops and notebooks. It's a fact of life.

Recently, Apple Computer has started boasting of the Mac's ability to run Windows via dual boot. This capability is important, because many business programs and popular games alike are available only in Windows versions. Linux has the same problem. Many essential programs are simply unavailable in versions that will run on this open-source OS.

VMware Server makes it possible to not only run these programs, but also to run them from an open Linux session. So a user can work on a word-processor document in OpenOffice in Linux while they run a legacy Windows graphics application to create its images at the same time.

The Linux OS emulation described in this Recipe lets users run older legacy Windows applications within a virtual machine that's a lot more malware-resistant than a computer running Windows as its only OS. This emulation also lets users run the new Linux applications, many of which are as good or better than their Windows equivalents. Oh, and did I mention that they can run Windows and Linux applications at the same time?

id
unit-1659132512259
type
Sponsored post

For example, I'm running Opera in Linux with 90 open sub-windows, something I wouldn't even want to try in Windows. I also have Firefox 2.0.0.1., since some Web sites have trouble with Opera, just like they do with Windows IE. All major Linux distributions come with an OpenOffice equivalent of MS Office, which are free and very, very good. I just downloaded gEDA schematics and PC Designer, which gives me what appears to be a complete electronics design package; the functionality includes rip-up-and-retry PCB auto-routing. For free software, that's not bad!

Linux emulation also gives users an easy transition from Windows to Linux. It does so by letting them run familiar Windows applications while experimenting with new Linux applications. So a user can run "best of breed" apps without caring whether the application runs on Linux or Windows. Also, a user can take advantage of a truly modern OS without the problems that new Vista users seem to be experiencing.

While you can run VMware Server with a Windows host, I don't recommend it. What this will mainly do is give the user a chance to see the "blue screen of death" take down both the Windows host and the Linux guest.

Also, there are three workstation versions of VMware: VMware Server, VMware Workstation, and VMware ACE. VMware Server is free, and it offers the ability to provide normal multi-OS functionality to Linux. VMware Workstation and VMware ACE provide extra functionality for program developers, such as the ability to allocate multiple CPUs to a single virtual machine and to set security policies for virtual machines. These two products are not free, however, and I believe the extra functionality is not useful for the typical user. To compare these products in more detail, view this VMware chart.

Mainstream x86 Multi-OS Choices

There are several ways a user can run Windows or other OSes from a Linux box. While I've found VMware Server to be an excellent solution for my own needs, other programs may fit your users' needs better.

Remember that all emulation applications slow performance and require extra memory over and above what the system would require running in native mode. I'm currently running an Athlon 3500+ with 1 GB of DDR2. VMware did run satisfactorily with a Duron 1800 with 512-MB DRAM and 3-GB swapfile. But it ran badly on that same Duron 1800 configuration with just 1 GB of swapfile. Hardware virtualization support (Intel VT or AMD-V) is desirable, but unnecessary for use with VMware Server.

Below is a list of other ways to run alternate OSes, along with the features that, in my view, present serious limitations:

Dual Boot:

Win4Lin:

Xen:

KVM Virtualization:

Wine:

VMware Installation

There are minor differences between Linux distributions that affect installing VMware Server. There are also many excellent Linux distribution-specific how-to's. Find a distribution-specific how-to that works for you. This Recipe isn't intended to replace them; rather, it's intended to show you how to optimize your system to make VMware Server / Windows as useful as it can be.

To start, get VMware Server here. Also, you can go to the registration page from there, but you'll need a registration number to complete your VMware Server installation.

Get the any-any patch here. This inserts kernel modules required to support VMware Server.

When you run the VMware configuration script, it will ask for the directory name for VMware devices. Change the /var/lib/VMware/Virtual Machines to /var/lib/Virtual_Machines. The blank space will give you endless trouble when you try to access that directory from command line apps. When you're asked for a guest name in the guest configuration Wizard, it also doesn't need spaces; so, for example, use Window_98, not Windows 98.

After Installation of VMware Server

Whether your guest OS runs in VMware depends just as much on the guest OS configuration as it does running in native mode on a physical machine. If you have a USB problem, go to Windows and check Control Panel > System > Devices. Look for the same error icon you'd look for on a physical machine installation. Do this with audio, network, video, etc., and for drivers.

If you've got a previous VMware Server installation (perhaps you just upgraded the host OS or changed Linux distributions), just move the VMware .vmx and .vmdk file(s) into the corresponding place /var/lib/VMware/Virtual_Machines/ location. Then change ownership/permissions to your userID.

Pull down the VM menu from the VMware Server Console to Install VMware Tools. This will improve your speed and stability. It will also give you access to the VMware audio and video drivers.

Guest host file transfers go through a virtual Ethernet card. The default provided with the system is an AMD PCNet PCI card. Its transfer rate on this system is about 400 Kbits per second. Replace that "card" with a Pro1000, and you can get that up to about 3 Mbits per second.

The VMware Server "virtual Ethernet card" is a single-line text entry in the vmx configuration file. Like a real card, it requires a Windows driver.

To get the required Windows Ethernet driver, download the Pro1000 driver: Win 9x, NT or Win2000+. I used the IBM Win98 site drivers. I don't know if the later Intel drivers will work the same for you in VMware. The Intel site I mentioned above has the most current versions, including one for Vista.

If your driver location looks like the following illustration (i.e., down a few levels of directory tree from C), you should create a shortcut to the driver file off C: drive.

For me, installing the driver required lots of swapping between the Windows OS disk and the driver. (This may not be true of Windows versions subsequent to 9.x.) A shortcut gets to the driver with two clicks:

Enter /var/lib/VMware/Virtual_Machine/Windows_98. Open the .vmx file with a text editor and insert this above the first line of the Ethernet section:

ethernet0.virtualDev = e1000

Save the file, and exit. Then, from Windows running in the VMware guest session, do the following:

Setting Up Audio on VMware Server

A VMware Server guest can handle multimedia content and access the PC audio system to provide sound. If you're running a 64-bit host and a Windows Vista 64-bit guest, you can use the 64-bit VMware Server driver on the VMware.com site. Download it, put it in the Windows filespace, and install it as you would any other audio driver.

Everyone else should do the following:

File Access To/From Guest/Host Via Samba

Samba is a collection of programs that collectively provide file and print services for Windows clients, making it possible for them to "see" Linux (and other) file systems as networked drives.

The most useful thing about a VMware Server Windows/Linux installation is its ability to use Windows legacy and native Linux applications on the same files. To make this possible, a filespace visible to both Linux and the Windows guest at the same time is required.

For instance, on my workstation, the Linux system sees /home/alizard/win/* as a directory tree. The Windows guest sees that directory tree as networked Drive E.

This isn't a Samba guide, because there are many books and articles on that. But here's enough to give you a quick start and get you working.

First, make sure that Samba is installed on the system. It usually is by default, but check anyway.

In the following Samba configuration file, "Username" means your username. The user IDs should be the same for both Windows and your host. This configuration file basically defines the shared Linux-Windows environment.

For more information, go to the Samba man file:

$ man Samba

or go to the documentation at the Samba site linked to in the first paragraph of this section. Samba Configuration Setup for VMware Server Open a Linux text editor as root, and save the following into it:

/etc/Samba/smb.conf

( ; means comment line)

[global] ;General server settings netbios name = FC6 workgroup = workgroup wins server = 169.0.0.1 server string = Samba Server printcap name = /etc/printcap cups options = raw log file = /var/log/Samba/%m.log max log size = 50 socket options = SO_KEEPALIVE TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 ; SO_SNDBUF=8192 dns proxy = no guest ok = yes guest account = username security = user encrypt passwords = yes username map = /etc/Samba/smbusers smb passwd file = /etc/Samba/smbpasswd restrict anonymous = no domain master = yes preferred master = yes max protocol = NT acl compatibility = winnt ldap ssl = No server signing = Auto [win] path = /home/username/data/ writeable = yes valid users = username comment = home admin users = username browseable = yes case sensitive = no

The "path" in the above configuration file should point at the Linux directory or directory tree that you want to be the shared Linux-Windows filespace.

When the new directory appears within the C: drive, right-click its icon in Properties and click "Map to network drive." (It will probably be drive E:) Once you've set up Samba on VMware Server, you may get this error message during startup: "Permanent connection not available. . . do you want to restore . . .?" If so, then click Yes. Next, check your shared folder / network drive from Network Neighborhood or Windows Explorer. If it worked to begin with, you should see the contents of the shared Linux/Windows directory right where you left them.

On a new installation, if you have a firewall installed, you'll know that Samba is up as soon as you see the following VMware ZoneAlarm alert:

As soon as you see that (assuming that it is in the "localhost" 192.x.x.x range), tell your firewall to permit NetBIOS access to that IP address. Open your firewall there, and you should see something like the following in Network Neighborhood:

Helpful SAMBA Hints

The following hints and tips will make the shared Linux / Windows filespace easier to use:

Setting Up USB Devices (Printers, Scanners, etc.)

You can access a printer, scanner or other USB devices directly from Windows applications via VMware Server.

The following image shows the menu tree opened to where one selects specific USB devices for use with VMware Server. To select a device, click on the corresponding device menu entry. A checkmark will then appear on the menu next to selected the next time you open the menu:

To get to what you see here, from the VMware Server Console top menu: VM > Removable Devices > USB Controller > printer.

Here's how to get a USB printer working in VMware:

You can also get scanners and other USB devices to work, as well, by following the non-printer-specific part of the above procedure. For example, I got a Belkin USB UPS working in VMware. (Later, however, I realized that the software was of no particular use on a Linux host!)

The VMware virtual USB adaptor lets you operate two active USB devices concurrently. To attach a second USB device, follow the "VMware Toolbar" step above. A USB device can be used either from the Linux host or Windows guest; you have to choose which OS the USB device is to work with, and then change as necessary.

Running a Printer from VMware Server

Disable the printer in Windows so it can be used in Linux by going to the VM > Removable Devices > printer menu item again. Then unplug/replug the printer's USB cable. Go to print manager, and stop/start the printer.

To switch USB printers between OSes, you may have to turn off the USB devices on VMware server, or even restart a device using unplug/plug. Then restart the CUPS Linux print system. Do this by going to the Linux Start Menu. Then open Control Center, click Peripherals > Printers, and click Printers from the top Printer menu. Finally, click Restart on the pulldown menu.

As for scanners, you might as well do this from Linux!

VMware Server occasionally drops Windows audio. If this happens, right-click the speaker icon on the bottom-right of the status bar of the VMware Server console. Then select Connect. Hints and Tips to Improve VMware Server Operation

Here are my top VMware Server hints and tips:

Split the Virtual Disk for Higher Speed and Easier Backup

Before starting this part, find VMware hints and tips in the Reference section below, as it covers command line utilities and where to get them. Next, the following command does the actual splitting of the virtual disk using a VMware Server command line utility:

# VMware-vdiskmanager -r sourceDisk.vmdk -t 3 destinationDisk.vmdk

Once done, change the permissions:

chown username:username *.vm* chmod 777 *

Open the original *.vmx file. Make sure it points to the first of the series of split files the flat file originally created will become. VMware-associated files are listed in this text file: /etc/VMware/locations.

VMware Server running a Windows guest on a Linux host provides the user the advantages of both OSes. Namely, Linux stability and malware immunity, plus Windows program availability. It also provides future-proofing to the extent that this is possible on a modern computer system. As Linux programs become available that provide identical or better functionality, the user can easily move on to those Linux programs.

I use this setup myself, and I find myself increasingly using Linux applications that work just as well or better than Windows programs. Also, for the most part, Linux programs are free and can be installed from an installer GUI or a simple CLI command. By and large, once successfully set up, it just works.

References for VMware Server Installation and Operation Documentation

You can download documentation for VMware Server at the links below. This documentation will provide you with the information referenced in this Recipe. It will also provide background, supplemental information that can help you troubleshoot problems and extend the functionality of VMware Server.

The following manuals can be found on this VMware Technical Documents References page. I recommend you grab these three:

A. Lizard is an Internet consultant in the San Francisco Bay area. He has been writing for technology magazines and Web sites since 1987.