3 # /etc/rc.d/rc.sysinit - run once at boot time
6 # Taken in part from Miquel van Smoorenburg's bcheckrc.
7 # Changes: Arkadiusz Mi¶kiewicz <misiek@pld-linux.org>
11 PATH=/bin:/sbin:/usr/bin:/usr/sbin
14 # reasonable start values for bootsplash progress.
20 if [ -r /etc/sysconfig/i18n ]; then
22 [ -n "$LANG" ] && export LANG || unset LANG
23 [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
24 [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
25 [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
26 [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
27 [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
28 [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
29 [ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL
30 [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
31 [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
34 # Read network config data
35 if [ -r /etc/sysconfig/network ]; then
36 . /etc/sysconfig/network
42 # Read system config data
43 if [ -r /etc/sysconfig/system ]; then
44 . /etc/sysconfig/system
46 RUN_SULOGIN_ON_ERR=yes
58 . /etc/rc.d/init.d/functions
60 if ! is_yes "$VSERVER" ; then
61 # we need /proc mounted before everything
62 mount -n -o gid=17 -t proc /proc /proc
64 # sysfs is also needed before any other things (under kernel > 2.5)
65 if grep -q sysfs /proc/filesystems 2>/dev/null ; then
66 mount -n -o gid=17 -t sysfs sysfs /sys
67 if [ "$(kernelver)" -ge "002006014" ] && \
68 grep -q securityfs /proc/filesystems 2>/dev/null ; then
69 mount -n -o gid=17 -t securityfs securityfs /sys/kernel/security
75 if grep -q selinuxfs /proc/filesystems 2>/dev/null && ! grep -q selinuxfs /proc/mounts 2>/dev/null; then
76 mount -n -o gid=17 -t selinuxfs selinuxfs /selinux
79 if [ $(kernelverser) = "002006" ]; then
80 MODULES_CONF=/etc/modprobe.conf
81 elif [ -r /etc/modules.conf ]; then
82 MODULES_CONF=/etc/modules.conf
84 MODULES_CONF=/etc/conf.modules
88 if [ -x /etc/rc.d/rc.live ]; then
92 # Choose Hardware profile
93 if [ -f /etc/sysconfig/hwprof ]; then
94 . /etc/sysconfig/hwprof
95 if is_yes "${HWPROFILES}" && [ -x /sbin/hwprofile -a -d /etc/sysconfig/hwprofiles/data ]; then
96 mount -n / -o rw,remount
98 mount -n / -o ro,remount
102 # Disable splash when requested
103 [ -e /proc/splash ] && is_no "$BOOT_SPLASH" && echo "0" > /proc/splash
105 # Check SELinux status
106 selinuxfs=$(awk '/ selinuxfs / { print $2 }' /proc/mounts 2> /dev/null)
108 if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
109 if [ -r $selinuxfs/enforce ] ; then
110 SELINUX=$(cat $selinuxfs/enforce)
112 # assume enforcing if you can't read it
117 if [ -x /sbin/restorecon ] && LC_ALL=C fgrep -q " /dev " /proc/mounts 2>/dev/null ; then
118 /sbin/restorecon -R /dev 2>/dev/null
122 if [ "$CONSOLETYPE" = "vt" -a -x /sbin/setsysfont ]; then
127 # Print welcome message
128 nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CPLD)" "$(termput op)"
129 if ! is_no "$RC_PROMPT"; then
130 nls -n "\t\t Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
135 run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
137 # Set the NIS domain name
138 if [ -n "$NISDOMAIN" ]; then
139 run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
144 if ! is_yes "$VSERVER"; then
145 # Set console loglevel
146 if [ -n "$CONSOLE_LOGLEVEL" ]; then
147 /bin/dmesg -n $CONSOLE_LOGLEVEL
150 if [ -f /etc/udev/udev.conf ];then
151 . /etc/udev/udev.conf
154 [ -x /sbin/start_udev ] && /sbin/start_udev
156 # /dev must be also mounted before everything but only if we want use them ;-)
157 if is_yes "$MOUNT_DEVFS"; then
158 run_cmd "Mounting Device Filesystem" mount -n -t devfs /dev /dev
162 if [ -e /dev/.devfsd -a -x /sbin/devfsd ]; then
163 run_cmd "Starting Device Filesystem Daemon" /sbin/devfsd /dev
166 # cpuset support (mounted unconditionally, shouldn't be a problem)
167 if grep -q cpuset /proc/filesystems 2>/dev/null ; then
168 mount -n -t cpuset none /dev/cpuset
171 # Configure Linux kernel (initial configuration, some required modules still
173 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
175 # Set the system clock.
180 if [ -f /etc/sysconfig/clock ]; then
181 . /etc/sysconfig/clock
183 # convert old style clock config to new values
184 if [ "${CLOCKMODE}" = "GMT" ]; then
186 elif [ "${CLOCKMODE}" = "ARC" ]; then
191 if grep "system serial" /proc/cpuinfo 2>/dev/null | grep -q MILO 2>/dev/null ; then
196 CLOCKFLAGS="--hctosys"
198 if is_yes "$UTC" ; then
199 CLOCKFLAGS="$CLOCKFLAGS --utc"
200 CLOCKDEF="$CLOCKDEF (utc)"
202 CLOCKFLAGS="$CLOCKFLAGS --localtime"
203 CLOCKDEF="$CLOCKDEF (local)"
206 if is_yes "$ARC" ; then
207 CLOCKFLAGS="$CLOCKFLAGS -A"
208 CLOCKDEF="$CLOCKDEF (arc)"
211 if is_yes "$SRM" ; then
212 CLOCKFLAGS="$CLOCKFLAGS -S"
213 CLOCKDEF="$CLOCKDEF (srm)"
216 # Check if timezone definition is available
217 if [ -e /etc/localtime ] ; then
218 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
219 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
222 TIME_SETUP_DELAYED=yes
226 run_cmd "Activating swap partitions" swapon -a -e
228 # Initialize USB controllers
230 if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "/proc/bus/usb" /proc/mounts 2>/dev/null ; then
231 aliases=$(/sbin/modprobe -c | awk '/^alias usb-controller/ { print $3 }')
232 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
233 /sbin/modprobe -s -k usbcore
234 for alias in $aliases ; do
235 [ "$alias" = "off" ] && continue
236 run_cmd "$(nls 'Initializing USB controller') ($alias)" /sbin/modprobe -s $alias
238 [ $? -eq 0 -a -n "$aliases" ] && usb=1
240 if grep -iq "usb" /proc/devices 2>/dev/null ; then
245 if [ "$usb" = "1" -a ! -f /proc/bus/usb/devices ]; then
246 run_cmd "Mounting USB filesystem" mount -t usbfs usbfs /proc/bus/usb
250 if [ "$usb" = "1" ]; then
251 needusbstorage=$(LC_ALL=C cat /proc/bus/usb/devices 2>/dev/null|grep -e "^I.*Cls=08" 2>/dev/null)
252 if [ "$(kernelverser)" -lt "002006" ]; then
253 LC_ALL=C grep -q 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd "Initializing USB HID interface" modprobe hid 2> /dev/null
254 mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02" 2>/dev/null)
255 kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01" 2>/dev/null)
256 if [ -n "$kbdoutput" ]; then
257 run_cmd "Initializing USB keyboard" modprobe keybdev
259 if [ -n "$mouseoutput" ]; then
260 run_cmd "Initializing USB mouse" modprobe mousedev
265 # Setup hdparm thing (if exists and is needed)
266 if ! grep -iq nohdparm /proc/cmdline 2>/dev/null; then
267 [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
270 if [ -f /fastboot ] || grep -iq "fastboot" /proc/cmdline 2>/dev/null ; then
276 if [ -f /fsckoptions ]; then
277 fsckoptions=$(cat /fsckoptions)
282 if [ -f /forcefsck ]; then
283 fsckoptions="-f $fsckoptions"
287 _ROOTFS_TYPE=$(grep " / " /proc/mounts 2>/dev/null | awk '{ print $3 }')
289 if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" ]; then
290 show "Checking root filesystem"; started
291 initlog -c "fsck -C -T -a $fsckoptions /"
295 # A return of 4 or higher means there were serious problems.
296 if [ $rc -gt 3 ]; then
297 [ -e /proc/splash ] && echo "verbose" > /proc/splash
298 # don't use '\n' in nls macro !
301 nls "*** An error occurred during the file system check."
302 nls "*** Dropping you to a shell; the system will reboot"
303 nls "*** when you leave the shell."
306 PS1="$(nls '(Repair filesystem)# ')"; export PS1
307 [ "$SELINUX" = "1" ] && disable_selinux
308 if is_yes "$RUN_SULOGIN_ON_ERR"; then
314 run_cmd "Unmounting file systems" umount -a
315 mount -n -o remount,ro /
316 run_cmd "Automatic reboot in progress" reboot
317 # A return of 2 or 3 means that filesystem was repaired but we need
319 elif [ "$rc" = "2" -o "$rc" = "3" ]; then
320 [ -e /proc/splash ] && echo "verbose" > /proc/splash
322 nls "*** Filesystem was repaired but system needs to be"
323 nls "*** rebooted before mounting it."
324 nls "*** REBOOTING ***"
327 run_cmd "Unmounting file systems" umount -a
328 mount -n -o remount,ro /
329 run_cmd "Automatic reboot in progress" reboot
330 elif [ "$rc" = "1" ]; then
335 # Unmount the initrd, if necessary
336 if LC_ALL=C grep -q /initrd /proc/mounts 2>/dev/null && ! LC_ALL=C grep -q /initrd/loopfs /proc/mounts 2>/dev/null ; then
337 if [ -e /initrd/dev/.devfsd ]; then
341 /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
344 # Check for arguments
345 if grep -iq nopnp /proc/cmdline 2>/dev/null; then
351 # set up pnp and kernel pnp
352 if [ -n "$PNP" ]; then
353 if is_yes "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
354 run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
356 if is_yes "$RUN_KERNELPNP"; then
357 /sbin/modprobe -k isa-pnp 2> /dev/null
358 if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
359 show "Setting up ISA PNP devices (kernelspace pnp)"; busy
360 grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail)
365 # Remount the root filesystem read-write
366 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
368 # Update quotas if fsck was run on /
369 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
370 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
373 # Clean up SELinux labels
374 if [ -n "$SELINUX" ]; then
375 for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache ; do
376 [ -r $file ] && restorecon $file >/dev/null 2>&1
381 # Remove stale backups
382 rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~
384 # Remove /etc/nologin when starting system
385 [ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
387 if is_yes "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
388 show "Enabling Delay Login"; busy
390 nls "System bootup in progress - please wait" >> /etc/nologin
392 chmod 644 /etc/nologin
393 cp -fp /etc/nologin /etc/nologin.boot
397 # The root filesystem is now read-write, so we can now log via
398 # syslog() directly...
399 if [ -n "$IN_INITLOG" ]; then
403 if ! is_yes "$VSERVER"; then
406 [ -f /etc/cryptomtab ] && :>/etc/cryptomtab
408 # Enter root, /proc, /sys, devfs and other into mtab.
411 [ -f /proc/bus/usb/devices ] && mount -f -t usbfs usbfs /proc/bus/usb
412 [ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev
414 if grep -q sysfs /proc/filesystems 2>/dev/null ; then
415 mount -f -t sysfs sysfs /sys
416 if [ "$(kernelver)" -ge "002006014" ] && \
417 grep -q securityfs /proc/filesystems 2>/dev/null ; then
418 mount -f -t securityfs securityfs /sys/kernel/security
422 if grep -q selinuxfs /proc/filesystems 2>/dev/null ; then
423 mount -f -t selinuxfs selinuxfs /selinux
426 if grep -q cpuset /proc/filesystems 2>/dev/null ; then
427 mount -f -t cpuset none /dev/cpuset
430 if [ ! -f /proc/modules ]; then
432 elif ! grep -iq nomodules /proc/cmdline 2>/dev/null; then
438 # Adjust symlinks as necessary in /boot to keep system services from
439 # spewing messages about mismatched System maps and so on.
440 if is_yes "$SET_SLINKS"; then
441 if [ -L /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
442 ln -s -f System.map-`uname -r` /boot/System.map
444 if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
445 ln -s -f System.map-`uname -r` /boot/System.map
449 # Run depmod if RUN_DEPMOD != "no" and:
450 # a) user requested or RUN_DEPMOD="";
451 # b) modules.dep is missing
452 # c) modules.dep is older than /etc/modules.conf or /lib/modules/`uname -r`
453 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
454 if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
455 run_cmd "Finding module dependencies" depmod -a
456 elif [ "$RUN_DEPMOD" = "ifmissing" ]; then
457 run_cmd "Finding module dependencies" depmod -A
461 if [ -f /proc/sys/kernel/modprobe ]; then
462 if [ -n "$USEMODULES" ]; then
463 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
465 # We used to set this to NULL, but that causes
466 # 'failed to exec' messages"
467 sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
471 # Load usb storage here, to match most other things
472 if [ -n "$needusbstorage" ]; then
473 modprobe -k usb-storage >/dev/null 2>&1
476 # Load firewire devices
477 if ! grep -iq "nofirewire" /proc/cmdline 2>/dev/null ; then
478 aliases=$(/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print $3 }')
479 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
480 for alias in $aliases ; do
481 [ "$alias" = "off" ] && continue
482 run_cmd "$(nls 'Initializing firewire controller') ($alias)" /sbin/modprobe $alias
484 LC_ALL=C grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && /sbin/modprobe -s sbp2 > /dev/null 2>&1
488 # Load sound modules if they need persistent DMA buffers
489 if grep -q "^options sound dmabuf=1" "$MODULES_CONF" 2>/dev/null ; then
491 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
492 if [ -n "$alias" -a "$alias" != "off" ] ; then
493 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
496 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound-slot-0[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
497 if [ -n "$alias" -a "$alias" != "off" ] ; then
498 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
504 if [ -x /etc/rc.d/rc.modules ]; then
508 # Find and activate volume groups:
510 if [ -x /sbin/evms_activate ]; then
511 if [ "$(kernelverser)" -lt "002006" ]; then
512 # Linux 2.4 core modules
513 modprobe -s -k evms > /dev/null 2>&1
514 modprobe -s -k evms_passthru > /dev/null 2>&1
515 modprobe -s -k ldev_mgr > /dev/null 2>&1
516 modprobe -s -k dos_part > /dev/null 2>&1
518 # Linux 2.6 core module
519 modprobe -s -k evmscore > /dev/null 2>&1
522 is_yes "$EVMS_GUID_PTABLE" && modprobe -s -k gpt_part >/dev/null 2>&1
523 is_yes "$EVMS_LVM" && modprobe -s -k lvm_vge >/dev/null 2>&1
524 is_yes "$EVMS_AIX" && modprobe -s -k AIXlvm_vge >/dev/null 2>&1
525 is_yes "$EVMS_OS2" && modprobe -s -k os2lvm_vge >/dev/null 2>&1
526 run_cmd "Discovering EVMS volumes" /sbin/evms_activate
527 if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
528 # Link nodes for compatibility with LVM
529 if [ "echo /dev/evms/lvm/*" != '/dev/evms/lvm/*' ] ; then
530 ln -s /dev/evms/lvm/* /dev/
534 # LVM (keep in sync with LVM starting after RAID run!)
535 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
536 lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk '{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version: ",""); gsub(/\..*/,"");print $1; exit}')
537 if [ "$lvmversion" = "1" ] ; then
538 modprobe -s -k lvm-mod >/dev/null 2>&1
540 elif [ "$lvmversion" = "2" ] ; then
541 modprobe -s -k dm-mod >/dev/null 2>&1
542 lvmignorelock="--ignorelockingfailure"
544 modprobe -s -k lvm-mod >/dev/null 2>&1
545 # device mapper (2.5+ and patched 2.4)
546 modprobe -s -k dm-mod >/dev/null 2>&1
550 run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelock && \
551 run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmignorelock
552 [ "$lvmversion" = "2" ] && /sbin/vgscan --mknodes $lvmignorelock > /dev/null 2>&1
557 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ] || [ -f /etc/raidtab ]; then
558 modprobe -s md >/dev/null 2>&1
559 if [ -f /proc/mdstat ]; then
563 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
564 if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 2>/dev/null); then
565 run_cmd "Starting up RAID devices" /sbin/mdadm --assemble --scan --auto=yes
567 [ "$rc" -eq 0 ] && goraidtab=0 && golvm=1
571 if [ -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
572 for i in $(grep -v "^#" /etc/raidtab 2>/dev/null | grep "raiddev" 2>/dev/null | awk '{print $2}') ; do
574 RAIDDEV=$(basename $i)
575 RAIDSTAT=$(grep "^$RAIDDEV : active" /proc/mdstat 2>/dev/null)
576 show "Starting up RAID device %s" $RAIDDEV
578 if [ -z "$RAIDSTAT" ]; then
579 # Try raidstart first...if that fails then
580 # fall back to raid0run and if that fails too
581 # fall back to raidadd, raidrun.
583 if [ -x /sbin/raidstart ]; then
587 if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
591 if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x /sbin/raidrun ]; then
596 if [ $RESULT -gt 0 ]; then
608 # A non-zero return means there were problems
609 if [ $rc -gt 0 ]; then
610 [ -e /proc/splash ] && echo "verbose" > /proc/splash
611 show "Starting up RAID devices"; fail
614 nls "*** An error occurred during the RAID startup."
615 nls "*** Dropping you to a shell; the system will reboot"
616 nls "*** when you leave the shell."
619 PS1="$(nls '(RAID Repair)# ')"; export PS1
620 [ "$SELINUX" = "1" ] && disable_selinux
621 if is_yes "$RUN_SULOGIN_ON_ERR"; then
627 run_cmd "Unmounting file systems" umount -a
628 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
629 run_cmd "Automatic reboot in progress" reboot
631 # LVM on RAID (keep in sync with LVM setting few lines above)
632 if [ "$golvm" -eq "1" ]; then
633 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
634 run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelock && \
635 run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmignorelock
636 [ "$lvmversion" = "2" ] && /sbin/vgscan --mknodes $lvmignorelock > /dev/null 2>&1
639 show "Starting up RAID devices"; ok
645 if [ -z "$fastboot" ] && ! grep -q nofsck /proc/cmdline 2>/dev/null; then
646 rc_splash "fsck start"
647 show "Checking filesystems"; started
648 initlog -c "fsck -C -T -R -A -a $fsckoptions"
652 # A return of 2 or higher means there were serious problems
653 if [ $rc -gt 1 ]; then
654 [ -e /proc/splash ] && echo "verbose" > /proc/splash
657 nls "*** An error occurred during the file system check."
658 nls "*** Dropping you to a shell; the system will reboot"
659 nls "*** when you leave the shell."
662 PS1="$(nls '(Repair filesystem)# ')"; export PS1
663 [ "$SELINUX" = "1" ] && disable_selinux
664 if is_yes "$RUN_SULOGIN_ON_ERR"; then
670 run_cmd "Unmounting file systems" umount -a
671 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
672 run_cmd "Automatic reboot in progress" reboot
673 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
676 rc_splash "fsck stop"
679 # Mount all other filesystems (except for NFS and /proc, which is already
680 # mounted). Contrary to standard usage,
681 # filesystems are NOT unmounted in single user mode.
683 run_cmd "Mounting local filesystems" mount -a -t nonfs,smbfs,ncpfs,proc,cifs -O no_netdev
685 # Now do some workaround - encrypted filesystems couldn't have been fsck-ed
686 # before mount - that's where the password is entered.
687 # mount is buggy - when remounting loopback filesystem, loop=XXX
688 # option is removed from /etc/mtab
689 if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
690 show "Checking encrypted filesystems"; started
692 FILENAME=="/proc/mounts" {
695 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ {
696 if ($2 in TAB){print TAB[$2];}
698 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
699 if ($2 in TAB){print TAB[$2];}
700 sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
701 cmd="mount " $2 " -o remount," $4;
704 ' /proc/mounts /etc/fstab)"
705 initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
708 # A return of 2 or higher means there were serious problems.
709 if [ $rc -gt 1 ]; then
710 [ -e /proc/splash ] && echo "verbose" > /proc/splash
713 nls "*** An error occurred during the file system check."
714 nls "*** Dropping you to a shell; the system will reboot"
715 nls "*** when you leave the shell."
718 PS1="`nls '(Repair filesystem)# '`"; export PS1
719 [ "$SELINUX" = "1" ] && disable_selinux
720 if is_yes "$RUN_SULOGIN_ON_ERR"; then
726 run_cmd "Unmounting file systems" umount -a
727 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
728 run_cmd "Automatic reboot in progress" reboot
729 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
733 show "Remounting encrypted filesystems back in rw mode"; busy
735 FILENAME=="/proc/mounts" {
738 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
739 sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
740 cmd="mount " $2 " -o remount," $4;
743 ' /proc/mounts /etc/fstab
748 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
749 run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa
753 if [ -x /sbin/quotaon ]; then
754 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
757 # Turn on process accounting
758 if [ -x /etc/rc.d/rc.acct ]; then
759 /etc/rc.d/rc.acct start
762 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
763 if is_yes "$TIME_SETUP_DELAYED"; then
764 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
765 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
769 # Initialize the serial ports
770 if [ -f /etc/rc.d/rc.serial ]; then
771 . /etc/rc.d/rc.serial
774 if [ -f /proc/sys/kernel/panic -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
775 show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
776 if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME >/dev/null 2>&1); then ok; else fail; fi
779 # ... and here finish configuring parameters
780 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
785 [ -n "$SELINUX" ] && [ -f /.autorelabel ] && relabel_selinux
788 rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff
791 # I'd use find, but /usr may not be mounted.
792 for afile in /var/lock/* /var/run/*; do
793 bafile=$(basename $afile)
794 if [ -d "$afile" ]; then
795 [ "$bafile" != "news" -a "$bafile" != "sudo" -a "$bafile" != "mon" ] && rm -rf $afile/*
797 [ "$bafile" != "hwprofile" ] && rm -f $afile 2> /dev/null
801 rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \
802 /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
803 rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
804 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
805 /tmp/scrollkeeper-* /tmp/ssh-*
809 if ! is_no "$NEED_XFILES" ; then
812 chown root:utmp /var/run/utmpx /var/log/wtmpx
813 chmod 0664 /var/run/utmpx /var/log/wtmpx
817 chown root:utmp /var/run/utmp /var/log/wtmp
818 chmod 0664 /var/run/utmp /var/log/wtmp
822 if is_yes "$CLEAN_TMP"; then
823 rm -rf /tmp/* /tmp/.[a-zA-Z0-9]*
826 # System protected dirs
827 mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1
828 chown root:root /tmp/.ICE-unix
829 [ -n "$SELINUX" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1
831 if ! is_yes "$VSERVER"; then
832 # Right, now turn on swap in case we swap to files
833 swapon -a >/dev/null 2>&1
834 run_cmd "Enabling swap space" /bin/true
836 # If a SCSI tape has been detected, load the st module unconditionally
837 # since many SCSI tapes don't deal well with st being loaded and unloaded
838 if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
839 if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
840 if [ -n "$USEMODULES" ] ; then
841 # Try to load the module. If it fails, ignore it...
842 insmod -p st >/dev/null 2>&1 && modprobe -s st >/dev/null 2>&1
847 # Now that we have all of our basic modules loaded and the kernel going,
848 # let's dump the syslog ring somewhere so we can find it later
849 dmesg -s 131072 > /var/log/dmesg
851 while [ $i -ge 0 ]; do
852 if [ -f /var/log/dmesg.$i ]; then
853 chmod 0600 /var/log/dmesg.$i
854 mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
858 cp -f /var/log/dmesg /var/log/dmesg.0
859 chmod 0600 /var/log/dmesg /var/log/dmesg.0
862 kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
864 if ! is_no "$RC_PROMPT"; then
865 /sbin/getkey -c 5 i && touch /var/run/confirm
870 # This must be last line !