Concurrent boot, NFS and serial mouse

When I moved from Lenny to Squeeze, I run into several problems, which where partly caused by the new concurrent boot. I solved some of the problems by putting an empty file called '.legacy-bootordering' in the '/etc/init.d/' directory.
Rumour has it that this trick won't be available in Wheezy. So I had to solve my problems in an other way in order to be ready for Wheezy.

Serial mouse

Inputattach

With Squeeze the mouse stopped working. The solution was to use inputattach (as root) to enable the mouse;


inputattach --daemon --mousesystems /dev/ttyS0

Start script

A bit of experimentation showed that this has to be done AFTER starting X. So I wrote a start script based on '/etc/init.d/rc.local' called 'amouse';


#! /bin/sh
### BEGIN INIT INFO
# Provides:          amouse
# Required-Start:    $x-display-manager
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start inputattach for serial mouse
### END INIT INFO


PATH=/sbin:/usr/sbin:/bin:/usr/bin

. /lib/lsb/init-functions

case "$1" in
    start)
        if ! ( ps afx | grep /usr/bin/inputattach | /bin/grep -v grep > /dev/null )
        then
                log_daemon_msg "Starting serial mouse"
                /usr/bin/inputattach --daemon --mousesystems /dev/ttyS0
        fi
        ;;
    restart|reload|force-reload)
        echo "Error: argument '$1' not supported" >&2
        exit 3
        ;;
    stop)
        log_daemon_msg "Stopping serial mouse"
        killall inputattach
        ;;
    *)
        echo "Usage: $0 start|stop" >&2
        exit 3
        ;;
esac

Sys-V

I wanted the mouse to start just after X (and before bootlogs). The script is therefore called 'amouse' and is linked from symlinks like 'S05amouse' and 'K05amouse'.
The following command generates the symlinks;


update-rc.d amouse defaults 05

Some of the links in '/etc/rc2.d/';


S04xdm      -> ../init.d/xdm
S05amouse   -> ../init.d/amouse
S05bootlogs -> ../init.d/bootlogs

Concurrent boot

The line '# Required-Start: $x-display-manager' refers to '/etc/insserv.conf.d/' which contains a file which 'translates' 'x-display-manager' to the display manager I actually use. In my case 'xdm'.

I first made a backup of the '/etc/init.d/.depend.*' files. And then modified the files with;


insserv /etc/init.d/amouse

This, among others, adds a line 'amouse: xdm' to '.depend.start'.
Both X and the mouse are now available about 30 seconds before the boot has completely finished (ntp takes that long).

Boot order

The order in which daemons are started is different with insserv. The table below shows an example;

Sys-V vs Insserv bootorder: Named
Symlink in rc2.d Required-StartShould-StartBind
S01rsyslog $remote_fs $time
S02bind9 $remote_fs$network $syslog
S02clamav-daemon $remote_fs $syslog X
S02lprng $network $remote_fs $syslog X
S02mysql $remote_fs $syslog$network $timeX
S02ntp $network $remote_fs $syslogX
S02spamassassin $remote_fs$network $syslogX
S02ssh $remote_fs $syslogX
S02xinetd $local_fs $remote_fs$syslogX
S03apache2 $local_fs $remote_fs $network $syslog $named
S04asterisk $remote_fs$syslog $network $named mysql postgresql dahdi
S04clamav-freshclam $remote_fs $syslogclamav-daemonX
S04exim4 $remote_fs $syslog $named $network $timepostgresql mysql clamav-daemon greylist spamassassin
S04squid3 $network $remote_fs $syslog$named
S15portmap $network $local_fs X
S16nfs-common $portmap $time X
S17nfs-kernel-server$remote_fs nfs-common $portmap $time X

The first column is an excerpt from '/etc/rc2.d/', which brings the system into multi user mode. As you can see a lot of daemons are started after Bind.
The next two columns show the dependencies during concurrent boot: A lot of daemons are started BEFORE Bind is running (marked 'X'). Only four start with DNS available (marked '').
The means the system relies heavily on '/etc/hosts' during concurrent boot. A missing entry here may lead to a service failing to start.

Changing the boot order

In my case, I had to edit '/etc/hosts' in order to get lprng to start, which caused other problems. So I made lprng depend on bind;

  1. Create a file 'lprng' in '/etc/insserv/overrides/'
  2. Copy LSB block of '/etc/init.d/lprng' to '/etc/insserv/overrides/lprng'.
  3. Add '$named' to the 'Required-Start' line.
  4. Add a comment below the 'END INIT INFO' line, explaining it's purpose.

/etc/insserv/overrides/lprng;


### BEGIN INIT INFO
# Provides: lprng
# Required-Start: $network $remote_fs $syslog $named
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start lpd to allow printing
# Description: lpd is the print daemon required for lpr to work properly.
#   It is basically a server that arbitrates print jobs to printer(s).
### END INIT INFO
# This starts lprng after named.

Next run;


insserv lprng

This will modify the '/etc/init.d/.depend.*' files.

NFS

NFS used to be started After Bind. Now it's before Bind. This causes boot and shutdown problems.
Entries in /etc/hosts don't help. The only thing that fixes the problem is to use IP addresses instead of hostnames in /etc/fstab.