3 # /etc/rc.d/rc.sysinit - run once at boot time
6 # Taken in part from Miquel van Smoorenburg's bcheckrc.
9 # reasonable start values for bootsplash progress.
15 if [ -r /etc/sysconfig/i18n ]; then
17 [ -n "$LANG" ] && export LANG || unset LANG
18 [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
19 [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
20 [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
21 [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
22 [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
23 [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
24 [ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL
25 [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
26 [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
29 # Read network config data
30 if [ -r /etc/sysconfig/network ]; then
31 . /etc/sysconfig/network
40 . /lib/rc-scripts/functions
44 if [ "$modprobe_c_cache" ]; then
45 echo "$modprobe_c_cache"
48 modprobe_c_cache=$(modprobe -c)
51 # parse kernel cmdline
54 read cmdline < /proc/cmdline
57 for arg in $cmdline; do
60 # default is set in /etc/sysconfig/system or detected in init.d/functions
64 # default is set in /etc/sysconfig/system
68 # default is set in /etc/sysconfig/system
72 # default is set in /etc/sysconfig/system
76 # default is set in /etc/sysconfig/system
104 # setup SELINUX variable
107 if is_no "$SELINUX"; then
111 if ! grep -Fq selinuxfs /proc/filesystems; then
112 # no support in kernel, no chance
116 if ! is_fsmounted selinuxfs /selinux; then
117 mount -n -o gid=17 -t selinuxfs selinuxfs /selinux
120 # Check SELinux status
121 local selinuxfs=$(awk '/ selinuxfs / { print $2 }' /proc/mounts 2> /dev/null)
123 if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
124 if [ -r $selinuxfs/enforce ] ; then
125 SELINUX=$(cat $selinuxfs/enforce)
127 # assume enforcing if you can't read it
134 local _d selinuxfs _t _r
136 while read _d selinuxfs _t _r; do
137 [ "$_t" = "selinuxfs" ] && break
139 echo "*** Warning -- SELinux is active"
140 echo "*** Disabling security enforcement for system recovery."
141 echo "*** Run 'setenforce 1' to reenable."
142 echo "0" > $selinuxfs/enforce
146 local _d selinuxfs _t _r
148 while read _d selinuxfs _t _r; do
149 [ "$_t" = "selinuxfs" ] && break
152 *** Warning -- SELinux relabel is required. ***
153 *** Disabling security enforcement. ***
154 *** Relabeling could take a very long time, ***
155 *** depending on file system size. ***
157 echo "0" > $selinuxfs/enforce
158 /sbin/fixfiles -F relabel > /dev/null 2>&1
160 echo "*** Enabling security enforcement. ***"
161 echo $SELINUX > $selinuxfs/enforce
164 # Remove duplicate entries from mtab (for vserver guest use only)
165 clean_vserver_mtab() {
167 while read device mountpoint line; do
168 grep -qs "$mountpoint" /etc/mtab.clean || \
169 echo "$device $mountpoint $line" >> /etc/mtab.clean
171 cat /etc/mtab.clean > /etc/mtab
172 rm -f /etc/mtab.clean
175 # Loads modules from /etc/modules, /etc/modules.X.Y and /etc/modules.X.Y.Z
176 load_kernel_modules() {
177 local modules_file=$1
178 local _x _y _z v v1 old_IFS kernel kerneleq
182 # strip _* or -* from versions like: "2.6.25_vanilla-1", "2.6.25-1"
195 # Loop over every line in modules file
197 grep -hvE '^(#|[[:blank:]]*$)' /etc/$modules_file /etc/$modules_file.$kernel /etc/$modules_file.$kerneleq 2>/dev/null
198 echo '' # make sure there is a LF at the end
199 ) | while read module args; do
200 [ -z "$module" ] && continue
203 show "Loading %s kernel module(s)" "$module"
205 modprobe -s $module -- $args && ok || fail
209 # launch repair shell
210 # which after exiting will reboot
214 # don't use '\n' in nls macro !
218 nls "*** Dropping you to a shell; the system will reboot"
219 nls "*** when you leave the shell."
222 [ "$SELINUX" = "1" ] && disable_selinux
223 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
229 run_cmd "Unmounting file systems" umount -a
230 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
231 run_cmd "Automatic reboot in progress" reboot
235 show "Checking root filesystem"; started
236 initlog -c "fsck -C -T -a $fsckoptions /"
239 # A return of 4 or higher means there were serious problems.
240 if [ $rc -gt 3 ]; then
241 [ -e /proc/splash ] && echo "verbose" > /proc/splash
243 PS1="$(nls '(Repair filesystem)# ')"; export PS1
244 repair_shell "$(nls '*** An error occurred during the file system check.')"
246 # A return of 2 or 3 means that filesystem was repaired but we need
248 elif [ "$rc" = "2" -o "$rc" = "3" ]; then
249 [ -e /proc/splash ] && echo "verbose" > /proc/splash
251 nls "*** Filesystem was repaired but system needs to be"
252 nls "*** rebooted before mounting it."
253 nls "*** REBOOTING ***"
256 run_cmd "Unmounting file systems" umount -a
257 mount -n -o remount,ro /
258 run_cmd "Automatic reboot in progress" reboot
259 elif [ "$rc" = "1" ]; then
266 if [ ! -x /sbin/mdadm -o ! -f /etc/mdadm.conf ]; then
272 if [ -f /proc/mdstat ]; then
275 if grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf; then
276 show "Starting up RAID devices"; busy
277 /sbin/mdadm --assemble --scan --auto=yes
279 if [ "$rc" -eq 0 -o "$rc" -eq 2 ]; then
280 # rc is used later, too so set sane value
290 # A non-zero return means there were problems
291 if [ $rc -gt 0 ]; then
292 [ -e /proc/splash ] && echo "verbose" > /proc/splash
293 show "Starting up RAID devices"; fail
295 PS1="$(nls '(RAID Repair)# ')"; export PS1
296 repair_shell "$(nls '*** An error occurred during the RAID startup.')"
299 # LVM on RAID (keep in sync with LVM init)
300 if [ "$golvm" -eq "1" ]; then
301 if [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
302 run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelocking
303 run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmsysinit
304 [ "$lvmversion" = "2" ] && /sbin/vgmknodes
307 show "Starting up RAID devices"; ok
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
342 if [ "$lvmversion" = "2" ]; then
343 /sbin/vgmknodes $lvmignorelocking
344 # display VG statistics
345 /sbin/vgdisplay -s $lvmignorelocking
349 # boot logging to /var/log/boot.log. install showconsole package to get it.
350 if ! is_no "$RC_BOOTLOG" && [ -x /sbin/blogd ]; then
356 if ! is_yes "$VSERVER"; then
357 # we need /proc mounted before everything
358 is_fsmounted proc /proc || mount -n /proc || mount -n -o gid=17,hidepid=2 -t proc /proc /proc
363 is_fsmounted tmpfs /run || mount -n -t tmpfs run /run
367 sysctl -q -e -p /etc/sysctl.conf
369 # sysfs is also needed before any other things (under kernel > 2.5)
370 if ! is_fsmounted sysfs /sys; then
371 grep -Fq sysfs /proc/filesystems && mount -n -o gid=17 -t sysfs sysfs /sys
373 if grep -Fq securityfs /proc/filesystems; then
374 mount -n -o gid=17 -t securityfs securityfs /sys/kernel/security
379 # PLD Linux LiveCD support
380 if [ -x /etc/rc.d/rc.live ]; then
384 # Choose Hardware profile
385 if ! is_no "$HWPROFILES" && [ -f /etc/sysconfig/hwprof ]; then
386 . /etc/sysconfig/hwprof
387 if is_yes "${HWPROFILES}" && [ -x /sbin/hwprofile -a -d /etc/sysconfig/hwprofiles/data ]; then
388 mount -n / -o rw,remount
390 mount -n / -o ro,remount
394 # Disable splash when requested
395 is_no "$BOOT_SPLASH" && [ -e /proc/splash ] && echo "0" > /proc/splash
397 if [ -x /sbin/restorecon ] && is_fsmounted tmpfs /dev; then
398 /sbin/restorecon -R /dev 2>/dev/null
401 [ -z "${CONSOLETYPE}" ] && CONSOLETYPE="$(/sbin/consoletype)"
403 if [ "$CONSOLETYPE" = "vt" -a -x /sbin/setsysfont ]; then
409 # Print welcome message
410 nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CPLD)" "$(termput op)"
411 if ! is_no "$RC_PROMPT"; then
412 nls -n "\t\t Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
417 if [ -z "${HOSTNAME}" ]; then
418 show "$(nls 'Host:') $(hostname)"; ok
420 run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
423 # Set the NIS domain name
424 if [ -n "$NISDOMAIN" ]; then
425 run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
430 if ! is_yes "$VSERVER"; then
431 # Set console loglevel
432 if [ -n "$CONSOLE_LOGLEVEL" ]; then
433 dmesg -n $CONSOLE_LOGLEVEL
436 if ! is_no "$START_UDEV" && [ -x /sbin/start_udev ] && [[ "$container" != lxc* ]]; then
437 is_fsmounted devtmpfs /dev || mount -n -t devtmpfs devtmpfs /dev
438 load_kernel_modules modules.preudev
440 use_upstart && [ -x /sbin/initctl ] && /sbin/initctl -q start udev
441 elif [ -x /lib/firmware/firmware-loader.sh ]; then
442 /sbin/sysctl -q -e -w kernel.hotplug=/lib/firmware/firmware-loader.sh
445 # Unmount the initrd, if necessary
446 if grep -q /initrd /proc/mounts 2>/dev/null && ! grep -q /initrd/loopfs /proc/mounts 2>/dev/null; then
447 umount /initrd/dev 2>/dev/null
449 /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
452 # Start logging console output since we have all /dev stuff setup
453 if [ "$RC_BOOTLOG" ]; then
457 # Configure Linux kernel (initial configuration, some required modules still
459 sysctl -q -e -p /etc/sysctl.conf
461 # Check if timezone definition is available
462 if [ -e /etc/localtime ] && [ -e /dev/rtc -o -e /dev/rtc0 ] ; then
463 if run_cmd "$(nls 'Setting clock')" hwclock --hctosys; then
464 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
467 TIME_SETUP_DELAYED=yes
471 if [ -f /etc/crypttab ] && ! is_empty_file /etc/crypttab; then
472 # XXX might need modules dep
473 # Device mapper & related initialization
474 if ! grep -qF device-mapper /proc/devices; then
478 . /etc/rc.d/init.d/cryptsetup
479 show "Starting disk encryption"
482 [ $delay_cryptsetup = 0 ] && ok || fail
486 run_cmd "Activating swap partitions" swapon -a -e
488 # Initialize USB controllers
490 if [ -z "$nousb" ] && ! is_fsmounted usbfs /proc/bus/usb; then
491 aliases=$(modprobe_c | awk '/^alias[[:space:]]+usb[-_]controller[[:space:]]+/{ print $3 }')
492 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
494 for alias in $aliases ; do
495 [ "$alias" = "off" ] && continue
496 run_cmd "$(nls 'Initializing USB controller') ($alias)" modprobe -s $alias
498 [ $? -eq 0 -a -n "$aliases" ] && usb=1
500 if grep -iq "usb" /proc/devices 2>/dev/null ; then
505 if [ "$usb" = "1" -a -d /proc/bus/usb ] && ! is_fsmounted usbfs /proc/bus/usb ; then
506 run_cmd "Mounting USB filesystem" mount -n -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb
510 if [ "$usb" = "1" ]; then
511 needusbstorage=$(cat /proc/bus/usb/devices 2>/dev/null | grep -e "^I.*Cls=08" 2>/dev/null)
512 if [ "$(kernelverser)" -lt "002006" ]; then
513 grep -Fq 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd "Initializing USB HID interface" modprobe -s hid
514 mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02" 2>/dev/null)
515 kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01" 2>/dev/null)
516 if [ -n "$kbdoutput" ]; then
517 run_cmd "Initializing USB keyboard" modprobe -s keybdev
519 if [ -n "$mouseoutput" ]; then
520 run_cmd "Initializing USB mouse" modprobe -s mousedev
525 # Setup hdparm thing (if exists and is needed)
526 if [ -z "$nohdparm" ]; then
527 [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
530 if [ -z "$fastboot" ] && [ -f /fastboot ]; then
534 if [ -f /fsckoptions ]; then
535 fsckoptions=$(cat /fsckoptions)
540 if [ -f /forcefsck ]; then
541 fsckoptions="-f $fsckoptions"
543 # Obey the fs_passno setting for / (see fstab(5))
545 # - make sure we have at least 6 fields
546 _ROOTFS_PASSNO=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $6}' /etc/fstab)
550 _ROOTFS_DEVICE=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $1}' /etc/fstab)
551 _ROOTFS_TYPE=$(awk '$2 == "/" && $3 != "rootfs" { print $3 }' /proc/mounts 2>/dev/null)
553 if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "aufs" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" -a "$_ROOTFS_TYPE" != "squashfs" -a "$_ROOTFS_PASSNO" != 0 -a -e $_ROOTFS_DEVICE ] && [[ "$container" != lxc* ]]; then
557 # set up pnp and kernel pnp
558 if is_yes "$RUN_USERPNP" || is_yes "$RUN_KERNELPNP"; then
559 if [ -z "$nopnp" ] && is_yes "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
560 run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
562 if [ -z "$nopnp" ] && is_yes "$RUN_KERNELPNP"; then
564 if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
565 show "Setting up ISA PNP devices (kernelspace pnp)"; busy
566 grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail)
571 _ROOTFS_RO=$(awk '($1 !~ /^#/ && $2 == "/" && ($4 == "ro" || $4 ~ /,ro$/ || $4 ~ /^ro,/ || $4 ~ /,ro,/ ) && NF >= 6) { print "ro" }' /etc/fstab)
572 # Remount the root filesystem read-write
573 if [ -z "$_ROOTFS_RO" ]; then
574 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
577 # Update quotas if fsck was run on /
578 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
579 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
582 # Clean up SELinux labels
583 if is_yes "$SELINUX"; then
584 for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache; do
585 [ -r $file ] && restorecon $file >/dev/null 2>&1
589 if [ "$delay_cryptsetup" != 0 ]; then
590 show "Starting disk encryption using the RNG"
593 [ $delay_cryptsetup = 0 ] && ok || fail
596 # Start logging console output since we have all /dev stuff setup
597 if [ "$RC_BOOTLOG" ]; then
602 # Remove stale backups
603 rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~ >/dev/null 2>&1
605 # Remove /etc/nologin when starting system
606 [ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
608 if ! is_no "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
609 show "Enabling Delay Login"; busy
611 nls "System bootup in progress - please wait" >> /etc/nologin
613 chmod 644 /etc/nologin
614 cp -fp /etc/nologin /etc/nologin.boot
618 # The root filesystem is now read-write, so we can now log via
619 # syslog() directly...
620 if [ -n "$IN_INITLOG" ]; then
624 if ! is_yes "$VSERVER"; then
627 [ -f /etc/cryptomtab ] && > /etc/cryptomtab
629 # Enter root, /proc, /sys and other into mtab.
630 mount -f / 2> /dev/null
631 mount -f /proc 2> /dev/null
632 if is_fsmounted devtmpfs /dev; then
633 mount -f -t devtmpfs devtmpfs /dev 2> /dev/null
635 if is_fsmounted tmpfs /run; then
636 mount -f -t tmpfs run /run 2> /dev/null
639 if is_fsmounted usbfs /proc/bus/usb; then
640 mount -f -t usbfs -o devgid=78,devmode=664 usbfs /proc/bus/usb 2> /dev/null
643 if is_fsmounted sysfs /sys; then
644 mount -f -t sysfs sysfs /sys 2> /dev/null
645 if is_fsmounted securityfs /sys/kernel/security ; then
646 mount -f -t securityfs securityfs /sys/kernel/security 2> /dev/null
650 if is_fsmounted selinuxfs /selinux; then
651 mount -f -t selinuxfs selinuxfs /selinux 2> /dev/null
654 emit --no-wait root-filesystem
655 emit --no-wait virtual-filesystems
657 if [ ! -f /proc/modules ]; then
659 elif [ -z "$nomodules" ]; then
666 # Adjust symlinks as necessary in /boot to keep system services from
667 # spewing messages about mismatched System maps and so on.
668 if ! is_no "$SET_SLINKS"; then
669 if [ -L /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
670 ln -s -f System.map-$uname_r /boot/System.map
672 if [ ! -e /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
673 ln -s -f System.map-$uname_r /boot/System.map
677 # Run depmod if RUN_DEPMOD != "no" and:
678 # a) user requested or RUN_DEPMOD="";
679 # b) modules.dep is missing
680 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
681 if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
682 run_cmd "Finding module dependencies" depmod -a
683 elif [ "$RUN_DEPMOD" = "ifmissing" ] && [ ! -f /lib/modules/$uname_r/modules.dep ]; then
684 run_cmd "Finding module dependencies" depmod -A
689 if [ -f /proc/sys/kernel/modprobe ]; then
690 if [ -n "$USEMODULES" ]; then
691 sysctl -q -w kernel.modprobe="/sbin/modprobe"
693 # We used to set this to NULL, but that causes
694 # 'failed to exec' messages"
695 sysctl -q -w kernel.modprobe="/bin/true"
699 # Load usb storage here, to match most other things
700 if [ -n "$needusbstorage" ]; then
701 modprobe -s usb-storage
704 # Load firewire devices
705 if [ -z "$nofirewire" ]; then
706 aliases=$(modprobe_c | awk '/^alias[[:space:]]+ieee1394[-_]controller[[:space:]]+/{ print $3 }')
707 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
708 for alias in $aliases ; do
709 [ "$alias" = "off" ] && continue
710 run_cmd "$(nls 'Initializing firewire controller') ($alias)" modprobe $alias
712 grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && modprobe -s sbp2
716 # Load sound modules if they need persistent DMA buffers
717 if modprobe_c | grep -q "^options sound dmabuf=1"; then
719 alias=$(modprobe_c | awk '/^alias[[:space:]]+sound[[:space:]]+/{ print $3 }')
720 if [ -n "$alias" -a "$alias" != "off" ] ; then
721 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
724 alias=$(modprobe_c | awk '/^alias[[:space:]]+sound[-_]slot[-_]0[[:space:]]+/ { print $3 }')
725 if [ -n "$alias" -a "$alias" != "off" ] ; then
726 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
732 if ! use_upstart; then
733 load_kernel_modules modules
734 for f in /etc/modules-load.d/*.conf; do
735 # already loaded by implicit "modules" load
736 [ "${f##*/}" = "modules.conf" ] && continue
738 [ -r $f ] || continue
739 load_kernel_modules ${f##/etc/}
743 if ! is_no "$DM_MULTIPATH" && [ -x /sbin/multipath ]; then
745 modprobe -s dm-multipath
746 # make nodes that were discarded due (possible) new /dev mount
747 /sbin/dmsetup mknodes
748 run_cmd "Activating dm-multipath" /sbin/multipath -v 0
749 /sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a -p p'
752 if ! is_no "$DMRAID" && [ -x /sbin/dmraid ]; then
753 run_cmd "Activating ATARAID devices" /sbin/dmraid -ay
756 # Find and activate volume groups:
758 if is_yes "$EVMS_LVM" && [ -x /sbin/evms_activate ]; then
759 if [ "$(kernelverser)" -lt "002006" ]; then
760 # Linux 2.4 core modules
762 modprobe -s evms_passthru
766 # Linux 2.6 core module
770 is_yes "$EVMS_GUID_PTABLE" && modprobe -s gpt_part
771 is_yes "$EVMS_LVM" && modprobe -s lvm_vge
772 is_yes "$EVMS_AIX" && modprobe -s AIXlvm_vge
773 is_yes "$EVMS_OS2" && modprobe -s os2lvm_vge
774 run_cmd "Discovering EVMS volumes" /sbin/evms_activate
775 if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
776 # Link nodes for compatibility with LVM
777 if [ "$(echo /dev/evms/lvm/*)" != '/dev/evms/lvm/*' ] ; then
778 ln -s /dev/evms/lvm/* /dev
784 if ! is_no "$LVM2"; then
788 if [ "$delay_cryptsetup" != 0 ]; then
789 show "Starting disk encryption"
792 [ $delay_cryptsetup = 0 ] && ok || fail
795 if ! is_no "$MDADM"; then
801 if [ -z "$fastboot" ] && [ -z "$nofsck" ]; then
802 rc_splash "fsck start"
803 show "Checking filesystems"; started
804 initlog -c "fsck -C -T -R -A -a -P $fsckoptions"
808 # A return of 2 or higher means there were serious problems
809 if [ $rc -gt 1 ]; then
810 [ -e /proc/splash ] && echo "verbose" > /proc/splash
812 PS1="$(nls '(Repair filesystem)# ')"; export PS1
813 repair_shell "$(nls '*** An error occurred during the file system check.')"
815 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
818 rc_splash "fsck stop"
821 # Mount all other filesystems (except for NFS and /proc, which is already
822 # mounted). Contrary to standard usage,
823 # filesystems are NOT unmounted in single user mode.
824 run_cmd "Mounting local filesystems" mount -a -t nonfs,nfs4,smbfs,ncpfs,proc,cifs -O no_netdev
826 # now we have /usr mounted, recheck if we have gettext and tput available.
827 if is_no "$TPUT"; then
833 # Now do some workaround - encrypted filesystems couldn't have been fsck-ed
834 # before mount - that's where the password is entered.
835 # mount is buggy - when remounting loopback filesystem, loop=XXX
836 # option is removed from /etc/mtab
837 if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
838 show "Checking encrypted filesystems"; started
839 LOOPLIST="$(LC_ALL=C awk '
840 FILENAME=="/proc/mounts" {
843 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ {
844 if ($2 in TAB){print TAB[$2];}
846 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
847 if ($2 in TAB){print TAB[$2];}
848 sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
849 cmd="mount " $2 " -o remount," $4;
852 ' /proc/mounts /etc/fstab)"
853 initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
856 # A return of 2 or higher means there were serious problems.
857 if [ $rc -gt 1 ]; then
858 [ -e /proc/splash ] && echo "verbose" > /proc/splash
860 PS1="$(nls '(Repair filesystem)# ')"; export PS1
861 repair_shell "$(nls '*** An error occurred during the file system check.')"
863 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
867 show "Remounting encrypted filesystems back in rw mode"; busy
869 FILENAME=="/proc/mounts" {
872 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
873 sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
874 cmd="mount " $2 " -o remount," $4;
877 ' /proc/mounts /etc/fstab
881 # /var/log should be writable now, so start saving the boot output
882 if [ "$RC_BOOTLOG" ]; then
883 echo > /var/log/boot.log
887 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
888 run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa
892 if [ -x /sbin/quotaon ]; then
893 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
896 emit --no-wait local-filesystems
898 # FIXME: this should be delayed until remote filesystems are mounted,
899 # especialy when /usr or other standard fs is remote
900 emit --no-wait filesystem
902 # Turn on process accounting
903 if [ -x /etc/rc.d/rc.acct ]; then
904 /etc/rc.d/rc.acct start
907 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
908 if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc -o -e /dev/rtc0 ]; then
909 if run_cmd "$(nls 'Setting clock')" hwclock --hctosys; then
910 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
914 # Initialize the serial ports
915 if [ -f /etc/rc.d/rc.serial ]; then
916 . /etc/rc.d/rc.serial
919 if [ -n "$PANIC_REBOOT_TIME" -a "$PANIC_REBOOT_TIME" -gt "0" -a -f /proc/sys/kernel/panic ]; then
920 show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
921 # DEPRECATED: use /etc/sysctl.conf or kernel commandline instead
922 if sysctl -q -w kernel.panic=$PANIC_REBOOT_TIME; then ok; else fail; fi
925 # ... and here finish configuring parameters
926 sysctl -q -e -p /etc/sysctl.conf
928 emit --no-wait root-filesystem
929 emit --no-wait virtual-filesystems
930 emit --no-wait local-filesystems
931 emit --no-wait filesystem
933 # /var/log should be writable now, so start saving the boot output
934 if [ "$RC_BOOTLOG" ]; then
935 echo > /var/log/boot.log
942 is_yes "$SELINUX" && [ -f /.autorelabel ] && relabel_selinux
945 rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff >/dev/null 2>&1
948 # /usr could be still not mounted if it is on NFS.
949 for afile in /var/lock/* /var/run/*; do
951 if [ -d "$afile" ]; then
956 echo $afile/* | xargs rm -rf
960 [ "$bafile" != "hwprofile" -a "$bafile" != "random-seed" ] && rm -f $afile 2> /dev/null
965 rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \
966 /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
967 rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
968 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
969 /tmp/scrollkeeper-* /tmp/ssh-*
973 if ! is_no "$NEED_XFILES"; then
976 chown root:utmp /var/run/utmpx /var/log/wtmpx
977 chmod 0664 /var/run/utmpx /var/log/wtmpx
981 chown root:utmp /var/run/utmp /var/log/wtmp
982 chmod 0664 /var/run/utmp /var/log/wtmp
986 if is_yes "$CLEAN_TMP" && ! is_fsmounted tmpfs /tmp; then
987 LC_ALL=C rm -rf /tmp/* /tmp/.[a-zA-Z0-9]*
990 # System protected dirs
991 mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1
992 chown root:root /tmp/.ICE-unix
993 is_yes "$SELINUX" && restorecon /tmp/.ICE-unix >/dev/null 2>&1
995 if ! is_yes "$VSERVER"; then
996 run_cmd "Enabling swap space" true
997 # Right, now turn on swap in case we swap to files
998 swapon -a >/dev/null 2>&1
999 emit --no-wait all-swaps
1001 # If a SCSI tape has been detected, load the st module unconditionally
1002 # since many SCSI tapes don't deal well with st being loaded and unloaded
1003 if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
1004 if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
1005 if [ -n "$USEMODULES" ] ; then
1006 # Try to load the module. If it fails, ignore it...
1007 insmod -p st >/dev/null 2>&1 && modprobe -s st
1012 # Now that we have all of our basic modules loaded and the kernel going,
1013 # let's dump the syslog ring somewhere so we can find it later
1014 dmesg --raw > /var/log/dmesg
1016 while [ $i -ge 0 ]; do
1017 if [ -f /var/log/dmesg.$i ]; then
1018 chmod 0600 /var/log/dmesg.$i
1019 mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
1023 cp -f /var/log/dmesg /var/log/dmesg.0
1024 chmod 0600 /var/log/dmesg /var/log/dmesg.0
1026 emit --no-wait all-swaps
1029 if ! is_no "$RC_PROMPT"; then
1031 pid=$(/sbin/pidof getkey)
1032 [ -n "$pid" -o -e /var/run/getkey_done ] && break
1035 [ -n "$pid" ] && kill -TERM "$pid" >/dev/null 2>&1
1039 # /proc extra check if the background process we just spawned is still running,
1040 # as in case of vserver bootup it finishes quite instantly.
1041 if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then
1042 /sbin/getkey i && touch /var/run/confirm
1043 touch /var/run/getkey_done
1046 if ! is_no "$RC_PROMPT"; then
1047 rm -f /var/run/getkey_done
1051 emit --no-wait pld.sysinit-done