X has a
"-reset"/"-noreset"
option which controls whether the X server should reset itself after the last client exits (aka. user logs off) or not. This feature has been introduced long ago to come up for the various memory leaks that are present in X. The default behaviour is to do this self-reset and it is good so.

However if you use the NSC driver on a Compaq Evo T20, then sometimes upon such a reset the video mode is not set properly. X starts up OK, but you get only a blank screen to see. I've found two solutions for the problem.
Since I'm using the thin clients with LTSP-5, I'll refer to that in my solutions below, but you can easily adapt the idea to environments other than LTSP. I'm assuming that you've got the LTSP root at the default location (
/opt/ltsp/i386
).
Solution #1
Go to the LTSP screen scripts directory (
/opt/ltsp/i386/usr/lib/ltsp/screen.d
) and make a copy of
startx
, eg.
startx-custom
. Modify this copy:
- add a
-once
option to the command line of X
- put the X starting section into a neverending loop
So make the end of the script look something like this:
XF_ARGS="$XF_ARGS -once"
while true; do
if [ -w /proc/progress ]; then
${XBINARY} ${ACC_CTRL} \
${XF_ARGS} \
-xf86config ${XFCFG} \
vt${TTY} ${DISP} >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo -n -e "\n\rxserver failed, press <enter> to continue "
read CMD
fi
else
${XBINARY} ${ACC_CTRL} \
${XF_ARGS} \
-xf86config ${XFCFG} \
vt${TTY} ${DISP}
if [ $? -ne 0 ]; then
echo -n -e "\n\rxserver failed, press <enter> to continue "
read CMD
fi
fi
done
The
-once
option will make X exit (and not reset itself) after the first session is ended (the user logged off). The
while
loop will ensure that X is always automatically restarted after it exited. You should also modify
/opt/ltsp/i386/etc/lts.conf
so the new
startx-custom
script is used instead of the default
startx
.
You should also know that once you start X with the NSC driver, it'll screw up the console. This means that if you switch to another virtual console (by hitting Ctrl+Alt+F1 or so), then you will get only a blank screen. But be aware that it's only the video output that is missing, your key presses are going to the virtual console that you switched to! The same blank screen occurs, when X exits. That's why we had to add the automatic restart of X in a loop.
Solution #2
I've found that you can fix the blank screen with the
fbset
command in case it occurs upon a reset of the X server. This command line utility lets you control the kernel framebuffer device (usually
/dev/fb0
) and thus the video mode on each virtual console. The command is part of the
fbset
package so to use it on the thin client, you've to install it into the LTSP root environment first. You can do this with the following:
mount --bind /dev /opt/ltsp/i386/dev
chroot /opt/ltsp/i386 /bin/bash
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts
export HOME=/root LC_ALL=C LTSP_HANDLE_DAEMONS=false
apt-get install fbset
umount /dev/pts
umount /sys
umount -lf /proc
exit
umount /opt/ltsp/i386/dev
You've to set up the
/opt/ltsp/i386/etc/fb.modes
file to contain valid fb mode definitions. To make life easier, the
fbset
package contains a
modeline2fb
utility that can convert an existing Xfree86 or Xorg config file into an fb.modes equivalent. Here's how you can use it:
- set up sshd on your thin clients (for this you only have to install the
openssh-server
package into the LTSP root and you've to set a password for the root user in your LTSP root)
- start the thin client with X as usual
- start a terminal and execute
xvidtune -show
to get the Modeline of the actual video mode
- log in to the thin client's SSH server as root on a terminal
- go to eg. /tmp and make a copy of
/etc/X11/xorg.conf
(the Xorg config that was created during the boot of your client) into this directory
- add the previously fetched Modeline to the "Monitor" section of the copy of xorg.conf
- run
modeline2fb
on this modified xorg.conf (eg. modeline2fb -d 16 ./xorg.conf
)
As a result you get an fb.modes definition that you can put into the LTSP root's fb.modes,
/opt/ltsp/i386/etc/fb.modes
. Now login+logoff a couple of times on the thin client ... until you get a blank screen upon the X server's self-reset after the logoff. Now go to a different computer and ssh into the thin client and execute:
fbset --all mymode
, where "mymode" should be replaced with the name of the fb.modes definition that you have set up. Voala! Your thin client's screen switches from blank to the login screen.
Now to use this to fix the blank screen issue you've to make sure that X executes the above
fbset
command after its self-resets. However you cannot put this into any of the server-side config scripts since the
fbset
command must be run locally on the X server. I didn't go into this one, but ideally it should be done after X has set the video mode and before X queries the xdm (kdm, gdm ... or whatever). Good luck with that.

I've chosen my first solution and did not fully work out this one.
Comments
Great article. Well written