3 # /etc/rc.d/rc.sysinit - run once at boot time
5 # Taken in part from Miquel van Smoorenburg's bcheckrc.
8 # reasonable start values for bootsplash progress.
14 if [ -r /etc/sysconfig/i18n ]; then
16 [ -n "$LANG" ] && export LANG || unset LANG
17 [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
18 [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
19 [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
20 [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
21 [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
22 [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
23 [ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL
24 [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
25 [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
28 # Read network config data
29 if [ -r /etc/sysconfig/network ]; then
30 . /etc/sysconfig/network
39 . /lib/rc-scripts/functions
43 if [ "$modprobe_c_cache" ]; then
44 echo "$modprobe_c_cache"
48 # filter only what is wanted by this script: aliases and options
49 modprobe_c_cache=$(modprobe -c | grep -E '^(alias|options)')
52 # parse kernel cmdline
56 read cmdline < /proc/cmdline
58 for arg in $cmdline; do
61 # default is set in /etc/sysconfig/system
65 # default is set in /etc/sysconfig/system
69 # default is set in /etc/sysconfig/system
73 # default is set in /etc/sysconfig/system
101 # resolve a device node to its major:minor numbers in decimal or hex
103 local dev=$1 enc=${2:-hex} res
105 res=$(stat -Lc "%t:%T" "$dev")
106 if [ "$enc" = dec ]; then
111 res=$((0x$1)):$((0x$2))
116 # setup SELINUX variable
119 if is_no "$SELINUX"; then
123 if ! grep -Fq selinuxfs /proc/filesystems; then
124 # no support in kernel, no chance
126 elif ! is_fsmounted selinuxfs /selinux; then
127 mount -n -o gid=17 -t selinuxfs selinuxfs /selinux
130 # Check SELinux status
131 local selinuxfs=$(awk '/ selinuxfs / { print $2 }' /proc/mounts 2> /dev/null)
133 if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
134 if [ -r $selinuxfs/enforce ] ; then
135 SELINUX=$(cat $selinuxfs/enforce)
137 # assume enforcing if you can't read it
144 local _d selinuxfs _t _r
146 while read _d selinuxfs _t _r; do
147 [ "$_t" = "selinuxfs" ] && break
149 echo "*** Warning -- SELinux is active"
150 echo "*** Disabling security enforcement for system recovery."
151 echo "*** Run 'setenforce 1' to reenable."
152 echo "0" > $selinuxfs/enforce
156 local _d selinuxfs _t _r
158 while read _d selinuxfs _t _r; do
159 [ "$_t" = "selinuxfs" ] && break
162 *** Warning -- SELinux relabel is required. ***
163 *** Disabling security enforcement. ***
164 *** Relabeling could take a very long time, ***
165 *** depending on file system size. ***
167 echo "0" > $selinuxfs/enforce
168 /sbin/fixfiles -F relabel > /dev/null 2>&1
170 echo "*** Enabling security enforcement. ***"
171 echo $SELINUX > $selinuxfs/enforce
174 # Enable automatic swapon of all partitions with the proper swap magic.
175 # This allows setting up swap without editing /etc/fstab.
177 local swappartitions=$(blkid -t TYPE=swap -o device)
178 if [ -z "$swappartitions" ]; then
182 local curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do echo -n " "; get_numeric_dev $x; echo -n " "; done)
185 for partition in $swappartitions; do
186 [ ! -e $partition ] && continue
187 majmin=$(get_numeric_dev $partition)
188 if ! strstr "$curswap" " $majmin "; then
189 run_cmd "$(nls 'Enabling local swap partitions: %s' $partition)" swapon $partition
196 run_cmd "Activating swap" swapon -a "$@"
197 is_yes "$AUTOSWAP" && enable_autoswap
200 # Remove duplicate entries from mtab (for vserver guest use only)
201 clean_vserver_mtab() {
203 while read device mountpoint line; do
204 grep -qs "$mountpoint" /etc/mtab.clean || \
205 echo "$device $mountpoint $line" >> /etc/mtab.clean
207 cat /etc/mtab.clean > /etc/mtab
208 rm -f /etc/mtab.clean
211 # Loads modules from /etc/modules, /etc/modules.X.Y and /etc/modules.X.Y.Z
212 load_kernel_modules() {
213 local modules_file=$1
214 local _x _y _z v v1 old_IFS kernel kerneleq
218 # strip _* or -* from versions like: "2.6.25_vanilla-1", "2.6.25-1"
231 # Loop over every line in modules file
233 grep -hvE '^(#|[[:blank:]]*$)' /etc/$modules_file /etc/$modules_file.$kernel /etc/$modules_file.$kerneleq 2>/dev/null
234 echo '' # make sure there is a LF at the end
235 ) | while read module args; do
236 [ -z "$module" ] && continue
239 show "Loading %s kernel module(s)" "$module"
241 modprobe -s $module -- $args && ok || fail
245 # launch repair shell
246 # which after exiting will reboot
250 # don't use '\n' in nls macro !
254 nls "*** Dropping you to a shell; the system will reboot"
255 nls "*** when you leave the shell."
258 [ "$SELINUX" = "1" ] && disable_selinux
259 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
265 run_cmd "Unmounting file systems" umount -a
266 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
267 run_cmd "Automatic reboot in progress" reboot
271 show "Checking root filesystem"; started
272 initlog -c "fsck -C -T -a $fsckoptions /"
275 # A return of 4 or higher means there were serious problems.
276 if [ $rc -gt 3 ]; then
277 [ -e /proc/splash ] && echo "verbose" > /proc/splash
279 PS1="$(nls '(Repair filesystem)# ')"; export PS1
280 repair_shell "$(nls '*** An error occurred during the file system check.')"
282 # A return of 2 or 3 means that filesystem was repaired but we need
284 elif [ "$rc" = "2" -o "$rc" = "3" ]; then
285 [ -e /proc/splash ] && echo "verbose" > /proc/splash
287 nls "*** Filesystem was repaired but system needs to be"
288 nls "*** rebooted before mounting it."
289 nls "*** REBOOTING ***"
292 run_cmd "Unmounting file systems" umount -a
293 mount -n -o remount,ro /
294 run_cmd "Automatic reboot in progress" reboot
295 elif [ "$rc" = "1" ]; then
300 # Init software RAID arrays
304 if [ ! -x /sbin/mdadm ]; then
309 if [ ! -f /proc/mdstat ]; then
313 show "Starting up RAID devices"; busy
314 output=$(/sbin/mdadm --assemble --scan 2>&1)
317 if [ -n "$output" ]; then
324 if [ ! -x /sbin/vgscan -o ! -x /sbin/vgchange ] && ! is_yes "$EVMS_LVM"; then
328 if is_no "$LVM2"; then
329 lvmversion=$(LC_ALL=C /sbin/vgchange --version 2>/dev/null | awk '/LVM version:/{if ($3 >= 2) print "2"}')
334 if [ "$lvmversion" = "1" ] ; then
338 elif [ "$lvmversion" = "2" ] ; then
340 lvmignorelocking="--ignorelockingfailure"
341 lvmsysinit="--sysinit"
344 # device mapper (2.5+ and patched 2.4)
350 run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelocking
351 run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmsysinit
353 if [ "$lvmversion" = "2" ]; then
354 # silently refresh LV /dev nodes (just in case)
355 /sbin/vgmknodes $lvmignorelocking 1>/dev/null 2>&1
356 # display VG statistics
357 /sbin/vgdisplay -s $lvmignorelocking
361 # boot logging to /var/log/boot.log. install showconsole package to get it.
362 if ! is_no "$RC_BOOTLOG" && [ -x /sbin/blogd ]; then
368 if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
369 # we need /proc mounted before everything
370 is_fsmounted proc /proc || mount -n /proc || mount -n -o gid=17,hidepid=2 -t proc /proc /proc
375 is_fsmounted tmpfs /run || mount -n -t tmpfs run /run -o mode=0755,noexec,nosuid,nodev
381 # sysfs is also needed before any other things (under kernel > 2.5)
382 if ! is_fsmounted sysfs /sys; then
383 grep -Fq sysfs /proc/filesystems && mount -n -o gid=17 -t sysfs sysfs /sys
385 if grep -Fq securityfs /proc/filesystems; then
386 mount -n -t securityfs securityfs /sys/kernel/security
388 if [ -d /sys/firmware/efi ] && ! is_fsmounted efivarfs /sys/firmware/efi/efivars; then
389 mount -n -o rw -t efivarfs efivarfs /sys/firmware/efi/efivars
394 # Choose Hardware profile
395 if ! is_no "$HWPROFILES" && [ -f /etc/sysconfig/hwprof ]; then
396 . /etc/sysconfig/hwprof
397 if is_yes "${HWPROFILES}" && [ -x /sbin/hwprofile -a -d /etc/sysconfig/hwprofiles/data ]; then
398 mount -n / -o rw,remount
400 mount -n / -o ro,remount
404 # Disable splash when requested
405 is_no "$BOOT_SPLASH" && [ -e /proc/splash ] && echo "0" > /proc/splash
407 if [ -x /sbin/restorecon ] && is_fsmounted tmpfs /dev; then
408 /sbin/restorecon -R /dev 2>/dev/null
411 [ -z "${CONSOLETYPE}" ] && CONSOLETYPE="$(/sbin/consoletype)"
413 if [ "$CONSOLETYPE" = "vt" -a -x /sbin/setsysfont ]; then
419 # Print welcome message
420 nls "\t\t\t%sPowered by %sTLD Linux%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CTLD)" "$(termput op)"
421 if ! is_no "$RC_PROMPT"; then
422 nls -n "\t\t Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
427 if [ -z "${HOSTNAME}" ]; then
428 show "$(nls 'Host:') $(hostname)"; ok
430 run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
433 # Set the NIS domain name
434 if [ -n "$NISDOMAIN" ]; then
435 run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
440 if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
441 # Set console loglevel
442 if [ -n "$CONSOLE_LOGLEVEL" ]; then
443 dmesg -n $CONSOLE_LOGLEVEL
446 if ! is_no "$START_UDEV" && [ -x /sbin/start_udev ] && [[ "$container" != lxc* ]]; then
447 is_fsmounted devtmpfs /dev || mount -n -t devtmpfs devtmpfs /dev
448 load_kernel_modules modules.preudev
450 elif [ -x /lib/firmware/firmware-loader.sh ]; then
451 /sbin/sysctl -q -e -w kernel.hotplug=/lib/firmware/firmware-loader.sh
454 # Unmount the initrd, if necessary
455 if grep -q /initrd /proc/mounts 2>/dev/null && ! grep -q /initrd/loopfs /proc/mounts 2>/dev/null; then
456 umount /initrd/dev 2>/dev/null
458 /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
461 # Start logging console output since we have all /dev stuff setup
462 if [ "$RC_BOOTLOG" ]; then
466 # Configure Linux kernel (initial configuration, some required modules still may be missing).
469 # Check if timezone definition is available
470 if [ -e /etc/localtime ] && [ -e /dev/rtc -o -e /dev/rtc0 ] ; then
471 if run_cmd "$(nls 'Setting clock')" hwclock --hctosys; then
472 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
475 TIME_SETUP_DELAYED=yes
479 if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then
480 # XXX might need modules dep
481 # Device mapper & related initialization
482 if ! grep -qF device-mapper /proc/devices; then
486 . /etc/rc.d/init.d/cryptsetup
487 show "Starting disk encryption"
490 [ $delay_cryptsetup = 0 ] && ok || fail
496 # Initialize USB controllers
498 if [ -z "$nousb" ] && ! is_fsmounted usbfs /proc/bus/usb; then
499 aliases=$(modprobe_c | awk '/^alias[[:space:]]+usb[-_]controller[[:space:]]+/{ print $3 }')
500 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
502 for alias in $aliases ; do
503 [ "$alias" = "off" ] && continue
504 run_cmd "$(nls 'Initializing USB controller') ($alias)" modprobe -s $alias
506 [ $? -eq 0 -a -n "$aliases" ] && usb=1
508 if grep -iq "usb" /proc/devices 2>/dev/null ; then
513 if [ "$usb" = "1" -a -d /proc/bus/usb ] && ! is_fsmounted usbfs /proc/bus/usb; then
514 run_cmd "Mounting USB filesystem" mount -n -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb
518 if [ "$usb" = "1" ]; then
519 needusbstorage=$(cat /proc/bus/usb/devices 2>/dev/null | grep -e "^I.*Cls=08" 2>/dev/null)
520 if [ "$(kernelverser)" -lt "002006" ]; then
521 grep -Fq 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd "Initializing USB HID interface" modprobe -s hid
522 mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02" 2>/dev/null)
523 kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01" 2>/dev/null)
524 if [ -n "$kbdoutput" ]; then
525 run_cmd "Initializing USB keyboard" modprobe -s keybdev
527 if [ -n "$mouseoutput" ]; then
528 run_cmd "Initializing USB mouse" modprobe -s mousedev
533 # Setup hdparm thing (if exists and is needed)
534 if [ -z "$nohdparm" ]; then
535 [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
538 if [ -z "$fastboot" ] && [ -f /fastboot ]; then
542 if [ -f /fsckoptions ]; then
543 fsckoptions=$(cat /fsckoptions)
548 if [ -f /forcefsck ]; then
549 fsckoptions="-f $fsckoptions"
551 # Obey the fs_passno setting for / (see fstab(5))
553 # - make sure we have at least 6 fields
554 _ROOTFS_PASSNO=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $6}' /etc/fstab)
558 _ROOTFS_DEVICE=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $1}' /etc/fstab)
559 _ROOTFS_TYPE=$(awk '$2 == "/" && $3 != "rootfs" { print $3 }' /proc/mounts 2>/dev/null)
561 if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "aufs" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" -a "$_ROOTFS_TYPE" != "tmpfs" -a "$_ROOTFS_TYPE" != "squashfs" -a "$_ROOTFS_PASSNO" != 0 -a -e $_ROOTFS_DEVICE ] && [[ "$container" != lxc* ]]; then
565 # set up pnp and kernel pnp
566 if is_yes "$RUN_USERPNP" || is_yes "$RUN_KERNELPNP"; then
567 if [ -z "$nopnp" ] && is_yes "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
568 run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
570 if [ -z "$nopnp" ] && is_yes "$RUN_KERNELPNP"; then
572 if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
573 show "Setting up ISA PNP devices (kernelspace pnp)"; busy
574 grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail)
579 _ROOTFS_RO=$(awk '($1 !~ /^#/ && $2 == "/" && ($4 == "ro" || $4 ~ /,ro$/ || $4 ~ /^ro,/ || $4 ~ /,ro,/ ) && NF >= 6) { print "ro" }' /etc/fstab)
580 # Remount the root filesystem read-write
581 if [ -z "$_ROOTFS_RO" ]; then
582 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
585 # Update quotas if fsck was run on /
586 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
587 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
590 # Clean up SELinux labels
591 if is_yes "$SELINUX"; then
592 for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache; do
593 [ -r $file ] && restorecon $file >/dev/null 2>&1
597 if [ "$delay_cryptsetup" != 0 ]; then
598 show "Starting disk encryption using the RNG"
601 [ $delay_cryptsetup = 0 ] && ok || fail
604 # Start logging console output since we have all /dev stuff setup
605 if [ "$RC_BOOTLOG" ]; then
610 # Remove stale backups
611 rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~ >/dev/null 2>&1
613 # Remove /etc/nologin when starting system
614 [ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
616 if ! is_no "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
617 show "Enabling Delay Login"; busy
619 nls "System bootup in progress - please wait" >> /etc/nologin
621 chmod 644 /etc/nologin
622 cp -fp /etc/nologin /etc/nologin.boot
626 # The root filesystem is now read-write, so we can now log via
627 # syslog() directly...
628 if [ -n "$IN_INITLOG" ]; then
632 if ! is_yes "$VSERVER" && [[ "$container" != lxc* ]]; then
635 [ -f /etc/cryptomtab ] && > /etc/cryptomtab
637 # Enter root, /proc, /sys and other into mtab.
638 mount -f / 2> /dev/null
639 mount -f /proc 2> /dev/null
640 if is_fsmounted devtmpfs /dev; then
641 mount -f -t devtmpfs devtmpfs /dev 2> /dev/null
643 if is_fsmounted tmpfs /run; then
644 mount -f -t tmpfs run /run -o mode=0755,noexec,nosuid,nodev 2> /dev/null
647 if is_fsmounted usbfs /proc/bus/usb; then
648 mount -f -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb 2> /dev/null
651 if is_fsmounted sysfs /sys; then
652 mount -f -t sysfs sysfs /sys 2> /dev/null
653 if is_fsmounted securityfs /sys/kernel/security ; then
654 mount -f -t securityfs securityfs /sys/kernel/security 2> /dev/null
656 if [ -d /sys/firmware/efi ] && is_fsmounted efivarfs /sys/firmware/efi/efivars ; then
657 mount -f -t efivarfs efivarfs /sys/firmware/efi/efivars 2> /dev/null
661 if is_fsmounted selinuxfs /selinux; then
662 mount -f -t selinuxfs selinuxfs /selinux 2> /dev/null
665 if [ ! -f /proc/modules ]; then
667 elif [ -z "$nomodules" ]; then
674 # Adjust symlinks as necessary in /boot to keep system services from
675 # spewing messages about mismatched System maps and so on.
676 if ! is_no "$SET_SLINKS"; then
677 if [ -L /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
678 ln -s -f System.map-$uname_r /boot/System.map
680 if [ ! -e /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
681 ln -s -f System.map-$uname_r /boot/System.map
685 # Run depmod if RUN_DEPMOD != "no" and:
686 # a) user requested or RUN_DEPMOD="";
687 # b) modules.dep is missing
688 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
689 if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
690 run_cmd "Finding module dependencies" depmod -a
691 elif [ "$RUN_DEPMOD" = "ifmissing" ] && [ ! -f /lib/modules/$uname_r/modules.dep ]; then
692 run_cmd "Finding module dependencies" depmod -A
697 if [ -f /proc/sys/kernel/modprobe ]; then
698 if [ -n "$USEMODULES" ]; then
699 sysctl -q -w kernel.modprobe="/sbin/modprobe"
701 # We used to set this to NULL, but that causes
702 # 'failed to exec' messages"
703 sysctl -q -w kernel.modprobe="/bin/true"
707 # Load usb storage here, to match most other things
708 if [ -n "$needusbstorage" ]; then
709 modprobe -s usb-storage
712 # Load firewire devices
713 if [ -z "$nofirewire" ]; then
714 aliases=$(modprobe_c | awk '/^alias[[:space:]]+ieee1394[-_]controller[[:space:]]+/{ print $3 }')
715 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
716 for alias in $aliases ; do
717 [ "$alias" = "off" ] && continue
718 run_cmd "$(nls 'Initializing firewire controller') ($alias)" modprobe $alias
720 grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && modprobe -s sbp2
724 # Load sound modules if they need persistent DMA buffers
725 if modprobe_c | grep -q "^options sound dmabuf=1"; then
727 alias=$(modprobe_c | awk '/^alias[[:space:]]+sound[[:space:]]+/{ print $3 }')
728 if [ -n "$alias" -a "$alias" != "off" ] ; then
729 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
732 alias=$(modprobe_c | awk '/^alias[[:space:]]+sound[-_]slot[-_]0[[:space:]]+/ { print $3 }')
733 if [ -n "$alias" -a "$alias" != "off" ] ; then
734 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
740 load_kernel_modules modules
741 for f in /etc/modules-load.d/*.conf; do
742 # already loaded by implicit "modules" load
743 [ "${f##*/}" = "modules.conf" ] && continue
745 [ -r $f ] || continue
746 load_kernel_modules ${f##/etc/}
749 if ! is_no "$DM_MULTIPATH" && [ -x /sbin/multipath ]; then
751 modprobe -s dm-multipath
752 # make nodes that were discarded due (possible) new /dev mount
753 /sbin/dmsetup mknodes
754 run_cmd "Activating dm-multipath" /sbin/multipath -v 0
755 /sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a -p p'
758 if ! is_no "$DMRAID" && [ -x /sbin/dmraid ]; then
759 run_cmd "Activating ATARAID devices" /sbin/dmraid -ay
762 # Find and activate volume groups:
764 if is_yes "$EVMS_LVM" && [ -x /sbin/evms_activate ]; then
765 if [ "$(kernelverser)" -lt "002006" ]; then
766 # Linux 2.4 core modules
768 modprobe -s evms_passthru
772 # Linux 2.6 core module
776 is_yes "$EVMS_GUID_PTABLE" && modprobe -s gpt_part
777 is_yes "$EVMS_LVM" && modprobe -s lvm_vge
778 is_yes "$EVMS_AIX" && modprobe -s AIXlvm_vge
779 is_yes "$EVMS_OS2" && modprobe -s os2lvm_vge
780 run_cmd "Discovering EVMS volumes" /sbin/evms_activate
781 if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
782 # Link nodes for compatibility with LVM
783 if [ "$(echo /dev/evms/lvm/*)" != '/dev/evms/lvm/*' ] ; then
784 ln -s /dev/evms/lvm/* /dev
789 if ! is_no "$MDADM"; then
793 if ! is_no "$LVM2"; then
797 if [ "$delay_cryptsetup" != 0 ]; then
798 show "Starting disk encryption"
801 [ $delay_cryptsetup = 0 ] && ok || fail
806 if [ -z "$fastboot" ] && [ -z "$nofsck" ]; then
807 rc_splash "fsck start"
808 show "Checking filesystems"; started
809 initlog -c "fsck -C -T -R -A -a -P $fsckoptions"
813 # A return of 2 or higher means there were serious problems
814 if [ $rc -gt 1 ]; then
815 [ -e /proc/splash ] && echo "verbose" > /proc/splash
817 PS1="$(nls '(Repair filesystem)# ')"; export PS1
818 repair_shell "$(nls '*** An error occurred during the file system check.')"
820 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
823 rc_splash "fsck stop"
826 # Mount all other filesystems (except for NFS and /proc, which is already
827 # mounted). Contrary to standard usage,
828 # filesystems are NOT unmounted in single user mode.
829 run_cmd "Mounting local filesystems" mount -a -t nonfs,nfs4,smbfs,ncpfs,proc,cifs -O no_netdev
831 # now we have /usr mounted, recheck if we have gettext and tput available.
832 if is_no "$TPUT"; then
838 # Now do some workaround - encrypted filesystems couldn't have been fsck-ed
839 # before mount - that's where the password is entered.
840 # mount is buggy - when remounting loopback filesystem, loop=XXX
841 # option is removed from /etc/mtab
842 if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
843 show "Checking encrypted filesystems"; started
844 LOOPLIST="$(LC_ALL=C awk '
845 FILENAME=="/proc/mounts" {
848 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ {
849 if ($2 in TAB){print TAB[$2];}
851 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
852 if ($2 in TAB){print TAB[$2];}
853 sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
854 cmd="mount " $2 " -o remount," $4;
857 ' /proc/mounts /etc/fstab)"
858 initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
861 # A return of 2 or higher means there were serious problems.
862 if [ $rc -gt 1 ]; then
863 [ -e /proc/splash ] && echo "verbose" > /proc/splash
865 PS1="$(nls '(Repair filesystem)# ')"; export PS1
866 repair_shell "$(nls '*** An error occurred during the file system check.')"
868 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
872 show "Remounting encrypted filesystems back in rw mode"; busy
874 FILENAME=="/proc/mounts" {
877 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
878 sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
879 cmd="mount " $2 " -o remount," $4;
882 ' /proc/mounts /etc/fstab
886 # /var/log should be writable now, so start saving the boot output
887 if [ "$RC_BOOTLOG" ]; then
888 echo > /var/log/boot.log
892 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
893 run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa
897 if [ -x /sbin/quotaon ]; then
898 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
901 # Turn on process accounting
902 if [ -x /etc/rc.d/rc.acct ]; then
903 /etc/rc.d/rc.acct start
906 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
907 if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc -o -e /dev/rtc0 ]; then
908 if run_cmd "$(nls 'Setting clock')" hwclock --hctosys; then
909 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
913 # Initialize the serial ports
914 if [ -f /etc/rc.d/rc.serial ]; then
915 . /etc/rc.d/rc.serial
918 if [ -n "$PANIC_REBOOT_TIME" ] && [ "$PANIC_REBOOT_TIME" -gt "0" ] && [ -f /proc/sys/kernel/panic ]; then
919 show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
920 # DEPRECATED: use /etc/sysctl.conf or kernel commandline instead
921 if sysctl -q -w kernel.panic=$PANIC_REBOOT_TIME; then ok; else fail; fi
924 # ... and here finish configuring parameters
927 # /var/log should be writable now, so start saving the boot output
928 if [ "$RC_BOOTLOG" ]; then
929 echo > /var/log/boot.log
936 is_yes "$SELINUX" && [ -f /.autorelabel ] && relabel_selinux
939 rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff >/dev/null 2>&1
942 # /usr could be still not mounted if it is on NFS.
943 for afile in /var/lock/* /var/run/*; do
945 if [ -d "$afile" ]; then
950 echo $afile/* | xargs rm -rf
954 [ "$bafile" != "hwprofile" -a "$bafile" != "random-seed" ] && rm -f $afile 2> /dev/null
959 rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \
960 /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
961 rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
962 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
963 /tmp/scrollkeeper-* /tmp/ssh-*
969 if [ -e /var/log/wtmpx ]; then
970 if [ -e /var/log/wtmp ]; then
973 mv /var/log/wtmpx /var/log/wtmp
977 chown root:utmp /var/run/utmp /var/log/wtmp
978 chmod 0664 /var/run/utmp /var/log/wtmp
981 if is_yes "$CLEAN_TMP" && ! is_fsmounted tmpfs /tmp; then
982 LC_ALL=C rm -rf /tmp/* /tmp/.[a-zA-Z0-9]*
985 # System protected dirs
986 mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1
987 chown root:root /tmp/.ICE-unix
988 is_yes "$SELINUX" && restorecon /tmp/.ICE-unix >/dev/null 2>&1
990 test -d /var/run/netreport || mkdir -m 770 /var/run/netreport
992 if ! is_yes "$VSERVER"; then
995 # If a SCSI tape has been detected, load the st module unconditionally
996 # since many SCSI tapes don't deal well with st being loaded and unloaded
997 if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
998 if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
999 if [ -n "$USEMODULES" ] ; then
1000 # Try to load the module. If it fails, ignore it...
1001 insmod -p st >/dev/null 2>&1 && modprobe -s st
1006 # Now that we have all of our basic modules loaded and the kernel going,
1007 # let's dump the syslog ring somewhere so we can find it later
1009 if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then
1012 dmesg --raw > /var/log/dmesg
1013 chmod $mode /var/log/dmesg
1015 while [ $i -ge 0 ]; do
1016 if [ -f /var/log/dmesg.$i ]; then
1017 mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
1021 cp -pf /var/log/dmesg /var/log/dmesg.0
1024 if ! is_no "$RC_PROMPT"; then
1026 pid=$(/sbin/pidof getkey)
1027 [ -n "$pid" -o -e /var/run/getkey_done ] && break
1030 [ -n "$pid" ] && kill -TERM "$pid" >/dev/null 2>&1
1034 # /proc extra check if the background process we just spawned is still running,
1035 # as in case of vserver bootup it finishes quite instantly.
1036 if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then
1037 /sbin/getkey i && touch /var/run/confirm
1038 touch /var/run/getkey_done
1041 if ! is_no "$RC_PROMPT"; then
1042 rm -f /var/run/getkey_done