Split fsck during boot into two phases. Check the root file system

first, mount root and run the various disk providers. Add swap and
check the remaining file systems after that.
This breaks the dependency cycle for lvm, which needs writeable /dev.
Depend on rndctl in cgd.
This commit is contained in:
joerg 2009-04-21 16:08:57 +00:00
parent f866ee08fd
commit e7f29a3386
15 changed files with 99 additions and 26 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.207 2009/02/02 20:47:20 joerg Exp $
# $NetBSD: mi,v 1.208 2009/04/21 16:08:57 joerg Exp $
#
# Note: end-user configuration files that are moved to another location
# should not be marked "obsolete"; they should just be removed from
@ -159,6 +159,7 @@
./etc/rc etc-sys-rc
./etc/rc.conf etc-sys-rc
./etc/rc.d/DAEMON etc-sys-rc
./etc/rc.d/DISKS etc-sys-rc
./etc/rc.d/LOGIN etc-sys-rc
./etc/rc.d/NETWORK etc-obsolete obsolete
./etc/rc.d/NETWORKING etc-sys-rc
@ -187,6 +188,7 @@
./etc/rc.d/envsys etc-sys-rc
./etc/rc.d/fixsb etc-obsolete obsolete
./etc/rc.d/fsck etc-sys-rc
./etc/rc.d/fsck_root etc-sys-rc
./etc/rc.d/fsck.sh etc-obsolete obsolete
./etc/rc.d/ftp_proxy etc-net-rc
./etc/rc.d/ftpd etc-net-rc

View File

@ -1,4 +1,4 @@
# $NetBSD: special,v 1.127 2009/01/18 08:24:46 taca Exp $
# $NetBSD: special,v 1.128 2009/04/21 16:08:57 joerg Exp $
# @(#)special 8.2 (Berkeley) 1/23/94
#
# This file may be overwritten on upgrades.
@ -178,6 +178,7 @@
./etc/rc.conf type=file mode=0644
./etc/rc.d type=dir mode=0755
./etc/rc.d/DAEMON type=file mode=0555
./etc/rc.d/DISKS type=file mode=0555
./etc/rc.d/LOGIN type=file mode=0555
./etc/rc.d/NETWORKING type=file mode=0555
./etc/rc.d/SERVERS type=file mode=0555
@ -202,6 +203,7 @@
./etc/rc.d/downinterfaces type=file mode=0555
./etc/rc.d/envsys type=file mode=0555
./etc/rc.d/fsck type=file mode=0555
./etc/rc.d/fsck_root type=file mode=0555
./etc/rc.d/ftp_proxy type=file mode=0555
./etc/rc.d/ftpd type=file mode=0555
./etc/rc.d/hostapd type=file mode=0555

11
etc/rc.d/DISKS Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
#
# $NetBSD: DISKS,v 1.1 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: DISKS
#
# This is a dummy dependency, to ensure that all disk devices are
# accessible for fsck and mountcritlocal.
#

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.76 2009/04/15 22:36:04 joerg Exp $
# $NetBSD: Makefile,v 1.77 2009/04/21 16:08:57 joerg Exp $
.include <bsd.own.mk>
@ -14,12 +14,12 @@
# src/sbin/rcorder.
CONFIGFILES=\
DAEMON LOGIN NETWORKING SERVERS \
DAEMON DISKS LOGIN NETWORKING SERVERS \
accounting altqd amd apmd \
bootconf.sh bootparams btattach btconfig btdevctl bthcid \
ccd cgd cleartmp cron \
dhclient dhcpd dhcrelay dmesg downinterfaces envsys \
fsck ftp_proxy ftpd \
fsck fsck_root ftp_proxy ftpd \
hostapd httpd \
identd ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec \
irdaattach iscsi_target isdnd \

View File

@ -1,9 +1,10 @@
#!/bin/sh
#
# $NetBSD: ccd,v 1.5 2004/08/13 18:08:03 mycroft Exp $
# $NetBSD: ccd,v 1.6 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: disks
# PROVIDE: ccd
# BEFORE: DISKS
$_rc_subr_loaded . /etc/rc.subr

View File

@ -1,9 +1,11 @@
#!/bin/sh
#
# $NetBSD: cgd,v 1.5 2005/03/02 19:09:22 tv Exp $
# $NetBSD: cgd,v 1.6 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: disks
# PROVIDE: cgd
# REQUIRE: rndctl
# BEFORE: DISKS
$_rc_subr_loaded . /etc/rc.subr

52
etc/rc.d/fsck_root Executable file
View File

@ -0,0 +1,52 @@
#!/bin/sh
#
# $NetBSD: fsck_root,v 1.1 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: fsck_root
$_rc_subr_loaded . /etc/rc.subr
name="fsck_root"
start_cmd="fsck_root_start"
stop_cmd=":"
fsck_root_start()
{
if [ -e /fastboot ]; then
echo "Fast boot: skipping disk checks."
return
fi
trap : 2 # Ignore SIGINT, SIGQUIT, so we
trap : 3 # enter single-user mode on failure.
echo "Starting root file system check:"
fsck $fsck_flags /
local fsck_error="$?"
case $fsck_error in
0) # OK
return
;;
2) # Needs re-run, still fs errors
echo "file system still has errors; re-run fsck manually!"
;;
4) # Root modified
echo "Root filesystem was modified, rebooting ..."
reboot
echo "Reboot failed; help!"
;;
8) # Check failed
echo "Automatic file system check failed; help!"
;;
12) # Got signal
echo "Boot interrupted."
;;
*)
echo "Unknown error $fsck_error; help!"
;;
esac
stop_boot
}
load_rc_config $name
run_rc_command "$1"

View File

@ -1,10 +1,11 @@
#!/bin/sh
#
# $NetBSD: lvm,v 1.4 2009/04/13 18:48:14 haad Exp $
# $NetBSD: lvm,v 1.5 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: disks
# PROVIDE: lvm
# REQUIRE: root
# BEFORE: DISKS
$_rc_subr_loaded . /etc/rc.subr

View File

@ -1,10 +1,10 @@
#!/bin/sh
#
# $NetBSD: mountcritlocal,v 1.9 2006/11/12 01:22:58 christos Exp $
# $NetBSD: mountcritlocal,v 1.10 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: mountcritlocal
# REQUIRE: root
# REQUIRE: fsck
$_rc_subr_loaded . /etc/rc.subr

View File

@ -1,9 +1,10 @@
#!/bin/sh
#
# $NetBSD: raidframe,v 1.9 2004/08/13 18:08:03 mycroft Exp $
# $NetBSD: raidframe,v 1.10 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: disks
# PROVIDE: raidframe
# BEFORE: DISKS
$_rc_subr_loaded . /etc/rc.subr

View File

@ -1,10 +1,11 @@
#!/bin/sh
#
# $NetBSD: rndctl,v 1.2 2009/02/02 09:24:47 apb Exp $
# $NetBSD: rndctl,v 1.3 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: rndctl
# BEFORE: disks ike ipsec sshd
# BEFORE: DISKS ike ipsec sshd
# REQUIRE: wdogctl
$_rc_subr_loaded . /etc/rc.subr

View File

@ -1,10 +1,10 @@
#!/bin/sh
#
# $NetBSD: root,v 1.3 2004/08/13 18:08:03 mycroft Exp $
# $NetBSD: root,v 1.4 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: root
# REQUIRE: fsck
# REQUIRE: fsck_root
$_rc_subr_loaded . /etc/rc.subr

View File

@ -1,10 +1,10 @@
#!/bin/sh
#
# $NetBSD: swap1,v 1.9 2004/08/13 18:08:03 mycroft Exp $
# $NetBSD: swap1,v 1.10 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: localswap
# REQUIRE: disks
# REQUIRE: DISKS root
# KEYWORD: shutdown
$_rc_subr_loaded . /etc/rc.subr

View File

@ -1,10 +1,10 @@
#!/bin/sh
#
# $NetBSD: wdogctl,v 1.3 2009/04/15 21:33:57 joerg Exp $
# $NetBSD: wdogctl,v 1.4 2009/04/21 16:08:57 joerg Exp $
#
# PROVIDE: wdogctl
# BEFORE: disks
# BEFORE: fsck_root
# The watchdog is configured VERY early, so that any problems that
# occur during the bootstrap process are protected by the watchdog.

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: postinstall,v 1.93 2009/04/06 00:30:33 martin Exp $
# $NetBSD: postinstall,v 1.94 2009/04/21 16:08:57 joerg Exp $
#
# Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
# All rights reserved.
@ -991,12 +991,12 @@ do_rc()
fi
compare_dir "${op}" "${SRC_DIR}/etc/rc.d" "${DEST_DIR}/etc/rc.d" 555 \
DAEMON LOGIN NETWORKING SERVERS \
DAEMON DISKS LOGIN NETWORKING SERVERS \
accounting altqd amd apmd \
bootconf.sh bootparams btattach btconfig btdevctl bthcid \
ccd cgd cleartmp cron \
dhclient dhcpd dhcrelay dmesg downinterfaces envsys \
fsck ftp_proxy ftpd \
fsck fsck_root ftp_proxy ftpd \
hostapd httpd \
identd ifwatchd inetd ipfilter ipfs ipmon ipnat ipsec \
irdaattach iscsi_target isdnd \