Setting Up Seamless Windows Using VirtualBox

From Nearline Storage
Jump to: navigation, search

This setup integrates Microsoft Windows XP into the Fedora KDE desktop seamlessly, with the Windows taskbar and start menu at the bottom of the desktop and Windows application windows running on the KDE desktop. It also works on Xinerama displays, unlike VirtualBox's own internal seamless support. (As of VirtualBox 1.5.6, seamless only works on the first display, it won't cross display boundaries. Support suggests that this may be fixed when VirtualBox v1.6. is available.)

Kudos to mikeytag for pointing the way on Ubuntu Forums.

Setup

This seamless setup is accomplished by:

  1. running Windows headlessly., i.e., in the backgroup, using VirtualBox,
  2. accessing the Windows guest directly using its own Remote Connections (RDP) services,
  3. using the SeamlessRDP tool on the guest to integrate the session within the Linux desktop.

The VirtualBox VRDP service is not used but it still must be enabled to allow the guest to run headlessly and having it available is nice just in case there is a need to access the VirtualBox PC's console.

For information on setting up a VirtualBox VM see the VirtualBox Documentation. These settings should be applied to the VirtualBox VM:

  • Turn on VRDP for this VM.
  • Use the bridged networking setup described in the documentation. This gives the VM it's own IP address and that's required to make this work. If you run your own DHCP server like I do you may want to set it up to give this VM a statically assigned address and configure that address into your name server too.
  • Set the guest for "external" security. This makes it so that you use your Linux userid and password to access the guest system with the rdesktop command.

After you have the VM installed and working, make these additional tweaks:

  • Install the Guest Additions into Windows following the directions in the VirtualBox Documentation
  • Enable Remote Connections in Windows and set a password for your userid:
    • Go to Start -> Control Panel -> System and click the Remote tab.
    • Check the box that says “Allow users to connect remotely to this computer” and click OK. Make sure that your userid is shown as being authorized for remote access. Add it if it isn't.
    • In the Control Panel select “User Accounts”
    • Select your userid and “Create a password”
  • Download the seamlessrdp.zip from the SeamlessRDP home page and unpoack it into C:\SeamlessRDP on your guest
  • Customize some Registry settings on your guest:
    • Set HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\ColorDepth to 4 in order to use 32 bit color
    • Add a new DWORD key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows\ShutdownWarningDialogTimeout and set it to 1 to tell Windows to only display the shutdown warning for 1 microsecond. Otherwise it can block the shutdown of the headless VM from the command line. (See below.)
    • Add a new DWORD key HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre nt Version\Policies\Explorer\NoDesktop and set it to 1 to tell Windows not to display the normal desktop. This way it will just display the taskbar and start menu.
  • Set the Windows Power Options so that the power button starts a shutdown: Start -> Control Panel -> Power Options -> Advanced tab
  • Shutdown your guest

Starting Up

  • Start the guest with the command VBoxVRDP -startvm "<virtual_machine_name>"
    • It takes a while for the guest to start. I use GKrellM on my desktop to display system activity. Watching the CPU activity monitors gives me an idea of when the boot has finished. Wait for it, then ...
  • Start the seamless Windows session with the command rdesktop -rsound -u <userid> -p <password> -A -s "c:\seamlessrdp\seamlessrdpshell.exe C:\Windows\explorer.exe" <ip_address>
    • The <ip_address> used here is the one that got assigned to the Windows guest. The <userid> and <passwords> are the Windows id and password you set up for remote access earlier.

If you ever need to access the full desktop, use the command rdesktop -u <userid> -p <password> <host_ip>. The <host_ip> is the ip address of the Linux box that the VirtualBox VM is running on. The <userid> and <password> are your Linux id and password. Note that Windows does not support mutiple RDP sessions, when you start a new one the old one will terminate. So, if you access the full desktop using this command here, your seamless session will close, and vice versa.

Shutting Down

To shut down the backgrounded Windows VM use the command: VBoxManage controlvm <virtual_machine_name> acpipowerbutton

Xinerama

This seamless configuration works across multi-head Xinerama displays. I do have a quirk in my particular case though. My Xinerama desktop is 5120x1024 but seamless Windows won't go beyond 4096x1024. So about 3/4 of my right-most display can't be used for Windows windows. Oh well, no biggie.