Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 7 Apr 2009 11:59:15 -0700
From:      David Wolfskill <david@catwhisker.org>
To:        Joe Marcus Clarke <marcus@freebsd.org>
Cc:        Tim Kientzle <kientzle@freebsd.org>, current@freebsd.org, Robert Noland <rnoland@freebsd.org>
Subject:   Re: Hal and KDM breakage (was Re: KDE4 and input events stalled)
Message-ID:  <20090407185915.GY31409@albert.catwhisker.org>
In-Reply-To: <1239086408.35025.59.camel@shumai.marcuscom.com>
References:  <934e1d760904061455o4736d643o1d07e3292192d94c@mail.gmail.com> <1239057809.1908.2.camel@balrog.2hip.net> <49DAC742.8090507@freebsd.org> <1239075455.1908.36.camel@balrog.2hip.net> <49DACDBD.3030809@freebsd.org> <1239077210.1908.39.camel@balrog.2hip.net> <49DAD429.6090309@freebsd.org> <1239078081.1908.41.camel@balrog.2hip.net> <49DAE987.7090802@freebsd.org> <1239086408.35025.59.camel@shumai.marcuscom.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--DyGujRxquesowawl
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Apr 07, 2009 at 02:40:08AM -0400, Joe Marcus Clarke wrote:
> ...
> The problem is due to the fact that console-kit-daemon will not work if
> it starts up before init has started the ttys.  Therefore, hald needs to
> come up after the getty processes have been spawned (i.e. after init has
> started the ttys).

That would seem to contraindicate xdm (or similar) startup from
/etc/ttys, in general.

> If the ttys were started as part of the rc.d process, this could be avoid=
ed.

Hmmm..

> This is why GNOME makes people use the rc.d script to start gdm.  It
> just won't work out of /etc/ttys.

OK; I use xdm.  And following what I thought was appropriate, I fired it
up out of /etc/ttys.

I did, however, want to tweak things a bit; in particular, since I
regularly flip my laptop among stable/6, stable/7, and head, I wanted
the login screen to provide a hint as to what the machine was running at
the time.  So I cobbled up a shell script to copy Xresources to an
appropriate place & apply sed(1) using selected output of uname(1).

That's worked for ... well, years.

But since hald(8) became involved in X, things got a bit ugly.

In particular, it seemed that xdm was getting started before hald, and
that just wasn't helpful.  At least with the above explanation, I'm
beginning to see why that is.

I tweaked dependencies to force xdm to come up after hald, but even so,
that didn't help much: it seems that hald isn't really ready to provide
the services asked of it immediately.

So I hacked my xdm start-up script; it's got to the point where it seems
to work pretty reliaably for me; maybe it will help someone else:


#! /bin/sh

# PROVIDE: xdm
# REQUIRE: hald dhclient moused ip_addr
# KEYWORD: nostart

# This script is to be started from /etc/ttys, not /etc/rc.

=2E /etc/rc.subr

name=3D"xdm"

case "$1" in
start)
	if ! hald=3D$(check_process hald-addon-mouse-sysmouse); then
		sleep 5
		exit 1
	fi
	if [ ! -r /proc/${hald}/status ]; then
		sleep 5
		exit 1
	fi
	hald_start=3D`awk -F "[ ,]" '{print $8}' /proc/${hald}/status`
	now=3D`date "+%s"`
	# This was determined empirically
	hald_delay=3D8
	wait=3D$(($hald_start + $hald_delay - $now))
	if [ $wait -gt 0 ]; then
		info "$name start-up waiting $wait seconds for hald-addon-mouse-sysmouse"
		sleep $wait
	fi
	if [ -x /usr/local/bin/xdm ]; then
		old_dir=3D/usr/local/lib/X11/xdm
		new_dir=3D`/usr/bin/mktemp -d /tmp/.xdm-XXXXX`
		uname=3D`uname -v | sed -e "s/   .*$//"`
		sed -e "s/ Welcome to CLIENTHOST/ CLIENTHOST - ${uname}/" \
			-e "/greetFont/s/24-240/18-180/" \
			-e "s/Serif-24/Serif-18/" \
			${old_dir}/Xresources >${new_dir}/Xresources
		/usr/local/bin/xdm -nodaemon -resources "${new_dir}/Xresources"
	fi
	info "Starting ${name}."
	;;
stop)
	[ -r /var/run/xdm.pid ] && \
		 kill `cat /var/run/xdm.pid` && \
		 rm -fr /tmp/.xdm-????? && \
		 info -n ' xdm'
	;;
restart)
	$0 stop; $0 start
	;;
*)
	err 1 "Usage: `basename $0` {start|stop}|restart"
	;;
esac

exit 0


[I originally tried merely sleeping a bit, but eventually found it more
reliable to merely exit the script & let init(8) re-spawn it.)

Peace,
david
--=20
David H. Wolfskill				david@catwhisker.org
Depriving a girl or boy of an opportunity for education is evil.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.

--DyGujRxquesowawl
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAknbooIACgkQmprOCmdXAD102ACeOanJUpXmAxayW1Jl6hOpjRWr
RM8An1e2c3swlCsLODy4mUrF5NlBsOF8
=fABw
-----END PGP SIGNATURE-----

--DyGujRxquesowawl--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090407185915.GY31409>