Other posts in this series:
- Pt. I – Enabling GDM as an XDMCP server
- Pt. II – Four XDMCP client options for Ubuntu 9.10
- Pt. III – Three ways to use the host chooser
- Pt. IV – Alternatives to XDMCP
If you’re affected by this issue, please also take a look at this post:
XDMCP support in Ubuntu: make your voice heard
As promised a couple of days ago, here’s how to enable XDMCP on Ubuntu 9.10, Karmic Koala. Note that none of these instructions are as simple as the point-and-click methods of earlier releases, but they’re not too bad either. I’ve used “gksudo gedit” for people trying to do this in a GUI – if you’ve used CTRL-ALT-F1 to get to a console screen, then replace those with “sudo nano -w” – but if you know enough to have got to a console screen then you could probably have worked that out anyway (and may want to replace nano with the editor of your choice).
Enabling the XDMCP server
With Karmic the GDM config screen has been stripped to the point of excess, as discussed in my previous post. So whereas earlier releases let you enable an XDMCP server with a few mouse clicks, Karmic requires you to edit the GDM configuration file on the disk. There is a slight problem in that the GDM configuration file doesn’t actually exist, but there is a copy hanging around in the GDM documentation on your machine, so we can use that as a starting point:
- Open a terminal (Applications=>Accessories=>Terminal), or switch to a virtual console if you prefer
- Copy /usr/share/doc/gdm/examples/custom.conf to /etc/gdm/ – the command line below will do the job for you:
gksudo cp /usr/share/doc/gdm/examples/custom.conf /etc/gdm/
- Open the file for editing:
gksudo gedit /etc/gdm/custom.conf
- Add the line “Enable=true” after the “[xdmcp]” line (to enable the XDMCP server)
- Also add “DisplaysPerHost=2” on the line after that (avoids a problem with the server locking you out – see the comments for more details)
- Save the file. It should look something like this:
# GDM configuration storage [xdmcp] Enable=true DisplaysPerHost=2 [chooser] [security] [debug]
- Restart GDM with the following command (note that this will kill your current X session, so please make sure you’ve saved anything important first):
gksudo restart gdm
[EDIT: Updated the above to include DisplaysPerHost=2 as described in the comments below]
And that’s it, XDMCP enabled. The usual caveats apply – XDMCP is an inherently insecure protocol, please do not enable it on an internet-facing machine or the laptop you take to the coffee shop. The chances are that if you’ve come here looking for XDMCP information then you already know enough about it to determine whether it’s safe for you, but it never hurts to have a reminder.
If you want to disable XDMCP then edit the file to read “Enable=false” and restart GDM (or your whole machine).
If you just want to enable Karmic for use with my article about Rootless Linux on a Windows Machine, that could well be all you need to do.
There are other settings that you can add to the [xdmcp] section, but this should be enough to get you started.
In particular the MaxSessions option may be useful if you need multiple XDMCP users connected at once, or as a workaround if you find that stale connections are preventing you from getting a login screen. [Edit: It appears to be DisplaysPerHost=2 that is the workaround for this problem]
One of my favourite uses for XDMCP on Jaunty was with Ubuntu Netbook Remix. You could switch from the netbook launcher screen to the full desktop mode, connect it to the network, enable XDMCP, then easily log in from your Ubuntu desktop machine to use the netbook with a full-sized keyboard and screen. With Karmic they’ve screwed up this approach in just about every way possible:
- You can’t easily enable XDMCP on the Netbook via the GUI (so you have to use the steps above)
- You can’t switch between the netbook launcher and full desktop, which leaves you with a netbook UI on a screen which is more suited to a full desktop
- The netbook launcher is a lovely translucent thing, which uses compositing to give it its bling. That means it doesn’t display anything via a normal XDMCP connection*, making it a bit more tricky to launch applications
(*It works, albeit slowly, if you use Xephyr – which is something I”ve covered in the next thrilling instalment)
There are a few workarounds which will at least let you launch other applications. You can launch them by pressing ALT-F2 to open the “Run Application” dialogue. You can add launchers for your most commonly used applications to the Gnome panel. Or you can add a “Main Menu” applet to the panel. The latter is the most obvious and user-friendly solution, but the obvious and user-friendly place to put it (in the top left) already features a near-identical looking icon for the UNR go-to-the-launcher functionality. So yes you can have a full menu to launch apps from, but prepare to get confused if you also want the UNR functionality.
I suggest that moving the UNR icon to the right of the panel, just before the system tray icons, makes most sense. That way you have a full menu at the top left, and the go-home functionality to the right of the window title.
Connecting to an XDMCP server
As my previous post mentioned, the option to make an XDMCP connection has been removed from GDM – and therefore from the Karmic login screen. From the Gnome GDM documentation:
GDM 2.20 and earlier supported the ability to manage multiple displays with separate graphics cards, such as used in terminal server environments, login in a window via a program like Xnest or Xephyr, the gdmsetup program, XML-based greeter themes, and the ability to run the XDMCP chooser from the login screen. These features were not added back during the 2.22 rewrite.
It’s that last feature – the ability to run the XDMCP chooser from the login screen – which is the omission I’m dealing with here. The wording of the text above is a bit ambiguous in that it’s not clear whether it means “these features were not added, but will be at some point”, or whether it means “these features were not added and never will be”. I hope it’s the former.
The text above mentions Xnest and Xephyr, which are both X-servers that are also X-clients and allow you to do fancy things like run an XDMCP connection to another machine in a window on your normal desktop. In fact one of the most common comments I’ve seen about the removal of the XDMCP Chooser option from GDM was that you can “just” install Xnest and use the terminal services client if you need to connect via XDMCP. Although this will work in many cases it’s not equivalent to having it built into the login screen for several reasons:
- It assumes you actually do have the ability to log in to the local machine, which may not be the case
- It doesn’t run an XDMCP chooser, so you need to know the IP of the machine you’re connecting to
- It requires the installation of Xnest, so won’t work from a Live CD with no internet connection
- At least on the virtual machine I’m currently running Karmic on, the Terminal Services Gnome Applet dies every time I try to add it to the panel
So here’s a workaround for use with a Live CD, and which doesn’t require you to have an internet connection. It doesn’t use the XDMCP Chooser, however, so you will either need to know the IP of the machine you’re connecting to (if you use the -query option), or only have one XDMCP server on your network (if you use the -broadcast option):
- From within the Live desktop environment open a terminal (Applications=>Accessories=>Terminal)
- Enter the following command if you only have one XDMCP server on your network:
sudo xinit -- :2 -broadcast
- Alternatively if you wish to specify the IP of the machine you’re connecting to, use the -query option like this (replacing 123.456.789.0 with the IP of the server):
sudo xinit -- :2 -query 123.456.789.0
This will start a second X server and should give you a login screen for the XDMCP host. Because you now have two X servers running, you can switch between them if you want to – the default will be on CTRL-ALT-F7 and the XDMCP desktop will be on some higher number (CTRL-ALT-F8 seems like it should be the most likely candidate, but mine was on CTRL-ALT-F9 when I tried it).
This should be sufficient for many of the use-cases of XDMCP on a live CD. For full installations, or when you want to run your XDMCP connection in a window, you might find Xnest or Xephyr to be more useful, so I’ll discuss those next time.
Finally, a plug
Based on the stats I see for other XDMCP-related posts on this site, I suspect that this page will rapidly become one of my most popular. It would be remiss of me not to take that as an opportunity to plug “The Greys”, the humourous, sci-fi based webcomic that I’m involved in. If that sounds like the sort of thing that might interest you, please take a look.