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)')
50 echo "$modprobe_c_cache"
53 # parse kernel cmdline
57 read cmdline < /proc/cmdline
59 for arg in $cmdline; do
62 # default is set in /etc/sysconfig/system
66 # default is set in /etc/sysconfig/system
70 # default is set in /etc/sysconfig/system
74 # default is set in /etc/sysconfig/system
102 # resolve a device node to its major:minor numbers in decimal or hex
104 local dev=$1 enc=${2:-hex} res
106 res=$(stat -Lc "%t:%T" "$dev")
107 if [ "$enc" = dec ]; then
112 res=$((0x$1)):$((0x$2))
117 # setup SELINUX variable
120 if is_no "$SELINUX"; then
124 if ! grep -Fq selinuxfs /proc/filesystems; then
125 # no support in kernel, no chance
127 elif ! is_fsmounted selinuxfs $selinuxfsdir; then
128 mount -n -t selinuxfs selinuxfs $selinuxfsdir
131 # Check SELinux status
132 local selinuxfs=$(awk '/ selinuxfs / { print $2 }' /proc/mounts 2> /dev/null)
134 if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
135 if [ -r $selinuxfs/enforce ] ; then
136 SELINUX=$(cat $selinuxfs/enforce)
138 # assume enforcing if you can't read it
145 local _d selinuxfs _t _r
147 while read _d selinuxfs _t _r; do
148 [ "$_t" = "selinuxfs" ] && break
150 echo "*** Warning -- SELinux is active"
151 echo "*** Disabling security enforcement for system recovery."
152 echo "*** Run 'setenforce 1' to reenable."
153 echo "0" > $selinuxfs/enforce
157 local _d selinuxfs _t _r
159 while read _d selinuxfs _t _r; do
160 [ "$_t" = "selinuxfs" ] && break
163 *** Warning -- SELinux relabel is required. ***
164 *** Disabling security enforcement. ***
165 *** Relabeling could take a very long time, ***
166 *** depending on file system size. ***
168 echo "0" > $selinuxfs/enforce
169 /sbin/fixfiles -F relabel > /dev/null 2>&1
171 echo "*** Enabling security enforcement. ***"
172 echo $SELINUX > $selinuxfs/enforce
175 # Enable automatic swapon of all partitions with the proper swap magic.
176 # This allows setting up swap without editing /etc/fstab.
178 local swappartitions=$(blkid -t TYPE=swap -o device)
179 if [ -z "$swappartitions" ]; then
183 local curswap=$(awk '/^\/dev/ { print $1 }' /proc/swaps | while read x; do echo -n " "; get_numeric_dev $x; echo -n " "; done)
186 for partition in $swappartitions; do
187 [ ! -e $partition ] && continue
188 majmin=$(get_numeric_dev $partition)
189 if ! strstr "$curswap" " $majmin "; then
190 run_cmd "$(nls 'Enabling local swap partitions: %s' $partition)" swapon $partition
197 run_cmd "Activating swap" swapon -a "$@"
198 is_yes "$AUTOSWAP" && enable_autoswap
201 # Loads modules from /etc/modules, /etc/modules.X.Y and /etc/modules.X.Y.Z
202 load_kernel_modules() {
203 local modules_file=$1
204 local _x _y _z v v1 old_IFS kernel kerneleq
208 # strip _* or -* from versions like: "2.6.25_vanilla-1", "2.6.25-1"
221 # Loop over every line in modules file
223 grep -hvE '^(#|[[:blank:]]*$)' /etc/$modules_file /etc/$modules_file.$kernel /etc/$modules_file.$kerneleq 2>/dev/null
224 echo '' # make sure there is a LF at the end
225 ) | while read module args; do
226 [ -z "$module" ] && continue
229 show "Loading %s kernel module(s)" "$module"
231 modprobe -s $module -- $args && ok || fail
235 # launch repair shell
236 # which after exiting will reboot
240 # don't use '\n' in nls macro !
244 nls "*** Dropping you to a shell; the system will reboot"
245 nls "*** when you leave the shell."
248 [ "$SELINUX" = "1" ] && disable_selinux
249 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
255 run_cmd "Unmounting file systems" umount -a
256 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
257 run_cmd "Automatic reboot in progress" reboot
261 show "Checking root filesystem"; started
262 initlog -c "fsck -C -T -a $fsckoptions /"
265 # A return of 4 or higher means there were serious problems.
266 if [ $rc -gt 3 ]; then
267 [ -e /proc/splash ] && echo "verbose" > /proc/splash
269 PS1="$(nls '(Repair filesystem)# ')"; export PS1
270 repair_shell "$(nls '*** An error occurred during the file system check.')"
272 # A return of 2 or 3 means that filesystem was repaired but we need
274 elif [ "$rc" = "2" -o "$rc" = "3" ]; then
275 [ -e /proc/splash ] && echo "verbose" > /proc/splash
277 nls "*** Filesystem was repaired but system needs to be"
278 nls "*** rebooted before mounting it."
279 nls "*** REBOOTING ***"
282 run_cmd "Unmounting file systems" umount -a
283 mount -n -o remount,ro /
284 run_cmd "Automatic reboot in progress" reboot
285 elif [ "$rc" = "1" ]; then
290 # Init software RAID arrays
294 if [ ! -x /sbin/mdadm ]; then
299 if [ ! -f /proc/mdstat ]; then
303 show "Starting up RAID devices"; busy
304 output=$(/sbin/mdadm --assemble --scan 2>&1)
307 if [ -n "$output" ]; then
314 if [ ! -x /sbin/vgscan -o ! -x /sbin/vgchange ] && ! is_yes "$EVMS_LVM"; then
318 if is_no "$LVM2"; then
319 lvmversion=$(LC_ALL=C /sbin/vgchange --version 2>/dev/null | awk '/LVM version:/{if ($3 >= 2) print "2"}')
324 if [ "$lvmversion" = "1" ] ; then
328 elif [ "$lvmversion" = "2" ] ; then
330 lvmignorelocking="--ignorelockingfailure"
331 lvmsysinit="--sysinit"
334 # device mapper (2.5+ and patched 2.4)
340 run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelocking
341 run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmsysinit
343 if [ "$lvmversion" = "2" ]; then
344 # silently refresh LV /dev nodes (just in case)
345 /sbin/vgmknodes $lvmignorelocking 1>/dev/null 2>&1
346 # display VG statistics
347 /sbin/vgdisplay -s $lvmignorelocking
351 # boot logging to /var/log/boot.log. install showconsole package to get it.
352 if ! is_no "$RC_BOOTLOG" && [ -x /sbin/blogd ]; then
358 if [[ "$container" != lxc* ]]; then
359 # we need /proc mounted before everything
360 is_fsmounted proc /proc || mount -n /proc || mount -n -o gid=17,hidepid=2 -t proc /proc /proc
365 is_fsmounted tmpfs /run || mount -n -t tmpfs run /run -o mode=0755,noexec,nosuid,nodev
371 # sysfs is also needed before any other things (under kernel > 2.5)
372 if ! is_fsmounted sysfs /sys; then
373 grep -Fq sysfs /proc/filesystems && mount -n -t sysfs sysfs /sys
375 if grep -Fq securityfs /proc/filesystems; then
376 mount -n -t securityfs securityfs /sys/kernel/security
378 if [ -d /sys/firmware/efi ] && ! is_fsmounted efivarfs /sys/firmware/efi/efivars; then
379 mount -n -o rw -t efivarfs efivarfs /sys/firmware/efi/efivars
382 if [ -d /sys/fs/selinux ]; then
384 selinuxfsdir=/sys/fs/selinux
386 selinuxfsdir=/selinux
390 # Choose Hardware profile
391 if ! is_no "$HWPROFILES" && [ -f /etc/sysconfig/hwprof ]; then
392 . /etc/sysconfig/hwprof
393 if is_yes "${HWPROFILES}" && [ -x /sbin/hwprofile -a -d /etc/sysconfig/hwprofiles/data ]; then
394 mount -n / -o rw,remount
396 mount -n / -o ro,remount
400 # Disable splash when requested
401 is_no "$BOOT_SPLASH" && [ -e /proc/splash ] && echo "0" > /proc/splash
403 if [ -x /sbin/restorecon ] && is_fsmounted tmpfs /dev; then
404 /sbin/restorecon -R /dev 2>/dev/null
407 [ -z "${CONSOLETYPE}" ] && CONSOLETYPE="$(/sbin/consoletype)"
409 if [ "$CONSOLETYPE" = "vt" -a -x /sbin/setsysfont ]; then
415 # Print welcome message
416 nls "\t\t\t%sPowered by %sTLD Linux%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CTLD)" "$(termput op)"
417 if ! is_no "$RC_PROMPT"; then
418 nls -n "\t\t Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
423 if [ -z "${HOSTNAME}" ]; then
424 show "$(nls 'Host:') $(hostname)"; ok
426 run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
429 # Set the NIS domain name
430 if [ -n "$NISDOMAIN" ]; then
431 run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
436 if [[ "$container" != lxc* ]]; then
437 # Set console loglevel
438 if [ -n "$CONSOLE_LOGLEVEL" ]; then
439 dmesg -n $CONSOLE_LOGLEVEL
442 if ! is_no "$START_UDEV" && [ -x /sbin/start_udev ] && [[ "$container" != lxc* ]]; then
443 is_fsmounted devtmpfs /dev || mount -n -t devtmpfs devtmpfs /dev
444 load_kernel_modules modules.preudev
446 elif [ -x /lib/firmware/firmware-loader.sh ]; then
447 /sbin/sysctl -q -e -w kernel.hotplug=/lib/firmware/firmware-loader.sh
450 # Unmount the initrd, if necessary
451 if grep -q /initrd /proc/mounts 2>/dev/null && ! grep -q /initrd/loopfs /proc/mounts 2>/dev/null; then
452 umount /initrd/dev 2>/dev/null
454 /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
457 # Start logging console output since we have all /dev stuff setup
458 if [ "$RC_BOOTLOG" ]; then
462 # Configure Linux kernel (initial configuration, some required modules still may be missing).
465 # Check if timezone definition is available
466 if [ -e /etc/localtime ] && [ -e /dev/rtc -o -e /dev/rtc0 ] ; then
467 if run_cmd "$(nls 'Setting clock')" hwclock --hctosys; then
468 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
471 TIME_SETUP_DELAYED=yes
475 if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then
476 # XXX might need modules dep
477 # Device mapper & related initialization
478 if ! grep -qF device-mapper /proc/devices; then
482 . /etc/rc.d/init.d/cryptsetup
483 show "Starting disk encryption"
486 [ $delay_cryptsetup = 0 ] && ok || fail
492 # Initialize USB controllers
494 if [ -z "$nousb" ] && ! is_fsmounted usbfs /proc/bus/usb; then
495 aliases=$(modprobe_c | awk '/^alias[[:space:]]+usb[-_]controller[[:space:]]+/{ print $3 }')
496 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
498 for alias in $aliases ; do
499 [ "$alias" = "off" ] && continue
500 run_cmd "$(nls 'Initializing USB controller') ($alias)" modprobe -s $alias
502 [ $? -eq 0 -a -n "$aliases" ] && usb=1
504 if grep -iq "usb" /proc/devices 2>/dev/null ; then
509 if [ "$usb" = "1" -a -d /proc/bus/usb ] && ! is_fsmounted usbfs /proc/bus/usb; then
510 run_cmd "Mounting USB filesystem" mount -n -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb
514 if [ "$usb" = "1" ]; then
515 needusbstorage=$(cat /proc/bus/usb/devices 2>/dev/null | grep -e "^I.*Cls=08" 2>/dev/null)
516 if [ "$(kernelverser)" -lt "002006" ]; then
517 grep -Fq 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd "Initializing USB HID interface" modprobe -s hid
518 mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02" 2>/dev/null)
519 kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01" 2>/dev/null)
520 if [ -n "$kbdoutput" ]; then
521 run_cmd "Initializing USB keyboard" modprobe -s keybdev
523 if [ -n "$mouseoutput" ]; then
524 run_cmd "Initializing USB mouse" modprobe -s mousedev
529 # Setup hdparm thing (if exists and is needed)
530 if [ -z "$nohdparm" ]; then
531 [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
534 if [ -z "$fastboot" ] && [ -f /fastboot ]; then
538 if [ -f /fsckoptions ]; then
539 fsckoptions=$(cat /fsckoptions)
544 if [ -f /forcefsck ]; then
545 fsckoptions="-f $fsckoptions"
547 # Obey the fs_passno setting for / (see fstab(5))
549 # - make sure we have at least 6 fields
550 _ROOTFS_PASSNO=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $6}' /etc/fstab)
554 _ROOTFS_DEVICE=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $1}' /etc/fstab)
555 _ROOTFS_TYPE=$(awk '$2 == "/" && $3 != "rootfs" { print $3 }' /proc/mounts 2>/dev/null)
557 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
561 # set up pnp and kernel pnp
562 if is_yes "$RUN_USERPNP" || is_yes "$RUN_KERNELPNP"; then
563 if [ -z "$nopnp" ] && is_yes "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
564 run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
566 if [ -z "$nopnp" ] && is_yes "$RUN_KERNELPNP"; then
568 if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
569 show "Setting up ISA PNP devices (kernelspace pnp)"; busy
570 grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail)
575 _ROOTFS_RO=$(awk '($1 !~ /^#/ && $2 == "/" && ($4 == "ro" || $4 ~ /,ro$/ || $4 ~ /^ro,/ || $4 ~ /,ro,/ ) && NF >= 6) { print "ro" }' /etc/fstab)
576 # Remount the root filesystem read-write
577 if [ -z "$_ROOTFS_RO" ]; then
578 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
581 # Update quotas if fsck was run on /
582 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
583 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
586 # Clean up SELinux labels
587 if is_yes "$SELINUX"; then
588 for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache; do
589 [ -r $file ] && restorecon $file >/dev/null 2>&1
593 if [ "$delay_cryptsetup" != 0 ]; then
594 show "Starting disk encryption using the RNG"
597 [ $delay_cryptsetup = 0 ] && ok || fail
600 # Start logging console output since we have all /dev stuff setup
601 if [ "$RC_BOOTLOG" ]; then
606 # Remove stale backups
607 rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~ >/dev/null 2>&1
609 # Remove /etc/nologin when starting system
610 [ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
612 if ! is_no "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
613 show "Enabling Delay Login"; busy
615 nls "System bootup in progress - please wait" >> /etc/nologin
617 chmod 644 /etc/nologin
618 cp -fp /etc/nologin /etc/nologin.boot
622 # The root filesystem is now read-write, so we can now log via
623 # syslog() directly...
624 if [ -n "$IN_INITLOG" ]; then
628 if [[ "$container" != lxc* ]]; then
631 [ -f /etc/cryptomtab ] && > /etc/cryptomtab
633 # Enter root, /proc, /sys and other into mtab.
634 mount -f / 2> /dev/null
635 mount -f /proc 2> /dev/null
636 if is_fsmounted devtmpfs /dev; then
637 mount -f -t devtmpfs devtmpfs /dev 2> /dev/null
639 if is_fsmounted tmpfs /run; then
640 mount -f -t tmpfs run /run -o mode=0755,noexec,nosuid,nodev 2> /dev/null
643 if is_fsmounted usbfs /proc/bus/usb; then
644 mount -f -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb 2> /dev/null
647 if is_fsmounted sysfs /sys; then
648 mount -f -t sysfs sysfs /sys 2> /dev/null
649 if is_fsmounted securityfs /sys/kernel/security ; then
650 mount -f -t securityfs securityfs /sys/kernel/security 2> /dev/null
652 if [ -d /sys/firmware/efi ] && is_fsmounted efivarfs /sys/firmware/efi/efivars ; then
653 mount -f -t efivarfs efivarfs /sys/firmware/efi/efivars 2> /dev/null
657 if is_fsmounted selinuxfs $selinuxfsdir; then
658 mount -f -t selinuxfs selinuxfs $selinuxfsdir 2> /dev/null
661 if [ ! -f /proc/modules ]; then
663 elif [ -z "$nomodules" ]; then
670 # Adjust symlinks as necessary in /boot to keep system services from
671 # spewing messages about mismatched System maps and so on.
672 if ! is_no "$SET_SLINKS"; then
673 if [ -L /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
674 ln -s -f System.map-$uname_r /boot/System.map
676 if [ ! -e /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
677 ln -s -f System.map-$uname_r /boot/System.map
681 # Run depmod if RUN_DEPMOD != "no" and:
682 # a) user requested or RUN_DEPMOD="";
683 # b) modules.dep is missing
684 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
685 if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
686 run_cmd "Finding module dependencies" depmod -a
687 elif [ "$RUN_DEPMOD" = "ifmissing" ] && [ ! -f /lib/modules/$uname_r/modules.dep ]; then
688 run_cmd "Finding module dependencies" depmod -A
693 if [ -f /proc/sys/kernel/modprobe ]; then
694 if [ -n "$USEMODULES" ]; then
695 sysctl -q -w kernel.modprobe="/sbin/modprobe"
697 # We used to set this to NULL, but that causes
698 # 'failed to exec' messages"
699 sysctl -q -w kernel.modprobe="/bin/true"
703 # Load usb storage here, to match most other things
704 if [ -n "$needusbstorage" ]; then
705 modprobe -s usb-storage
708 # Load firewire devices
709 if [ -z "$nofirewire" ]; then
710 aliases=$(modprobe_c | awk '/^alias[[:space:]]+ieee1394[-_]controller[[:space:]]+/{ print $3 }')
711 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
712 for alias in $aliases ; do
713 [ "$alias" = "off" ] && continue
714 run_cmd "$(nls 'Initializing firewire controller') ($alias)" modprobe $alias
716 grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && modprobe -s sbp2
720 # Load sound modules if they need persistent DMA buffers
721 if modprobe_c | grep -q "^options sound dmabuf=1"; then
723 alias=$(modprobe_c | awk '/^alias[[:space:]]+sound[[:space:]]+/{ print $3 }')
724 if [ -n "$alias" -a "$alias" != "off" ] ; then
725 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
728 alias=$(modprobe_c | awk '/^alias[[:space:]]+sound[-_]slot[-_]0[[:space:]]+/ { print $3 }')
729 if [ -n "$alias" -a "$alias" != "off" ] ; then
730 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
736 load_kernel_modules modules
737 for f in /etc/modules-load.d/*.conf; do
738 # already loaded by implicit "modules" load
739 [ "${f##*/}" = "modules.conf" ] && continue
741 [ -r $f ] || continue
742 load_kernel_modules ${f##/etc/}
745 if ! is_no "$DM_MULTIPATH" && [ -x /sbin/multipath ]; then
747 modprobe -s dm-multipath
748 # make nodes that were discarded due (possible) new /dev mount
749 /sbin/dmsetup mknodes
750 run_cmd "Activating dm-multipath" /sbin/multipath -v 0
751 /sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a -p p'
754 if ! is_no "$DMRAID" && [ -x /sbin/dmraid ]; then
755 run_cmd "Activating ATARAID devices" /sbin/dmraid -ay
758 # Find and activate volume groups:
760 if is_yes "$EVMS_LVM" && [ -x /sbin/evms_activate ]; then
761 if [ "$(kernelverser)" -lt "002006" ]; then
762 # Linux 2.4 core modules
764 modprobe -s evms_passthru
768 # Linux 2.6 core module
772 is_yes "$EVMS_GUID_PTABLE" && modprobe -s gpt_part
773 is_yes "$EVMS_LVM" && modprobe -s lvm_vge
774 is_yes "$EVMS_AIX" && modprobe -s AIXlvm_vge
775 is_yes "$EVMS_OS2" && modprobe -s os2lvm_vge
776 run_cmd "Discovering EVMS volumes" /sbin/evms_activate
777 if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
778 # Link nodes for compatibility with LVM
779 if [ "$(echo /dev/evms/lvm/*)" != '/dev/evms/lvm/*' ] ; then
780 ln -s /dev/evms/lvm/* /dev
785 if ! is_no "$MDADM"; then
789 if ! is_no "$LVM2"; then
793 if [ "$delay_cryptsetup" != 0 ]; then
794 show "Starting disk encryption"
797 [ $delay_cryptsetup = 0 ] && ok || fail
802 if [ -z "$fastboot" ] && [ -z "$nofsck" ]; then
803 rc_splash "fsck start"
804 show "Checking filesystems"; started
805 initlog -c "fsck -C -T -R -A -a -P $fsckoptions"
809 # A return of 2 or higher means there were serious problems
810 if [ $rc -gt 1 ]; then
811 [ -e /proc/splash ] && echo "verbose" > /proc/splash
813 PS1="$(nls '(Repair filesystem)# ')"; export PS1
814 repair_shell "$(nls '*** An error occurred during the file system check.')"
816 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
819 rc_splash "fsck stop"
822 # Mount all other filesystems (except for NFS and /proc, which is already
823 # mounted). Contrary to standard usage,
824 # filesystems are NOT unmounted in single user mode.
825 run_cmd "Mounting local filesystems" mount -a -t nonfs,nfs4,smbfs,ncpfs,proc,cifs -O no_netdev
827 # now we have /usr mounted, recheck if we have gettext and tput available.
828 if is_no "$TPUT"; then
834 # Now do some workaround - encrypted filesystems couldn't have been fsck-ed
835 # before mount - that's where the password is entered.
836 # mount is buggy - when remounting loopback filesystem, loop=XXX
837 # option is removed from /etc/mtab
838 if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
839 show "Checking encrypted filesystems"; started
840 LOOPLIST="$(LC_ALL=C awk '
841 FILENAME=="/proc/mounts" {
844 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ {
845 if ($2 in TAB){print TAB[$2];}
847 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
848 if ($2 in TAB){print TAB[$2];}
849 sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
850 cmd="mount " $2 " -o remount," $4;
853 ' /proc/mounts /etc/fstab)"
854 initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
857 # A return of 2 or higher means there were serious problems.
858 if [ $rc -gt 1 ]; then
859 [ -e /proc/splash ] && echo "verbose" > /proc/splash
861 PS1="$(nls '(Repair filesystem)# ')"; export PS1
862 repair_shell "$(nls '*** An error occurred during the file system check.')"
864 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
868 show "Remounting encrypted filesystems back in rw mode"; busy
870 FILENAME=="/proc/mounts" {
873 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
874 sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
875 cmd="mount " $2 " -o remount," $4;
878 ' /proc/mounts /etc/fstab
882 # /var/log should be writable now, so start saving the boot output
883 if [ "$RC_BOOTLOG" ]; then
884 echo > /var/log/boot.log
888 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
889 run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa
893 if [ -x /sbin/quotaon ]; then
894 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
897 # Turn on process accounting
898 if [ -x /etc/rc.d/rc.acct ]; then
899 /etc/rc.d/rc.acct start
902 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
903 if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc -o -e /dev/rtc0 ]; then
904 if run_cmd "$(nls 'Setting clock')" hwclock --hctosys; then
905 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
909 # Initialize the serial ports
910 if [ -f /etc/rc.d/rc.serial ]; then
911 . /etc/rc.d/rc.serial
914 if [ -n "$PANIC_REBOOT_TIME" ] && [ "$PANIC_REBOOT_TIME" -gt "0" ] && [ -f /proc/sys/kernel/panic ]; then
915 show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
916 # DEPRECATED: use /etc/sysctl.conf or kernel commandline instead
917 if sysctl -q -w kernel.panic=$PANIC_REBOOT_TIME; then ok; else fail; fi
920 # ... and here finish configuring parameters
923 # /var/log should be writable now, so start saving the boot output
924 if [ "$RC_BOOTLOG" ]; then
925 echo > /var/log/boot.log
931 is_yes "$SELINUX" && [ -f /.autorelabel ] && relabel_selinux
934 rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff >/dev/null 2>&1
937 # /usr could be still not mounted if it is on NFS.
938 for afile in /var/lock/* /var/run/*; do
940 if [ -d "$afile" ]; then
945 echo $afile/* | xargs rm -rf
949 [ "$bafile" != "hwprofile" -a "$bafile" != "random-seed" ] && rm -f $afile 2> /dev/null
954 rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \
955 /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
956 rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
957 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
958 /tmp/scrollkeeper-* /tmp/ssh-*
964 if [ -e /var/log/wtmpx ]; then
965 if [ -e /var/log/wtmp ]; then
968 mv /var/log/wtmpx /var/log/wtmp
972 chown root:utmp /var/run/utmp /var/log/wtmp
973 chmod 0664 /var/run/utmp /var/log/wtmp
976 if is_yes "$CLEAN_TMP" && ! is_fsmounted tmpfs /tmp; then
977 LC_ALL=C rm -rf /tmp/* /tmp/.[a-zA-Z0-9]*
980 # System protected dirs
981 mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1
982 chown root:root /tmp/.ICE-unix
983 is_yes "$SELINUX" && restorecon /tmp/.ICE-unix >/dev/null 2>&1
985 test -d /var/run/netreport || mkdir -m 770 /var/run/netreport
989 # If a SCSI tape has been detected, load the st module unconditionally
990 # since many SCSI tapes don't deal well with st being loaded and unloaded
991 if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
992 if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
993 if [ -n "$USEMODULES" ] ; then
994 # Try to load the module. If it fails, ignore it...
995 insmod -p st >/dev/null 2>&1 && modprobe -s st
1000 # Now that we have all of our basic modules loaded and the kernel going,
1001 # let's dump the syslog ring somewhere so we can find it later
1003 if [ "$(cat /proc/sys/kernel/dmesg_restrict)" = 0 ]; then
1006 dmesg --raw > /var/log/dmesg
1007 chmod $mode /var/log/dmesg
1009 while [ $i -ge 0 ]; do
1010 if [ -f /var/log/dmesg.$i ]; then
1011 mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
1015 cp -pf /var/log/dmesg /var/log/dmesg.0
1017 if ! is_no "$RC_PROMPT"; then
1019 pid=$(/sbin/pidof getkey)
1020 [ -n "$pid" -o -e /var/run/getkey_done ] && break
1023 [ -n "$pid" ] && kill -TERM "$pid" >/dev/null 2>&1
1027 # /proc extra check if the background process we just spawned is still running
1028 # as it may finish quite instantly.
1029 if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then
1030 /sbin/getkey i && touch /var/run/confirm
1031 touch /var/run/getkey_done
1034 if ! is_no "$RC_PROMPT"; then
1035 rm -f /var/run/getkey_done