How To: Windows XP Mode In...Ubuntu Linux?

USB, Clipboard, And Troubleshooting

Can I Copy and Paste?

Back in the early days of desktop virtualization, the guest OS was completely separated from the host. Let's say you need to complete a Web-based research project and input the data into an Excel-only spreadsheet. If you were on Linux years ago and tried to virtualize, you would need to do your research from within the VM (probably in IE) in order to use the copy and paste functions. The alternative was to manually type all of the research data you found Linux-based Web browser into Excel running in the VM. Neither option is appealing.

If you run all your apps from within a VM, what's the point? Why not run that OS natively? Alternatively, why make more work for yourself by throwing out the nearly thirty year-old advent of cut and paste?

With VirtualBox, we've already seen how the keyboard and mouse automatically bind and unbind themselves to the guest OS without the need for special keyboard commands. But how about cut, copy, and paste features? In the past, you would most likely be out of luck (or have had to jump through hoops to get something working). Fortuneately, VirtualBox has reached the point where these staple functions are built-in. Go ahead and give it a try. Copy something from the Web in your Linux-based browser and paste it into Internet Explorer in Windows, or vice versa.

What about my USB Devices?

On page two, we added ourselves to the vboxusers user group. We did this in order to use USB devices via Windows XP. However, the same USB device cannot be used by the guest and the host OS at the same time. Therefore, we need to specify which devices we want to show up in the guest OS. Go ahead and open up XP's VM settings. Make sure XP is shut down, highlight the VM in the VirtualBox main window, and select Settings from the navigation bar. When the Settings window appears, choose USB in the left pane. Under USB Device Filters, click on the Add Filter From Device icon (it's the little USB plug with a green plus sign). A list of your currently plugged-in USB devices will pop up with check boxes next to each. Simply check the device you want the XP guest OS to use and then click OK. For the example in my screenshots, I plugged in two USB sticks (128MB and 4GB), a Canon digital camera, and an HP printer, as well as my Logitech mouse and Altec Lansing speakers, which are always plugged in.

Keep in mind that Mouse Integration from page six will handle USB mice, so there is no need to add a filter for that device. The same holds true for USB speakers, since you are using the audio driver from the host OS and it needs the speakers, not the guest OS. Remember that any device you add a filter for will not be usable in the host OS until the VM is shut down or the filter is removed. I selected one of the USB sticks and the HP printer.

Special digital camera software, PDAs, iTunes? No problem. Just add a filter for the devices you want Windows to use and the next time that you start XP, they will be connected. Note that any device you use in the XP VM will need to be configured just as you would with any PC running XP natively.

Can You Hear Me Now?

One of the most common issues that people have with VirtualBox is garbled, or a total lack of, audio playback. Fortunately, this is relatively easy to troubleshoot. If you noticed sound issues when finalizing the XP installation or afterward, you need to go back to the Settings for the Windows XP VM. In the VirtualBox main window, highlight the XP VM, then click on the Settings button in the navigation bar.

Click on the Audio page in the left pane. Make sure that the check box next to Enable Audio is checked. If it was already checked and you still have no audio, try another driver in the Host Audio Driver field. Boot up XP and test for sound. If necessary, repeat the process. Eventually one of these drivers should work for you.

The Audio Controller field refers to the sound controller on your motherboard or on an installed card. If your sound is still not working properly, check the corresponding hardware manuals to be sure which controller you have.

  • cmmcnamara
    I applaud the promotion of Linux, but this can be done in Windows too....Virtualbox is multiplatform.
    Reply
  • johnbilicki
    VirtualBox kicks some serious ass. Unfortunately Windows 7 is nothing more then Vista glorified and I'm sticking with XP until I figure out which Linux distro to use. If they wanted 7 to succeed they should have added Aero and networking improvements to XP but instead they had to reinvent everything and they failed miserably at doing so.

    The UI requires two to three more times the clicking (start menu--> programs requires two clicks versus XP's one in example). A critical aspect of design is consistency which was thrown out the door, where is the My Documents folder? Sure there is an equivelent but changing what it's call is like telling people to call their CPU's "fuzzles" without any justification. ...and just like Vista you STILL can not move the ENTIRE My Documents folder so if you're keen enough to NOT put your personal/work files on the same drive/partition as the OS you'll still have to deal with programs automatically generating folders on C:\ so you'll need to manually move each folder for EVERY program every time otherwise you're looking at losing 30-50 hours of saved game files PER game. 7 is also less customizable and for those who aren't politically ignorant can you spot the communist propaganda? Even the 7 ads are stuffed full of it. The complete lack of design in 7 just can't be made up by eye candy alone; substance is more then skin deep.
    Reply
  • jsloan
    xpm is nothing but an integrated microsoft virtual pc 2007, which microsoft makes available for free.

    i've been running w7 since day one and i have not found a reason to use xpm. windows 7 runs everything i've thrown at it.

    also, virtual box runs fine on w7, so there is no need for linux...
    Reply
  • johnbilicki
    How about some articles in regards to getting popular games to run on Linux distros? I finally got around to trying Wine and I was amazed as how insanely easy it was. A good article could convince many to migrate...and I'd love to see major releases start taking Linux as a serious gaming OS.
    Reply
  • void5
    You can't run Windows in virtual machine on Linux "all for free" - you still have to buy license to use Windows copy legally.
    Reply
  • lifelesspoet
    So far I tried 3 games that didn't run in windows 7 but ran in wine. It seems from my example, the older the program is the more likely it will run in linux and less likely it will run in the latest version of windows.
    Also, virtual box doesn't support directx, so graphically intense programs will not run properly or at all.
    Reply
  • JonathanDeane
    I like my main machine (the one with the most oomph) to run Windows what ever flavor is the latest. Then I like to run Linux on older hardware since Windows tends to bloat over time and not work so well. The OS is just a tool. XP is almost to that Windows 98 stage where it lacks security and is getting slower with each patch and lacks the new shiny. RIP XP you where the best of the best in your day! Being OS agnostic gives you more tools to work with in your life learn to use them all properly and you will find you can do things you thought where too hard or too complex before. Maybe one day people will learn to love all OS's equally lol
    Reply
  • bujcri
    Very nice article, still, it doesn't mention anything about possibility of running 64 bit software or how many cpu cores virtual box can use (I saw from the picture that it could be more than one)
    Reply
  • danny69t
    Good article. Keep it up with Ubuntu "stuff" like this. How about making a short article about installing software from tar.gz ? I didn't manage to use them darn tarballs.

    "all the ways to customize your GUI, from panels to widgets and everything in-between. Don't worry, there will be a ton of transparency effects for those interested in cloning the Windows 7 GUI. There will even be some effects, like expo for Compiz Fusion, never before seen on a Windows machine."

    Can't wait for that article, Adam.
    Reply
  • mitch074
    Please note:

    - the article does state that you need a valid XP install media - meaning, that you should have a Windows XP license with it. Say, the one that came with the computer you converted to Linux... Moreover, if you happen to install an 'update' version of Windows, you lose the right to install both the older and newer OS on the machine (check EULA) - so you'd need to spring for a 'full' version of either. Linux has no EULA (only the GPL, which essentially says 'use at will') so you can use the former OEM OS (presumably Win XP - lower-end Vista have EULA limitations) in a VM, IF KEPT ON THAT 'REAL' MACHINE.

    - DirectX acceleration is available in VirtualBox (this is not the case with VirtualPC), but it is experimental. Essentially, it creates an OpenGL context on the host OS (Linux or Windows), a virtual 3D device on the guest OS, provides a DirectX to OpenGL translator and a WGL to XGL passthrough (think Wine) - giving the guest OS accelerated OpenGL and DirectX capabilities. Note that currently, the OpenGL option is considered more stable than DirectX, because like Wine's WGL to XGL passthrough driver, there's (almost) no code translation required. As far as I know, there is no passthrough option available for DirectX (thus Windows on Windows has no advantage over windows on Linux - it's even worse, due to Windows on Linux making use of Linux's much faster I/O capabilities - my test results, not mine).

    - The vbox 'CPU cores' options defines how many cores are emulated on the host; as far as I know, vbox ain't multithreaded yet. Think SMP emulation for the host. You should also enable IO APIC emulation with it, and this may be unstable in WinXP.

    About .tar.gz packages: they can contain both binaries and source code; thing is, in Linux, it's often more practical to ship source code and make the user compile it, but the user has to know which is what. If we take Skype's example, there are two .tar.gz available: the 'dynamic' one will make use of local libraries already installed on your machine (mainly Qt), the 'static' is a complete package that doesn't require any extra install (but is a much bigger download). On Xvid's page though, the .tar.gz package only contains source code; you have to enter the directory that contains the UNIX-like source, and do 'magic':

    ./configure --help ## that parses the 'configure' script and recaps default compilation and install settings. Read it thoroughly. Don't forget the './', required to run the local version; otherwise, Linux will default to 'configure' located in /usr/bin, which is NOT the same.

    ./configure ## that checks for dependencies on the system and prepares the build; if it can't find a compiler or any other required dependency it'll abort: install GCC and whatever library is missing (you may need the -dev or -devel package). If it can't find NASM, an assembly optimizer, it'll revert to slow 'pure C' implementation - and say so. Thus, read ./configure's output. Install optional dependencies for those features you need. You may need to pass options defined in the --help.

    make ## that will actually start the compile job, according to the last ./configure run (some will actually run configure with default settings first; it is also possible that there is no ./configure script). It should take a few minutes depending on how fast your processor is.

    make install ## to be run as root. Will add libraries and binaries in default paths on your system, overwriting existing files. If run as user, will probably fail. You may run into dependency hell if you overwrite existing critical files.

    For actual, package-dependent instructions, read the README files that are found inside the package. Most will sum up the above, others may give different instructions.

    Some packages (mainly daily builds) will actually require tools like 'automake' that parse the current source files, create a ./configure script and run it.
    Reply