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
Older versions of Ubuntu – or more specifically, older versions of GDM – had an option to remotely log into another server using XDMCP right from the main login screen. Selecting that option brought up a host chooser which scoured your local network for any XDMCP serving hosts, and then presented you with a list from which to choose a machine to log into. On a network with several serving hosts (such as the virtual machines we have running where I work) this was far more convenient than actually having to memorise the name or IP of the machine you want to connect to.
Of the four XDMCP client options I presented in my previous post, only one provided this host chooser functionality. Unfortunately that one was to replace GDM with KDM, which also implies adding a whole load of KDE libraries to your system.
This post will tell you a couple of ways to work around the loss of the host chooser from the login screen. Neither approach is perfect, but if you don’t want to replace your GDM login with KDM or something else, then they’re about the only choice you’ve got. They’re also useful if you want to make an XDMCP connection from within a running desktop environment, using Xnest or Xephyr, as described in the previous post.
Option 1: Run gdm-host-chooser and copy the IP
You may not be able to get to the host chooser from the GDM login screen, but that doesn’t mean it’s gone away altogether. It’s still hanging around in the depths of your machine, and you can launch it by typing the following line into a terminal or the ALT-F2 “Run Application” dialogue:
/usr/lib/gdm/gdm-host-chooser
(Note that on 9.04, Jaunty Jackalope, and earlier releases, it was “/usr/lib/gdmchooser”)
The first thing to note is that it’s not as easy on the eye as the old version. Previously it was possible to provide custom icons for each host by putting images into /usr/share/hosts/ with suitable names. If no host image was found, the image at /usr/share/pixmaps/nohost.png was used by default. With Karmic Koala this latter image still exists, but isn’t displayed in the chooser. Neither are any images in the hosts icon directory.
In the image above you can see the Jaunty chooser on the left, complete with several default host icons, and one quickly thrown together custom icon at the bottom. On the right is the icon-less Karmic chooser, which is also much larger than the Jaunty chooser, making it too tall for many netbook screens. The image shows the smallest size that each dialogue will scale to – they can be made larger if necessary.
What’s interesting is that the Jaunty chooser shows the host name of the Karmic box in a fairly readable way (“markc-desktop.local (192.168.49.1)”) whereas the Karmic chooser shows only its IPv6 address, with no host name. What you can discern from the chooser, however, is the IP address of each of the XDMCP serving hosts on your network. With that information you can use the “-query” option to xinit, Xnest or Xephyr in order to log into the machine of your choice. If you really, really want to log into a machine by selecting it from this list, rather than copying the IP, take a look at the other options below.
Option 2: Use -indirect, with an older server
Cast your mind back through the mists of time, way back to when XDMCP was invented and dumb X terminals were connecting to Unix mainframes in universities the world over. Particularly well funded universities might even have more than one Unix server – and hence the need for a host chooser – but if the dumb X terminals had to become intelligent enough to go scouring the network for willing servers and present their own local chooser… well, that would likely push their already exorbitant prices even further skyward. So “-indirect” was born.
This option is used in place of “-query” or “-broadcast” when starting an X server. In the case of Ubuntu you might specify it when using xinit, Xnest or Xephyr, as described in the previous post. It has one parameter, the IP of a server which will serve up a host chooser. So back in our university scenario, each dumb terminal could still remain dumb, provided it knew how to connect to a single specified server. That server then took on the responsibility of displaying a host chooser to the user. Once the user selected a host, the dumb terminal would reconnect to the selected machine, and everyone was happy.
Up until Jaunty you could also use this approach with Ubuntu. If you had a Ubuntu machine on your network with a known IP or name, you could use -indirect to bring up that machine’s chooser in order to see any other XDMCP servers on your network. In a complex environment with several such servers it meant that you could get away with only remembering the address of one of them.
This still works from the client end in Karmic, but not from the server end. The changes to GDM mean that it will no longer serve up a host chooser to any wandering clients that may request one. You can, however, still get a chooser up from another machine that’s not yet been upgraded to Karmic. So if you’ve got a lot of machines to connect to it might be worth leaving at least one of them running an older version of Ubuntu for the time being, so that you can use it as the source of a host chooser with the -indirect option.
Option 3: Use gdm-host-chooser in a subshell
If you tried running gdm-host-chooser using the command above from within a terminal, you may have noticed a load of text spewed out into your command line. If you subsequently selected an entry in the host chooser and clicked the “Connect” button, you may have noticed some more text being spewed out. If you were really observant you may have noticed that, amongst the text being spewed, was the word “hostname:” followed by a space, then the name (or more probably the IP) of the machine you selected. We can use this particular bit of textual spew to our advantage.
Instead of simply executing /usr/lib/gdm/gdm-host-chooser we can pipe its output through some other command line tools so that all we get out is the selected host IP. I’ve used “grep” to isolate the line in question, and “cut” to separate out the IP, but there are many other ways to do this (feel free to post if you’ve got a better approach):
/usr/lib/gdm/gdm-host-chooser | grep "hostname:" |cut -d' ' -f2
Now if you select a server in the chooser and click the “Connect” button, you should see the IP address appear on the command line without the “hostname: ” prefix. Using this mechanism it’s possible to insert the selected IP directly into the command line when using the “-query” option to xinit, Xnest or Xephyr by putting the whole of that line into a subshell:
xinit -- :1 -once -query $(/usr/lib/gdm/gdm-host-chooser | grep "hostname:" |cut -d' ' -f2)
Xnest :1 -once -query $(/usr/lib/gdm/gdm-host-chooser | grep "hostname:" |cut -d' ' -f2)
Xephyr :1 -once -query $(/usr/lib/gdm/gdm-host-chooser | grep "hostname:" |cut -d' ' -f2)
Pick one of those lines, depending on which type of X server you want to run. They’re all a little unwieldy for day-to-day use, so you might prefer to create a small shell script containing the appropriate line. That way you can launch your chooser and X server from a single command, or even assign it to a launcher on your panel.
I should note that the performance of the host chooser on my test machine was less than stellar, taking several seconds for clicks to register, so if you do use this approach you might need to be a bit patient.
Comments (2)
Comments are closed.