Using your Ubuntu system from Windows

The Ubuntu distribution is perhaps the most usable desktop Linux distribution available. However, many of us still need to use Microsoft Windows as our primary desktop. Unlike Macintosh OS X and Linux, it is not easy to port X applications to Windows so a lot of great applications are simply not available to us.

What if you could have the best of both worlds? Imagine sitting in front of one keyboard, one mouse, and one monitor that has access to Windows and Linux apps at the same time and even shares clipboard functionality.

Xming provides a much simpler alternative to Cygwin with X. It does not allow you to have windows and unix apps seamlessly side-by-side, but it does allows you to launch an entire remote X session without the complexity of installing Cygwin.

Also see FreeNX for a perhaps better solution.

This HOWTO will help you achieve that.

Requirements

Security notice

You will be enabling XDMCP which is inherently insecure. It is beyond the scope of this document to discuss the security implications. However, most home users behind an external firewall without an open wireless access point should be fine.

Configuring Ubuntu to allow XDMCP connections

Your Ubuntu system manages its graphical display by way of the [X Protocol]. We begin by enabling a featured called X Display Manager Control Protocol. XDMCP enables other XDMCP aware systems to log in remotely.

Login to your Ubuntu system normally and launch "Login Screen Setup" under the "System -> Administration" menu. Under the XDMCP tab check the "Enable XDMCP" box.

Setting up Cygwin with X server

Follow the directions at http://x.cygwin.com/docs/ug/setup-cygwin-x-installing.html to install an X server on your Windows system.

When you reach step 16, the step where you select the packages to install, I recommend you also install these additional packages.

  • Net
    • openssh: The OpenSSH server and client programs
  • X11
    • xorg-x11-f100: Cygwin/X 100 dpi fonts
    • xorg-x11-fscl: Cygwin/X scalable fonts

Creating X template script for Cygwin

Unlike most Windows applications Cygwin needs a lot of customization to get it to work. The Cygwin software collection seems to be heavily directed towards Unix administrators, software developers, and other heavy command line users. Fear not, if you can edit a Windows batch file (*.BAT) you should find things quite easy to set up with this HOWTO.

You'll be creating a number of *.BAT files and shortcuts on your Windows system. To keep things easy for now create a folder on your desktop called WORK and work in there for now. I'll simply refer to this as the work folder.

To begin we need to create a template for the X environment. A template makes it much easier later if you want to experiment with various ways to run X on your Windows system. Locate the file C:\cygwin\usr\X11R6\bin\startxdmcp.bat and copy it to your work folder. Rename it to xtemplate.bat and open it in your favorite text editor.

At the very beginning of the file find where it sets the DISPLAY and REMOTE_HOST environment variable. We won't be using these so place a REM in front of each like so:

REM SET DISPLAY=127.0.0.1:0.0
REM SET REMOTE_HOST=10.0.0.1

Near the end of the file there are several examples of how to launch XWin.exe. They should all be REMarked out except the first one. We don't want that one either, so place a REM in front of it.

REM run XWin -query %REMOTE_HOST% -nodecoration -lesspointer

Save this template. I'll be referring to it as xtemplate.bat in the following sections.

Single monitor configuration

If you have a single monitor on your Windows system things are very easy. Begin by copying xtemplate.bat to a new file called singlemon.bat and opening it up for editing. Add this command to the very end of the file:

run XWin :1 -once -clipboard -rootless -nodecoration -notrayicon -dpi 100 -broadcast

Here's what the parameters do:

:1

Use display :1 instead of the default :0. Each instance of XWin.exe must be on a unique display. I always leave :0 for -multiwindow use, which I'll explain later.

-once
Only run the Xserver once. Otherwise it keeps resetting after you log out.
-clipboard
Share the clipboard between Windows and Ubuntu.
-rootless
This makes the root window transparent. It will let you see your Windows windows and Ubuntu windows at the same time.
-nodecoration
Don't put up a windows border, buttons, etc.
-notrayicon
We'll always see a tab in the Windows taskbar so don't make a tray icon.
-dpi 100
Change this to match your monitor's DPI. It sizes the gdm login screen properly. Optional since after you login this is handled by Gnome.
-broadcast
Broadcast over the network for an XDMCP session.

Go ahead and run the singlemon.bat script. You should be able to log in to Ubuntu if you got it all correct. You now have full access to your Gnome desktop from your Windows machine. Cool, huh?

Tweaking Ubuntu

Now that you have the basics working it's time to make a few tweaks. You've probably noticed that Ubuntu is taking over your whole screen. Since we specified -rootless on the XWin.exe command line we have the potential to see through the Ubuntu desktop to your Windows desktop. In order for this to be useful we need to tell Nautilus to stop drawing the desktop.

On your Ubuntu system, launch the "Configuration Editor" under "Main Menu -> System Tools". Clear the checkbok found at /apps/nautilus/preferences/show_desktop. This doesn't always take effect right away so you may need to log out. Once you come back you should find that your Windows windows and Ubuntu windows can be visible at the same time.

You should take this opportunity to set up your fonts as well. Launch "Fonts" under "System -> Preferences". Hit the details button to set the DPI and choose the font rendering you like best.

You may wish to hear audio from your Ubuntu system. Normally, EsounD just tunnels over the network but this isn't easy to do with Windows. I recommend using a cable to connect your Ubuntu's line-out port to your Windows line-in port. You could also just hook up another set of speakers. To keep EsounD from tunneling over the network execute the following command and logout:

echo export ESPEAKER=localhost >> ~/.gnomerc

TODO: Create a .gnomerc script to detect remote logins and configure Nautilus and EsounD automatically. If anyone makes such a beast please add it to this wiki.

Known Problems and Limitations

If Totem won't start you need to change multimedia devices. The default configuration assumes local hardware acceleration is available. Open the "Multimedia Systems Selector" in "System -> Preferences" and change the video sink to "XWindows (No Xv)".

Large videos and GL apps may not run smoothly. Moving graphics over a network is a very demanding task. Hardware manufacturers have had to create special busses such as AGP to deal with these bandwidth requirements. If you need to watch large videos you probably have to do so under Windows. If you find yourself wanting to do very intense graphical tasks under Ubuntu perhaps it's time to make the leap and retire your Windows system.

There's a known conflict with gdm and clipboard sharing. Hopefully someone fixes this soon. In the meantime you can apply this workaround to gdm. Edit /etc/X11/gdm/gdm.conf and make sure the following is in there:

KillInitClients=false

From SamiHaahtinen Tue Apr 12 18:33:19 +0100 2005 From: Sami Haahtinen Date: Tue, 12 Apr 2005 18:33:19 +0100 Subject: An alternative Message-ID: <20050412183319+0100@https://www.ubuntulinux.org>

You can also run a windowed session in windows. (this was my preferred way of separating work and play from each other)

To do this, you need to install xnest and openssh-server packages to your ubuntu machine (sudo apt-get install xnest openssh-server) and putty (or some other ssh client, if you prefer something else) to your windows machine.

Now, this is what you do:

  • log in to your windows machine
  • Start Cygwin X server normally (if you installed the icon package, you should have x startup in your start menu) you should see the "X" in your systray.
  • start putty, enter host info and head down to connection settings. you should find X forwarding under one of the settings, turn it on (i've been playing with the devel version of putty for a while so don't know the name of the setting anymore) and connect to the remote host
  • Enter your username and password when prompted
  • type in: gdmflexiserver -n
  • Log in to your ubuntu session.
  • have fun!


CategoryArchive CategoryDocumentation

HowToCygwinX (last edited 2011-04-09 01:05:17 by D9784B24)