[Pkg-sysvinit-devel] Starting bootlogd earlier

Nathanael Nerode neroden at twcny.rr.com
Mon May 15 23:07:19 UTC 2006

So I've had trouble debugging my udev rules.
Bootlogd starts too late to debug udev.

I fixed this.  As we all agree, bootlogd should start as early as possible.  I haven't
yet figured out how to get it running in an initrd.

First, I got it working before udev, as follows:
(1) relocate it to S03bootlogd
(2) add a copy of mountdevsubfs.sh at S03a-mountdevsubfs.sh, so it runs after
mountkernfs.sh and before udev.  Udev umounts the devsubfs's, and it's safe to
run mountdevsubfs.sh twice.

I decided that wasn't good enough considering what I could do.  The messages from
S01glibc.sh and S02mountkernfs.sh might be important, but they don't get logged and
go by too fast to read.  So I undid that.

So I got bootlogd working *very* early as follows:
(1) relocate it to S01bootlogd
(2) add a script S00mountdevpts.sh with the following contents:

#! /bin/sh
# Mount devpts for bootlogd.  Don't assume that /proc is available!
. /etc/default/devpts
mount -t devpts -ogid=$TTYGRP,mode=$TTYMODE devpts /dev/pts

(I couldn't use the standard script here because the domount function in
/lib/init/mount-functions.sh checks /proc unconditionally.  Blech.)

This works.  It works even if BSD-style ptys are not available (that's why /dev/pts
needs to be mounted).  It works with udev (udev lazily umounts /dev/pts, allowing
bootlogd to keep going).  It works if udev is not used.  It works if bootlogd is not

I haven't tried it with an unwriteable mtab, but adding -n to the mount would be just
fine by me; alternatively, if lib/init/mount-functions.sh had a way
to avoid checking /proc, it could be used.  In any case, failure to mount /dev/pts
at this stage will simply result in failure of bootlogd, since /dev/pts will be
mounted later.

I don't know if this is suitable for production, but if you would consider modifying
initscripts in this manner, it would be great.  If not, I strongly suggest that this
method be documented somewhere obvious, since I had a *very* aggravating time trying
to debug udev rules before I figured out that I could do this!

Nathanael Nerode  <neroden at twcny.rr.com>

This space intentionally left blank.

More information about the Pkg-sysvinit-devel mailing list