Ubuntu Forums ubuntu.com - launchpad.net - ubuntu help  

Go Back   Ubuntu Forums > The Ubuntu Forum Community > Forum Archive > Main Support Categories > Desktop Effects & Customization
Register Reset Password Forum Help Forum Council Search Today's Posts Mark Forums Read

Hello, Unregistered You are browsing a READ only archive of the main support categories pre 4/21/2008. You will not be able to post or reply any threads in this section.

Desktop Effects & Customization
This section is for all your compositing needs. This includes Beryl, Compiz, xcompmgr, and other fancy apps which take advantage of compositing managers such as kiba-dock and avant window decorator

 
Thread Tools Display Modes
Old May 4th, 2007   #1
mikeytag
5 Cups of Ubuntu
 
mikeytag's Avatar
 
Join Date: Feb 2006
Beans: 31
Ubuntu 9.04 Jaunty Jackalope
Talking HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

Alright, I have finally done it. I have integrated Windows XP Professional into my Ubuntu desktop using VirtualBox. Words cannot begin to describe how incredibly sweet and productive this kind of setup is. Imagine being logged into your Ubuntu desktop and whenever you want to run a Windows app you simply click on the Windows Start Menu at the bottom of your screen and run it. Well that's what this guide will walk you through setting up. Take a look at this screen shot to get an idea for what I am talking about:



Imagine if you are a developer that needs to run Visual Studio repeatedly. Or maybe you are a web developer like me that goes into Flex and Flash occasionally. (Both are products from Adobe with no Linux port, you will see from the screenshot that I am running Photoshop 9 CS2 like this) Needless to say, having this setup would help you save a lot of time, if not solely for the purpose of impressing your friends. Oh, and to top it all off, it runs under Beryl just fine. Almost all the effects in Beryl affect the other windows. (See bottom of guide to find out which effects won't work)

There are some limitations, like full 3D support for games and such, but for the most part it runs all Windows programs flawlessly. Also, as a side note I was able to get this whole configuration working using Edgy. There are a few issues that could pose problems in Feisty, mainly Network Manager messing with the config. I will post another tutorial for Feisty when I get the chance to upgrade my desktop.

Step 1: Install and Configure VirtualBox
VirtualBox is one of the best virtualization apps I have ever seen. I put it right up there against VMWare Workstation, and it tends to perform better in my opinion.
In Edgy, you can download and install VirtualBox by either using Automatix (http://www.getautomatix.com) or by installing the .deb from http://www.virtualbox.org
I personally installed it through Automatix and find that the easiest route as it makes sure you have everything else you need for it. You can find VirtualBox under the Virtualization section of Automatix.

Ok, once you have VirtualBox installed we are going to make a new virtual machine.
Step 1a: Setting Up a Virtual Machine
  • Open up the VirtualBox app by selecting it from Applications->System Tools->InnoTek VirtualBox.
  • Click the “New” button at the top to bring up the New Virtual Machine Wizard.
  • Click Next
  • Type in a name for your Windows installation. I labeled mine: Windows XP Professional, but you can name yours whatever you feel like.
  • Choose your Os Type from the dropdown. (Important note: this seamless setup will only work with a version of Windows that can act as a Terminal Server that means XP Pro NOT Home, and Vista Business or Ultimate, Windows Server 2003, and/or Windows 2000 Professional)
  • Next adjust your base memory size. VirtualBox recommends 192MB for Windows XP, but I personally find that XP runs a bit slow at this level. I have 2GB of RAM on my machine so I gave XP 600 MB. Choose whatever amount you are comfortable with, and this can always be adjusted later.
  • Next we will choose our “hard disk” to boot into. Click the “New” button unless you already have a VirtualBox image ready, then click the “Existing” button.
  • After clicking New, you will be greeted by the Virtual Disk Wizard, click Next
  • Choose whether or not you want a Dynamically expanding image. I personally like using it because I am not entirely sure how much space I will use, but that it is up to you. After choosing, click Next.
  • Pick a name for your image file and adjust the size to the amount of space you would like to offer for your drive. Then click Next.
  • To finish the new drive creation click Finish
  • Your new disk you just created should be selected, click Next.
  • Click Finish to complete setting up your new Virtual Machine

Step 1b: Configuring Your Virtual Machine
  • Select your new machine from the list of machines on the left and click the Settings button at the top of VirtualBox.
  • Select CD/DVD-ROM and click Mount CD/DVD Drive, then choose whether or not you would like to mount your physical CD drive or an iso file. ( I personally ripped my XP Install CD to an ISO file because I think the install goes faster than off the physical CD)
  • Now, select Network and from the “Attached to” dropdown box select Host Interface. In the Interface Name field type in: tap0
  • (This will make more sense later)
  • Now, select Remote Display and check Enable VRDP Server.
  • Finally, click the OK button to save all of these settings.

Ok, we now have our VirtualBox Machine ready to boot up and install windows, however we are going to configure a few things on the Ubuntu side first.

Step 2: Setup Ubuntu Networking
Before I go down this road with you there are a few things I need to make known. First, I have only tested this setup on a desktop with a physical, wired network connection. It may work wirelessly, but I have not tested it. Also if you make use of Network Manager, you will need to make sure it doesn't run anymore. You can do that easily, without uninstalling it, by simply creating two files with the word: exit as the only thing in them. Use your favorite editor, mine is pico, and create these files like this:
(Quick pico reference: to exit a file and choose whether or not to save it use: Ctrl+x)

Code:
sudo pico /etc/default/NetworkManager
sudo pico /etc/default/NetworkManagerDispatcher
If you had to add those two files then you can reboot to see that Network Manager will not start up anymore. To turn it back on simply remove those files. If you are sitting there and are thinking “But I HAVE to use Network Manager, my <insert wireless card here> is only supported by it!” Then my friend, I apologize but you may be SOL. Start digging through the forums to see if there is an alternative way to run your connection. My guess is there probably is.

Ok, now that that's out of the way let's move on.
  • We first need to install some important packages:
    Code:
    sudo apt-get install bridge-utils uml-utilities
  • Next we are going to setup our /etc/rc.local file.
    Code:
    sudo pico /etc/rc.local
    Append the following information directly above the line that says “exit 0”

    Code:
    tunctl -t tap0 -u <username>
     chmod 0666 /dev/net/tun
     /usr/sbin/brctl addbr br0
     /sbin/ifconfig eth0 0.0.0.0 promisc
     /usr/sbin/brctl addif br0 eth0
     /sbin/dhclient br0
     /usr/sbin/brctl addif br0 tap0
     ifconfig tap0 <vbox_ip> up
     bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp'
     route add -host <main_ip> dev tap0
     arp -Ds <main_ip> eth0 pub
    Ok, there are some EXTREMELY important things to note here.

    First off replace <username> with the username you use to login to your Ubuntu desktop. (Mine is michael).

    Next, you need to replace <vbox_ip> with an IP that is within your subnet. It doesn't matter what it is, I use 192.168.1.161 simply because it was open. The only requirement is that there isn't another device on your network with this IP. This IP will come in handy when your Windows install is not accessible over the network. Confusing I know, but it will make more sense later.

    Next, you need to replace <main_ip> with the IP of your Ubuntu installation on your network. If you use DHCP be careful. I do, but I setup my router to always give me the IP of 192.168.1.160. Static or DHCP, you need to put your IP here.

    Lastly, take a look at all the places where I have eth0. For many installations this will probably be your main network device, but it could be something else like ath0,eth1,etc. Make sure you change eth0 to whatever your primary network interface is. (The device that you access the network with)
  • Ok, if you feel up to it you can parse out all the lines we just put in the /etc/rc.local file and run them one by one. Or you can easily activate these settings by simply rebooting.

Step 3: Configure your Windows Virtual Machine
Ok, now we are going to boot up our Windows Virtual Machine. Go ahead and boot up your VM by opening up Applications->System Tools->InnoTek VirtualBox and then selecting your virtual machine and clicking the “Start” button.

I am not going to walk you through installing Windows, because it is mind numbingly boring and I am betting, that if you are reading this guide, chances are you have wasted many hours of your life reinstalling Windows. When you are done installing it come back to this guide to continue.

Welcome back! I hope you had a fun time. Now there are several Windows settings we will need to do. (Note: These settings worked for me in Windows XP Pro, if you are using another edition of Windows they may be the same, i.e. registry keys and such, or not. However I can personally confirm that they work flawlessly in Windows XP Pro.)
  • First thing you have to do in Windows is enable Remote Connections and set a password for your user.
  • Go to Start -> Control Panel -> Sytem and click the Remote tab.
  • Check the box that says “Allow users to connect remotely to this computer” and click OK
  • In the Control Panel click “User Accounts”
  • Click the user that you would like to login as and then click “Create a password”
  • Type your password in the boxes provided and then click the “Create Password” button.

If you are thinking to yourself, “Well. it would just be easier to not have a password.” Stop right there and set one anyway. It is not an issue of security. If you don't setup a password then you will not be able to login to your Windows VM seamlessly.

Now we are going to adjust a couple registry keys that drove me up the wall. By default XP Pro comes configured to only allow remote access at 16 bit color. Well, frankly this looks like butt on your desktop especially when you have a slick Beryl interface. So we are going to change that.
  • Go to Start and select Run, in the box type regedit and hit OK
  • In the registry editor navigate to the following key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Terminal Server\WinStations\RDP-Tcp
  • In the right hand pane, highlight the ColorDepth key and right-click. Select Modify and change the “Value Data” field to 4

Next, we need to set it up so that your Windows install only displays the Task bar and not the desktop on login.
  • In the registry editor navigate to the following key: HKEY_CURRENT_USER\Software\Microsoft\Windows\Curre nt Version\Policies\Explorer
  • Create a new DWORD value that you'll call NoDesktop and set its value to 1

Now, we need to set our Windows install up so that it logs in your specified user in automatically.
  • Go to Start -> Run. type control userpasswords2 into the box and click OK
  • Uncheck “Users must enter a user name and password to use this computer” and click Apply
  • A box will come up asking what user name and password you would like to have logged in automatically. Fill this out with whatever user/pass info you have setup.

Now we need to install VirtualBox's Guest Additions for seamless mouse movements (thanks merovius for pointing this out)
  • Click the VM dropdown list at the top of your Virtual Machine window
  • Click Install Guest Additions
  • Follow the onscreen installer to install the additions

Our last step is to read the network IP that Windows is using
  • Go to Start -> Control Panel -> Network Connections
  • Right click Local Area Connection and click Status
  • Click the Support tab and record the IP Address, it will become important later

Note: This IP address has to be DIFFERENT than the Virtual Box IP that you put in the /etc/rc.local file. If it is not different then configure windows to use a different IP or configure your router to give your Windows install a different IP.
  • Finally, go to Start and shut down your Windows installation. Not Reboot, Shut Down.

Step 4: Configure your VirtualBox install to run headless and automatically
VirtualBox has this awesome feature where you can run your Virtual Machines headless. Meaning you can start and stop them from the command line and they simply run in the background. Remember when I had you check the box to Enable VRDP? Well, that's what that does. It enables your virtual machine to run headless.
  • First we are going to run your machine from the command line, so in a terminal window type this:
    Code:
    VBoxManage startvm "Windows XP Professional" -type vrdp
    Replace “Windows XP Professional” with the name of your virtual machine if it's different.
  • Now we are going to setup Ubuntu to start our Windows installation automatically for us upon login.
  • Go to System->Preferences->Sessions and click the Startup Programs tab
  • Click the Add button and type the command above into the text field and click OK

Step 5: Integrate into your Ubuntu panel
Ok, the next step is to run your whole Windows seamless setup. First run the following commands from a terminal window to make sure they work, and then I recommend making a Custom Application Launcher in your Ubuntu Panel. I use this icon if you are looking for a nice one:

(I will assume that most readers know how to do this, right click your top panel and you are on your way )

First we need to make sure that our bottom panel is hideable, so that we can get to our start bar if we want to. You will notice from my screenshot that I have a dual monitor setup and the Windows bar is across the entire bottom of my screen. That is because I moved my bottom panel up to the top of my right monitor so it is out of the way. However, if you don't want to do that, or you only have one monitor then do this:
  • Right click a blank area in your bottom panel and click Properties
  • Check the box that says “Show hide buttons” and click OK
  • You will now have a left arrow button on the left and a right arrow button on the right of your panel that will allow you to hide your bottom panel by clicking one of them
  • Next, let's make sure you have rdesktop installed, it should be by default I think:
    Code:
    sudo apt-get install rdesktop

Now, let's run our Windows install seamlessly for the first time!
  • Open a terminal window and type this:
    Code:
    rdesktop -rsound -A -s "c:\seamlessrdp\seamlessrdpshell.exe C:\Windows\explorer.exe" <IP recorded from Windows>:3389 -u "<Your Windows Username>" -p <Your Windows Password>
    Replace <IP recorded from Windows> with the IP you recorded from Windows earlier. (Gosh, did I even need to type that). Also replace <Your Windows Username> and <Your Windows Password> with your Windows username and Windows password respectively.
  • You should have seamless.......OH CRAP the whole desktop is viewable and you are not seamlessly integrated. That is because your Windows install has to be logged off first before seamless ability will work. You may be thinking, “Michael, you are an idiot. You told me to make my Windows install login automatically!” Hold your horses. If you didn't do that then you wouldn't get anything to show up at all. For reasons unbeknownst to me, Windows XP will not listen for Remote Connections until you have actually logged in once.
  • Simply hold down your alt key and click anywhere on the Windows desktop and move it up so that you can see the Start button.
  • Click the Start button and choose Log off.
  • Ok, run that command one more time and hope that you followed all the instructions correctly.

Woohoo! You should have seen the desktop flash and you will be presented with a lovely blue Windows taskbar at the bottom of your screen. If your bottom panel is in the way, then just click one of the hide arrows to see your new Windows taskbar.

That's it! Easy huh. Well, it's not too difficult it is just time consuming to setup and get running. Good news is that now you can run it at will by clicking your panel launcher or running the rdesktop command again. Only downside, is that the first time you run it you will have to Log Off once before seamlessness will be in effect. Maybe someone can whip up a VB app that will log out the Windows user only on first login so this is done automatically.

Have fun enjoying your new setup.

P.S. Here are some important things to know about your new setup
  1. If for any reason you cannot get the rdesktop command to actually do anything you can login to your Windows VM by doing this:
    rdesktop -rsound -A -s “c:\seamlessrdp\seamlessrdpshell.exe c:\windows\explorer.exe” <your vbox_ip from /etc/rc.local>:3389 -u <Your Windows Username> -p <Your Windows Password>
  2. You will notice that many apps run quickly and without much lag at all. This is a testament to how great VirtualBox is at virtualizing. However, occasionally I see slow redraw rates. This is probably due to the fact that we are accessing our virtualized Windows machine over RDP.
  3. VirtualBox claims 3D support, but it is not full. Don't expect to run any graphically intense games on this setup. You can surely try, but it will probably be laggy.
  4. As far as Beryl effects go, almost all of them will work with your Windows windows. However, if you drag a Windows app with the Windows titlebar, it won't be wobbly. This is because when you do this, rdesktop is moving the window not your window manager, i.e. Beryl. However, if you hold down alt and move the window it will be wobbly. Maybe they could add Beryl support in a future release of rdesktop to make them wobbly all the time .

Last edited by mikeytag; May 5th, 2007 at 03:21 PM..
mikeytag is offline   Reply With Quote
Old May 5th, 2007   #2
Xala
First Cup of Ubuntu
 
Join Date: May 2007
Beans: 1
Re: HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

Would this tutorial work with Feisty? i would hope so because this setup would solve all my problems.

Edit, i just re-read your post again, i noticed that you are going to repost this when you have got it working for Feisty.

Last edited by Xala; May 5th, 2007 at 05:46 AM..
Xala is offline   Reply With Quote
Old May 5th, 2007   #3
rolf-c
A Carafe of Ubuntu
 
Join Date: Apr 2007
Location: Skydome
Beans: 112
Ubuntu 7.10 Gutsy Gibbon
Re: HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

Amen to what Xala said. I've bookmarked this thread!

If I can move my work-required Windows apps to my Feisty box...hubba.
rolf-c is offline   Reply With Quote
Old May 5th, 2007   #4
starfry
Gee! These Aren't Roasted!
 
Join Date: Apr 2007
Beans: 169
I have just tried this on Feisty and the problem I have is that the mouse position is not syncd between the Upuntu mouse and the Windows one, hence you see two pointers and this prevents it from working for me. I am searching for a solution and will post here if I find one.
starfry is offline   Reply With Quote
Old May 5th, 2007   #5
Merovius
Way Too Much Ubuntu
 
Merovius's Avatar
 
Join Date: Mar 2007
Beans: 226
Re: HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

I believe you need to install "guest additions" to Virtualbox. My mouse moves seamlessly across both desktops.
Merovius is offline   Reply With Quote
Old May 5th, 2007   #6
mikeytag
5 Cups of Ubuntu
 
mikeytag's Avatar
 
Join Date: Feb 2006
Beans: 31
Ubuntu 9.04 Jaunty Jackalope
Re: HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

Quote:
Originally Posted by starfry View Post
I have just tried this on Feisty and the problem I have is that the mouse position is not syncd between the Upuntu mouse and the Windows one, hence you see two pointers and this prevents it from working for me. I am searching for a solution and will post here if I find one.
Like merovius said, I would recommend installing the VirtualBox Guest Additions. Boot up your Virtual Machine via the app and click the VM dropdown and then click "Install Guest Additions". This may solve your problems.

Hey if any of you guys get it running great in Feisty, let me know what differences there were from this tutorial and we can post another one for Feisty users.
mikeytag is offline   Reply With Quote
Old May 5th, 2007   #7
starfry
Gee! These Aren't Roasted!
 
Join Date: Apr 2007
Beans: 169
Re: HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

I've just installed the guest additions.
When I fire up the rdesktop session, I get a big blue screen and I can use ALT to move the screen to see the START menu. The windows cursor is the pointer/hourglass combination one and the mouse does move it around. However clicking it does nothing. I can't click on "start" to log it off as per the instructions.

merovius - when you say yours works, is that all under Feisty?

note: when I said about mouse problems I meant when in "rdesktop" not when running the virtualbox in the foreground - the mouse works in that and alwasy has, it's just in rdesktop that it is a problem. I use rdesktop for other remote machines and it is fine.
starfry is offline   Reply With Quote
Old May 5th, 2007   #8
rolf-c
A Carafe of Ubuntu
 
Join Date: Apr 2007
Location: Skydome
Beans: 112
Ubuntu 7.10 Gutsy Gibbon
Re: HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

I'll add there is a Feisty deb at http://www.virtualbox.org/download/1.3.8/

Code:
Index of /download/1.3.8

Name                                        Last modified      Size                                                  -   
vbox-kernel-module-src-1.3.8.tar.bz2        14-Mar-2007 09:05  115K  
VBoxGuestAdditions_1.3.8.iso                14-Mar-2007 09:03  2.2M  
VirtualBox-1.3.8_mdv2007.1-1.i586.rpm.run   14-Mar-2007 08:36   10M  
VirtualBox-1.3.8_openSUSE102-2.i586.rpm.run 14-Mar-2007 13:42   10M  
VirtualBox-1.3.8_rhel4-1.i586.rpm.run       14-Mar-2007 08:37   12M  
VirtualBox-OSE-1.3.8.tar.bz2                14-Mar-2007 08:39   17M  
VirtualBox_1.3.8_Debian_etch_i386.deb       14-Mar-2007 11:03   10M  
VirtualBox_1.3.8_Debian_sarge_i386.deb      14-Mar-2007 08:36   10M  
VirtualBox_1.3.8_Linux_x86.run              14-Mar-2007 08:49   12M  
VirtualBox_1.3.8_Ubuntu_dapper_i386.deb     14-Mar-2007 08:37   10M  
VirtualBox_1.3.8_Ubuntu_edgy_i386.deb       14-Mar-2007 08:38   10M  
VirtualBox_1.3.8_Ubuntu_feisty_i386.deb     22-Apr-2007 20:50   11M  
VirtualBox_1.3.8_Win_x86.msi                14-Mar-2007 08:52   13M
rolf-c is offline   Reply With Quote
Old May 5th, 2007   #9
Jose Catre-Vandis
Chocolate Ubuntu Mocha Blend
 
Jose Catre-Vandis's Avatar
 
Join Date: Mar 2006
Location: Hampshire,UK
Beans: 1,783
Xubuntu 9.04 Jaunty Jackalope
Re: HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

Excellent stuff! Weird to have this integration and the speed compared to VMware!

I am on Edgy!

Some questions/suggestions....

Is it possible to "gracefully" shut down the windows session? I see you can:
Code:
 VBoxManage controlvm "Windows-XP-Pro" poweroff
but is this graceful enough to stop XP complaining about a crappy shutdown?
~~~~~~~~~~~~~
I too needed the VBox Guest Extensions to get the mouse working properly
~~~~~~~~~~~~~
I proabably don't need to do this as I rarely venture into XP using VMware, but can anyone suggest a script that will handle both commands; a) start the headless session and b) start the desktop, once the session has loaded. I don't need to load up the headless session on boot, partly because of use, partly because of overhead.
~~~~~~~~~~~~~
All my filesystem mounts seem to have disappeared, and
Code:
sudo mount -a
doesn't bring them up. This is partitions on the same drive and NFS shares I have on a server (different machine). I can access the partitions on my HDD if I dive down into /media but not the NFS shares? I'll do some testing around this and report back.
~~~~~~~~~~~~~
and it is taking my desktop an extra 1 minute 45 seconds to be ready for business, and opening up anything nautilus / terminal / whatever takes between 20 seconds and a minute to come up on screen
~~~~~~~~~~~~~

Removing:
Code:
tunctl -t tap0 -u <username>
 chmod 0666 /dev/net/tun
 /usr/sbin/brctl addbr br0
 /sbin/ifconfig eth0 0.0.0.0 promisc
 /usr/sbin/brctl addif br0 eth0
 /sbin/dhclient br0
 /usr/sbin/brctl addif br0 tap0
 ifconfig tap0 <vbox_ip> up
 bash -c 'echo 1 > /proc/sys/net/ipv4/conf/tap0/proxy_arp'
 route add -host <main_ip> dev tap0
 arp -Ds <main_ip> eth0 pub
from rc.local solved the above two problems, so it looks like this integration solution is not for my system
~~~~~~~~~~~~~~
I can't live without my ubuntu panel being at the bottom of the screen, in view. I tried moving the XP start menu to the top of the screen, ( by running a normal Vbox session of XP) but this sits on top of any windows I have open.
~~~~~~~~~~~~~

Other than that...fantastic work, well done mikeytag!
__________________
Experience is the only genuine knowledge
Karmic kernel for my dvb card (Asustek Dual P7131) now fixed thanks to Vink's custom kernel from Alexey's patch
Bimmablog

Last edited by Jose Catre-Vandis; May 5th, 2007 at 08:45 PM..
Jose Catre-Vandis is offline   Reply With Quote
Old May 5th, 2007   #10
woodgdo1
5 Cups of Ubuntu
 
Join Date: Dec 2006
Location: Minnesota
Beans: 19
Ubuntu 8.04 Hardy Heron
Send a message via MSN to woodgdo1 Send a message via Yahoo to woodgdo1
Re: HOWTO: Seamless MS Windows in Edgy with VirtualBox and Beryl!

Pretty cool idea. I think I will give it a shot with my vmware install to see if that works.
woodgdo1 is offline   Reply With Quote

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:00 PM.


vBulletin ©2000 - 2010, Jelsoft Enterprises Ltd. Ubuntu Logo, Ubuntu and Canonical © Canonical Ltd. Tango Icons © Tango Desktop Project. lingonberry