bsd-style init scripts and udev

Wilco Beekhuizen wilcobeekhuizen at gmail.com
Thu Jan 3 06:13:28 PST 2008


2008/1/3, zux <zux at pie-dabas.net>:
> hi
> i have successfully compiled linux from scratch, but i can't boot it
> because the bsd-style init script hint said nothing about udev :( and my
> experiment on ajusting slackware boot scripts were unsuccessful.
> everything else works, the kernel boots, but udev doesn't create
> anything in /dev/ so even e2fschk can't check my root partition :)
> that's where i get the recovery console. it's strange that the partition
> does get mounted ro.
> --
> http://linuxfromscratch.org/mailman/listinfo/lfs-support
> FAQ: http://www.linuxfromscratch.org/lfs/faq.html
> Unsubscribe: See the above information page
>
The bsd-style hint is very old. You need to add udev at the right
place in rc.d and remount /proc and /sys. I've included my rc.sysinit
which should be useful for you.

This is my bsd style rc.sysinit. I think it differs from the
"official" BSD hint, but you should be able to use it:

#!/bin/sh
echo "Mounting root device read-only..."
/bin/mount -n -o remount,ro /

echo "Starting udev..."
mount -n -t sysfs sysfs /sys
mount -n -t proc proc /proc
mount -n -t tmpfs tmpfs /dev
echo > /proc/sys/kernel/hotplug
cp -ar /lib/udev/devices/* /dev
udevd --daemon
udevtrigger
udevsettle

echo "Initializing swap partitions..."
/sbin/swapon -a

/sbin/fsck -A -a -C
if [ $? -gt 1 ]; then
   echo
   echo "ERROR:"
   echo "Your filesystem has been severely damaged. You can probably
correct this"
   echo "problem by running e2fsck manually (eg. with the -v and -y
options). After"
   echo "you logout, the system will reboot."
   echo
   PS1="(Repair filesystem)# "
   export PS1
   /sbin/sulogin
   /bin/umount -a -r
   /sbin/reboot -f
fi

echo "Remounting root device read-write..."
/bin/mount -n -v -o remount,rw /

echo "" >/etc/mtab
/bin/mount -f -o remount,rw /

echo "Recording existing mounts in /etc/mtab..."
mount -f /proc
mount -f /sys

echo "Mounting other local filesystems..."
/bin/mount -a -tnonfs

echo "Setting up loopback networking..."
/sbin/ifconfig lo 127.0.0.1
/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo

echo "Setting up hostname..."
/bin/hostname `cat /etc/HOSTNAME |cut -d . -f1`
/bin/domainname `cat /etc/HOSTNAME |cut -d . -f2-`

if [ -f "/tmp/random-seed" ]; then
  echo "Initializing random number generator..."
  /bin/cat /tmp/random-seed >/dev/urandom
  rm -f /tmp/random-seed
fi

echo "Setting system time from hardware clock..."
/sbin/hwclock --hctosys

echo "Starting system and kernel log daemons...."
/usr/sbin/syslogd
/usr/sbin/klogd -c3

echo "Updating module dependencies..."
/sbin/depmod -a



More information about the lfs-support mailing list