By default, the inittab file in DSL-N looks like this:
# /etc/inittab: init(8) configuration.As you can see, the default runlevel is 5, and at this runlevel only a single bash shell is started, on tty1. Also note that there's no entry in the inittab to specifically start X (e.g., through a display manager). So how does X get started? This question is answered in the file /home/dsl/.bash_profile (which is read because of the "-login" switch on bash in the inittab). Here's what the file looks like:
id:5:initdefault:
si::sysinit:/etc/init.d/rcS
~~:S:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1
l0:0:wait:/etc/init.d/knoppix-halt
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/knoppix-reboot
ca::ctrlaltdel:/etc/init 0
kb::kbrequest:/bin/echo "Keyboard Request -- edit /etc/inittab to let this work."
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
1:12345:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1
2:234:respawn:/bin/bash -login >/dev/tty2 2>&1 </dev/tty2
3:234:respawn:/bin/bash -login >/dev/tty3 2>&1 </dev/tty3
4:234:respawn:/bin/bash -login >/dev/tty4 2>&1 </dev/tty4
#!/bin/bashSo, when "bash -profile" is run under runlevel 5 (and if we're not logging in through an SSH connection), the startx command is executed. This command doesn't return until X is terminated.
export IRCNICK=DSL
SSH=`env | grep SSH_CONNECTION`
RUNLEVEL=`runlevel|cut -f2 -d' '`
if [ -z "$SSH" ]; then
if [ $RUNLEVEL -eq 5 ]; then
startx
fi
fi
I wanted to modify the inittab so that more virtual consoles were started (without running X on them!), but I didn't want to go to the trouble of re-mastering the DSL-N knoppix image. So, instead I modified the minirt image that is used to set up things for the rest of the DSL-N boot process. In particular, I modified one file in minirt: "linuxrc".
Modifying the minirt image is pretty easy. Just copy the image somewhere and do the following:
gunzip dsl-minirt26.gzThen copy the resulting dsl-minirt26.gz back onto the USB flash drive.
mount -o loop dsl-minirt26 /mnt/tmp
emacs /mnt/tmp/linuxrc
umount /mnt/tmp
gzip dsl-minirt26
I changed linuxrc by adding a few lines near the bottom of the script. If you look at the default linuxrc file, you'll see lines like this near the end:
# Give control to the init process.Right above this section, I inserted the lines:
echo "${CRE}${BLUE}Starting init process.${NORMAL}"
rm -f /linuxrc
exit 0
# Installing substitute config files:
echo "${CRE}${BLUE}Copying custom config files.${NORMAL}"
cp /cdrom/dsl/config/etc/inittab /UNIONFS/etc/
The directory "/cdrom" is actually the root of the filesystem on the USB flash drive. Under that, I've created a "dsl" directory to store extra bits and pieces for DSL-N. The new linuxrc copies a modified inittab file from there and drops it on top of the default file in /UNIONFS/etc.
The modified inittab file looks like this:
# /etc/inittab: init(8) configuration.I've moved the shell that starts X onto tty2 (since under KNOPPIX my fingers know to press ctrl-alt-f1 to get a text console) and I've added shells running on tty1, tty3 and tty4. To avoid starting extra instances of X, the additional shells are started without "-login" (so that the .bash_profile file is ignored). This works fine, although I'm sure there are more elegant ways to do it.
id:5:initdefault:
si::sysinit:/etc/init.d/rcS
~~:S:respawn:/bin/bash -login >/dev/tty1 2>&1 </dev/tty1
l0:0:wait:/etc/init.d/knoppix-halt
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/knoppix-reboot
ca::ctrlaltdel:/etc/init 0
kb::kbrequest:/bin/echo "Keyboard Request -- edit /etc/inittab to let this work."
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
1:12345:respawn:/bin/bash >/dev/tty1 2>&1 </dev/tty1
2:12345:respawn:/bin/bash -login >/dev/tty2 2>&1 </dev/tty2
3:12345:respawn:/bin/bash >/dev/tty3 2>&1 </dev/tty3
4:12345:respawn:/bin/bash >/dev/tty4 2>&1 </dev/tty4
Regarding the "read-only" mount of the USB flash drive's filesystem, I could also fix that by modifying linuxrc, since this is where the filesystem is explicitly mounted with the "-ro" flag. Instead, I decided to leave it the way it was. When I need to write something, I type
mount -o remount,rw /cdrom