Authenticated as: Anonymous (Change Credentials / Create Account)

Beautifying XDM on FreeBSD

XDM makes having a FreeBSD desktop machine much less painful for non-tech folks, you'd be amazed at the number of people with the intellectual capacity to remember a username and password who can't seem to remember that startx is all one word, or not capitalized, or remember it at all. XDM solves all these problems by presenting a pretty graphical login screen as soon as the machine boots (if configured so), but it's default appearance is, well, something out of late 1980's computing.

Installing XDM

XDM is actually typically installed with the X.org port/package (x11/xorg), so it's not too much to worry about. Activating it is quite trivial too: a change to /etc/ttys is typically all that's necessary. As root, you'll need to edit the /etc/ttys file, and find the line controlling the 9th virtual terminal:

ttyv8 "/usr/X11R6/bin/xdm -nodaemon" xterm off secure

.. as specified in the handbook [1]. By default, it is set to "off", but one can change this with a text editor. You might also want to set this to insecure, to prevent root logins, but that's up to you. Once you've modified this file, restart initd:

kill -1 1

Don't be alarmed, your terminal will probably be yanked away and after a few moments an X login screen will appear. To get back to your terminal, use the ctrl-alt-function key combination to return to the virtual terminal you were on. You should now have a working "graphical virtual terminal".

Note: If X is improperly configured and refuses to start, it'll die each time initd tries to start it, which will result in a loop. Thankfully, initd is smart enough to realize this, and after a few times it'll take a brief pause in the loop (I believe the pause is 30 seconds). This should be long enough for you to turn the terminal off again, sighup initd, and figure out what's wrong with X. Needless to say, you should probably have a working X installation prior to enabling the graphical terminal.

Sheesh: it's ugly!

Yeah. Let's do something about that. First of all, that backdrop might have been cool in the 1980s, but it's got to go now. For one thing, if you have a cheap monitor that's not quite on sync, that background will vibrate (but you should probably fix your frequencies before changing the background, unless you like headaches and eye strain). This introduces us to the first configuration file for XDM, Xsetup_0 which with X.org on FreeBSD can be found in /usr/X11R6/lib/X11/xdm/.

Xsetup_0 is a shell script which is executed as soon as X is brought up, prior to a user logging on. It's run as root, so be very careful of the security implications of the programs you use in it. If you have Eterm installed, it's simplest to use Esetroot to set a pretty background for the login screen. My Xsetup_0 file looks like this:

#!/bin/sh #xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail Esetroot ~fwaggle/.fluxbox/backgrounds/blue_alternate.png

If you don't have Eterm installed, and don't want it installed, xv can be used instead:

xv -root -rmode 5 -quit ~fwaggle/.fluxbox/backgrounds/blue_alternate.png

I've seen people use xflame and suchlike for an animated background, I personally don't care for it. The sky's the limit here people, it's a shell script! Just remember what I said, Xsetup_0 and it's contents are run as root.

That's still an ugly widget...

Alright, on to beautifying the xlogin widget at the center of the XDM show. The next file we're going to edit is Xresources, also found in /usr/X11R6/lib/X11/xdm/. It works like any other Xresources file, bangs are comments and suchlike.

The first thing I did with mine was remove that ugly X logo. You can replace it if you like, with a compatible X-bitmap file that you can probably create with the Gimp. Be aware though, if XDM doesn't like your bitmap, it'll continually restart, which is most annoying. I commented mine out, with a "bang" in front of it:

!xlogin:logoFileName:

Next, to change the fonts. The easiest way to do this is have another X workstation handy that you can shell over to the workstation you're customizing, and also run xfontsel at the same time. Restarting XDM has the nasty side effect of killing your current X session. I set all my fonts like this:

xlogin*font: -*-lucida-medium-r-*-*-10-*-*-*-*-*-*-*

But keep in mind my laptop only has an 800x600 display. You might want something a little more legible on a nice new machine with a decent resolution. Next, you can play with the colors, using the shitty X color names (which aren't really communicative in the slightest), or you can use.... HTML hex triplets! I tried it just as a goof, and believe it or not it actually works. You can therefore easily pick your entire color scheme using the Gimp's color picker, or something similar:

xlogin*background: #42538B xlogin*foreground: #ffffff xlogin*greetColor: white

I left the last one in as an illustration of the color names. Finally, you can play around with the varying messages, such as the greeting. Since mine is a laptop, I changed mine to a scary, but otherwise useless "dont steal me" message:

xlogin*greeting: This machine is property of Hungry Hacker Industries.

Hey! That's not my WM!

Yeah, since you're using XDM now, it no longer pays attention to the xinitrc/.xinitrc files. Instead, you have to use .xsession, which is also a shell script, but this time is run as the user. It shouldn't be too hard for you to figure how to get your window manager settings over, should it?

If everything went alright, you should now have a graphical login screen that's not completely pants to look at. Of course, you could have just installed kdm or gdm (installed, I believe, with x11/kde3 and x11/gnome2 respectively), but I had issues with gdm not behaving, and I'm not particularly fond of kdm. I guess you could try those if you liked.

References

  1. FreeBSD Handbook - XDM