[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Since xdm is still screwed (a fix)



Okay, since the test script used by CHECK_LOCAL_SERVER runs as of -7 but xdm
still doesn't start as often as not, I would REALLY GREATLY APPRECIATE IT if
this gets into -8..

The idea is simple, if xdm is dying, frequently, you probably will lose
console access to your machine---lovely thought, that.  What I propose is a
little sanity check not on the file, but the state of the xdm itself.

Make this the first thing to do in /etc/X11/xdm/Xsetup_0:
touch /var/run/xdm.ok

I'd make this a configurable name as below if I knew how.  Since I do not,
I'll let you do it.  =>


And here's a pseudo-patch for /etc/init.d/xdm:
------ line 6:
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/bin/X11/xdm
PIDFILE=/var/run/xdm.pid
+TESTFILE=/var/run/xdm.ok

test -x $DAEMON || exit 0

# comment out the next line if xdm manages no local sessions, or for some
# reason does not need a valid /etc/X11/XF86Config file to do so
CHECK_LOCAL_XSERVER=1
+
+# If CHECK_LOCAL_XSERVER is defined above, this is the number of seconds we
+# will wait for xdm to properly be started before assuming it's not going to
+# start properly and shutting it down.
+MAXTIME=45

case "$1" in
  start)
    if [ $CHECK_LOCAL_XSERVER ]; then
------ line 37 (before adding the above):
      fi
    fi
    echo -n "Starting X display manager: xdm"
-    start-stop-daemon --start --quiet --pid $PIDFILE --exec $DAEMON || echo -n " already running" && \
+    start-stop-daemon --start --quiet --pid $PIDFILE --exec $DAEMON \
+     || echo -n " already running" \
+     && if [ $CHECK_LOCAL_XSERVER ]; then
+          count=1
+          rm /var/run/xdm.ok
+          while [ ! -r $TESTFILE -a $count -lt $MAXTIME ]; do
+            sleep 1
+            count=`expr $count + 1`
+          done
+          if [ ! -r $TESTFILE ]; then
+            echo -n ' failed to start properly'
+          fi
+        fi
    echo "."
  ;;


Great amounts of thanks to jm_ and dark for their help and #debian in
general for putting up with me while I tried to figure out how to do the
while loop above..  If you or anyone else spots a bug in the above, feel
free to fix it and tell me what I did wrong.  =>

-- 
Show me the code or get out of my way.

Attachment: pgpuGIg9xuR2A.pgp
Description: PGP signature


Reply to: