sábado, 29 de agosto de 2009

Popping GNU/Linux out of the Virtual Machine


At work I'm tied to a windows machine, however I have been able to use GNU/Linux which is where I'm most productive.

First, I tried working with Portable Ubuntu. It works pretty well, however the latency can be a little high sometimes (Firefox being the most obvious case that I noticed).

About a week ago I started working on a clustering experiment and wanted to give it a shot inside Portable Ubuntu. However, I discovered it wasn't possible because its kernel doesn't support bridging (I was going to use some qemu virtual machines for the experiment).

Well, It seemed like I was going to need a virtual machine to host the experiment after all. I have used qemu and love it because of all the networking tweaking it allows you to do, however it can be very slow... and inside the virtual machine I was going to host more virtual machines, so I decided to use something else, at least on the hosting virtual machine.

I tried VirtualBox and was gladly surprised by its performance. It was veeeeeeeeeery fast.

Got Kubuntu installed on it. It works acceptably. Now the problem with virtual machines where you have a window that represents the computer's monitor is that you have to use key combinations to get in and out of the virtual machine environments.... plus the windows in the virtual machine are inside a window that looks not integrated to the real environment.

But then a truck hit me. How about finding a way to get the windows out of the virtual machine? How about using an X server on Windows (XMing, for example) and configure the Virtual Machine to use that X server. kdm can be configured to use a remote X server.

If you check /etc/kde4/kdm/kdmrc (remember it's Kubuntu, so I'm using KDE... gdm must have something similar), in the [general] section, there's StaticServer and it's set to :0 (in other words, the X server of the host). I changed that to say (the address of the windows box from VirtualBox):


Then I started XMing (XMing included in Portable Ubuntu, by the way) with -rootless, so that I got no decoration for the X server window, then I restarted the kdm service on the virtual machine and there it is! kdm is displayed on the windows environment. Log in to kde and after a moment of not seen anything on the X server screen I get to see KDE's background, plasma panels and everything else. Cool! The windows are not integrated in windows, but I don't have to get in/out of the Virtual Machine screen anymore.

The only thing I'd have to complain about so far is that sometimes the latency on KDE gets too high and I don't know how to avoid it. I tried with the windows XMing and cygwin's XWing but I got the same latency issue. How can that be avoided?

The picture I'm including is the same thing running off a Kubuntu 9.04 LiveCD on my wife's box (shhhhhhhhhhh, she better not hear about it).

When I log into kde, depending on the resolution of Windows (the real OS of the machine), KDE's splashscreen is seen or not.

10 comentarios:

  1. Try the VirtualBox Guest Additions. It allows you to enter and exit the virtualbox interface without shortcuts, it has integration mode which basically hides the OS desktop and leaves the windows visible on the host (I've tested that with a Windows guest on a linux host only and it works). It has automatic guest resolution resizing to match the window inside which the guest lives...

    Give it a shot.

  2. I'll give them a shot. However the trick will work with other virtualization solutions like qemu just like that.

  3. Is there any benefit to running Firefox in Linux vs. in Windows?

    Also, I think you can get away with not starting KDE, but rather SSH into the virtual machine with X forwarding enabled. That way, you don't get the KDE menus and stuff (and huge resource sink), but you can run applications, and they will be decorated as Windows apps.

  4. How about using a vnc instead of x on xming or simillar?

  5. Guest Additions is the way to go... ;) Using Ctrl-F goes FullScreen and automagically resizes the guest OS display to fit... :P

  6. You could also enable "Remote Display Server" in VirtualBox for Your Guest OS (It's RDP) if You want to be able to login remotely to Your Kubuntu... :)

  7. With all due respect .... but first of all you should use the VirtualBox guest additions. They also help improve the performance and it will allow the virtual X11 server to adapt to your real screen resolution. Second: VirtualBox offers a RDP server for each VM. So if you enable that you could connect to it using your "Remote Desktop" application and taddaaaaa ... full-screen Kubuntu.

    Your bricolage with the remote X11 server is nice ... but it's like reinventing the wheel and the fire, because it's all already there.

    Nontheless I salute your ingenuity. What you posted could be useful in a few other scenarios that come to my mind. But for VirtualBox it's a bit "overkill" ;-)

  8. I know there are other solutions. I didn't say "This is the way to go". It's just a "resource" for everyone who wants to try... plus (as I said in the response to the first comment), it's not VirtualBox centric. It will work with any other virtualization solution that connects somehow to the windows box.

  9. Its so highly informative things are posted in your blog. I was seeking for this type of blog only and also that you have a fresh and interesting content.
    Web Conference

  10. Coming from such a point of expertise, how would you rate software such as turnkey solutions from Proxy Networks? I'm looking for Remote Desktop solution for my small business that handles sensitive data. Need high security.