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 . /etc/rc.d/init.d/functions
43 typeset _d selinuxfs _t _r
45 while read _d selinuxfs _t _r; do
46 [ "$_t" = "selinuxfs" ] && break
48 echo "*** Warning -- SELinux is active"
49 echo "*** Disabling security enforcement for system recovery."
50 echo "*** Run 'setenforce 1' to reenable."
51 echo "0" > $selinuxfs/enforce
55 typeset _d selinuxfs _t _r
57 while read _d selinuxfs _t _r; do
58 [ "$_t" = "selinuxfs" ] && break
61 *** Warning -- SELinux relabel is required. ***
62 *** Disabling security enforcement. ***
63 *** Relabeling could take a very long time, ***
64 *** depending on file system size. ***
66 echo "0" > $selinuxfs/enforce
67 /sbin/fixfiles -F relabel > /dev/null 2>&1
69 echo "*** Enabling security enforcement. ***"
70 echo $SELINUX > $selinuxfs/enforce
73 # Remove duplicate entries from mtab (for vserver guest use only)
74 clean_vserver_mtab() {
76 while read device mountpoint line; do
77 grep -qs "$mountpoint" /etc/mtab.clean || \
78 echo "$device $mountpoint $line" >> /etc/mtab.clean
80 cat /etc/mtab.clean > /etc/mtab
85 # boot logging to /var/log/boot.msg. install showconsole package to get it.
86 if [ -x /sbin/blogd ] && ! is_no "$RC_BOOTLOG"; then
92 if ! is_yes "$VSERVER" ; then
93 # we need /proc mounted before everything
94 mount -n -o gid=17 -t proc /proc /proc
96 # Only read this once.
97 cmdline=$(cat /proc/cmdline)
99 # sysfs is also needed before any other things (under kernel > 2.5)
100 if grep -q sysfs /proc/filesystems 2>/dev/null ; then
101 mount -n -o gid=17 -t sysfs sysfs /sys
102 if [ "$(kernelver)" -ge "002006014" ] && \
103 grep -q securityfs /proc/filesystems 2>/dev/null ; then
104 mount -n -o gid=17 -t securityfs securityfs /sys/kernel/security
110 if grep -q selinuxfs /proc/filesystems 2>/dev/null && ! grep -q selinuxfs /proc/mounts 2>/dev/null; then
111 mount -n -o gid=17 -t selinuxfs selinuxfs /selinux
114 # PLD Linux LiveCD support
115 if [ -x /etc/rc.d/rc.live ]; then
119 # Choose Hardware profile
120 if [ -f /etc/sysconfig/hwprof ]; then
121 . /etc/sysconfig/hwprof
122 if is_yes "${HWPROFILES}" && [ -x /sbin/hwprofile -a -d /etc/sysconfig/hwprofiles/data ]; then
123 mount -n / -o rw,remount
125 mount -n / -o ro,remount
129 # Disable splash when requested
130 [ -e /proc/splash ] && is_no "$BOOT_SPLASH" && echo "0" > /proc/splash
132 # Check SELinux status
133 selinuxfs=$(awk '/ selinuxfs / { print $2 }' /proc/mounts 2> /dev/null)
135 if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
136 if [ -r $selinuxfs/enforce ] ; then
137 SELINUX=$(cat $selinuxfs/enforce)
139 # assume enforcing if you can't read it
144 if [ -x /sbin/restorecon ] && LC_ALL=C fgrep -q " /dev " /proc/mounts 2>/dev/null ; then
145 /sbin/restorecon -R /dev 2>/dev/null
149 [ -z "${CONSOLETYPE}" ] && CONSOLETYPE="$(/sbin/consoletype)"
151 if [ "$CONSOLETYPE" = "vt" -a -x /sbin/setsysfont ]; then
157 # Print welcome message
158 nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CPLD)" "$(termput op)"
159 if ! is_no "$RC_PROMPT"; then
160 nls -n "\t\t Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
165 if [ -z "${HOSTNAME}" ]; then
166 show "$(nls 'Host:') $(hostname)" ; ok
168 run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
171 # Set the NIS domain name
172 if [ -n "$NISDOMAIN" ]; then
173 run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
178 if ! is_yes "$VSERVER"; then
179 # Set console loglevel
180 if [ -n "$CONSOLE_LOGLEVEL" ]; then
181 /bin/dmesg -n $CONSOLE_LOGLEVEL
184 [ -x /sbin/start_udev ] && /sbin/start_udev
186 # Unmount the initrd, if necessary
187 if grep -q /initrd /proc/mounts 2>/dev/null && ! grep -q /initrd/loopfs /proc/mounts 2>/dev/null; then
188 if [ -e /initrd/dev/.devfsd ]; then
191 umount /initrd/dev 2>/dev/null
193 /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
196 # /dev must be also mounted before everything but only if we want use them ;-)
197 if is_yes "$MOUNT_DEVFS"; then
198 run_cmd "Mounting Device Filesystem" mount -n -t devfs /dev /dev
201 if [ -e /dev/.devfsd -a -x /sbin/devfsd ]; then
202 run_cmd "Starting Device Filesystem Daemon" /sbin/devfsd /dev
206 # Start logging console output since we have all /dev stuff setup
207 if [ "$RC_BOOTLOG" ]; then
211 # cpuset support (mounted unconditionally, shouldn't be a problem)
212 if grep -q cpuset /proc/filesystems 2>/dev/null ; then
213 # mkdir for udev (FIXME fix the udev instead)
214 mkdir -p /dev/cpuset 2>/dev/null
215 mount -n -t cpuset none /dev/cpuset
218 # Configure Linux kernel (initial configuration, some required modules still
220 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
222 # Set the system clock.
227 if [ -f /etc/sysconfig/clock ]; then
228 . /etc/sysconfig/clock
230 # convert old style clock config to new values
231 if [ "${CLOCKMODE}" = "GMT" ]; then
233 elif [ "${CLOCKMODE}" = "ARC" ]; then
238 if grep "system serial" /proc/cpuinfo 2>/dev/null | grep -q MILO 2>/dev/null ; then
243 CLOCKFLAGS="--hctosys"
245 if is_yes "$UTC" ; then
246 CLOCKFLAGS="$CLOCKFLAGS --utc"
247 CLOCKDEF="$CLOCKDEF (utc)"
249 CLOCKFLAGS="$CLOCKFLAGS --localtime"
250 CLOCKDEF="$CLOCKDEF (local)"
253 if is_yes "$ARC" ; then
254 CLOCKFLAGS="$CLOCKFLAGS -A"
255 CLOCKDEF="$CLOCKDEF (arc)"
258 if is_yes "$SRM" ; then
259 CLOCKFLAGS="$CLOCKFLAGS -S"
260 CLOCKDEF="$CLOCKDEF (srm)"
263 # Check if timezone definition is available
264 if [ -e /etc/localtime -a -e /dev/rtc ] ; then
265 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
266 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
269 TIME_SETUP_DELAYED=yes
273 run_cmd "Activating swap partitions" swapon -a -e
275 # Initialize USB controllers
277 if ! strstr "$cmdline" "nousb" && ! grep -q "/proc/bus/usb" /proc/mounts 2>/dev/null ; then
278 aliases=$(/sbin/modprobe -c | awk '/^alias[\t ]+usb-controller/ { print $3 }')
279 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
280 /sbin/modprobe -s -k usbcore
281 for alias in $aliases ; do
282 [ "$alias" = "off" ] && continue
283 run_cmd "$(nls 'Initializing USB controller') ($alias)" /sbin/modprobe -s $alias
285 [ $? -eq 0 -a -n "$aliases" ] && usb=1
287 if grep -iq "usb" /proc/devices 2>/dev/null ; then
292 if [ "$usb" = "1" -a ! -f /proc/bus/usb/devices ]; then
293 run_cmd "Mounting USB filesystem" mount -n -t usbfs usbfs /proc/bus/usb
297 if [ "$usb" = "1" ]; then
298 needusbstorage=$(LC_ALL=C cat /proc/bus/usb/devices 2>/dev/null|grep -e "^I.*Cls=08" 2>/dev/null)
299 if [ "$(kernelverser)" -lt "002006" ]; then
300 LC_ALL=C grep -q 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd "Initializing USB HID interface" modprobe hid 2> /dev/null
301 mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02" 2>/dev/null)
302 kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01" 2>/dev/null)
303 if [ -n "$kbdoutput" ]; then
304 run_cmd "Initializing USB keyboard" modprobe keybdev
306 if [ -n "$mouseoutput" ]; then
307 run_cmd "Initializing USB mouse" modprobe mousedev
312 # Setup hdparm thing (if exists and is needed)
313 if ! strstr "$cmdline" nohdparm; then
314 [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
317 if [ -f /fastboot ] || strstr "$cmdline" "fastboot"; then
323 if [ -f /fsckoptions ]; then
324 fsckoptions=$(cat /fsckoptions)
329 if [ -f /forcefsck ]; then
330 fsckoptions="-f $fsckoptions"
332 # Obey the fs_passno setting for / (see fstab(5))
334 # - make sure we have at least 6 fields
335 _ROOTFS_PASSNO=$(awk '($1 !~ /^#/ && $2 == "/" && NF >= 6) { print $6}' /etc/fstab)
339 _ROOTFS_TYPE=$(awk '$2 == "/" && $3 != "rootfs" { print $3 }' /proc/mounts 2>/dev/null)
341 if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" -a "$_ROOTFS_PASSNO" != 0 ]; then
342 show "Checking root filesystem"; started
343 initlog -c "fsck -C -T -a $fsckoptions /"
347 # A return of 4 or higher means there were serious problems.
348 if [ $rc -gt 3 ]; then
349 [ -e /proc/splash ] && echo "verbose" > /proc/splash
350 # don't use '\n' in nls macro !
353 nls "*** An error occurred during the file system check."
354 nls "*** Dropping you to a shell; the system will reboot"
355 nls "*** when you leave the shell."
358 PS1="`nls '(Repair filesystem)# '`"; export PS1
359 [ "$SELINUX" = "1" ] && disable_selinux
360 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
366 run_cmd "Unmounting file systems" umount -a
367 mount -n -o remount,ro /
368 run_cmd "Automatic reboot in progress" reboot
369 # A return of 2 or 3 means that filesystem was repaired but we need
371 elif [ "$rc" = "2" -o "$rc" = "3" ]; then
372 [ -e /proc/splash ] && echo "verbose" > /proc/splash
374 nls "*** Filesystem was repaired but system needs to be"
375 nls "*** rebooted before mounting it."
376 nls "*** REBOOTING ***"
379 run_cmd "Unmounting file systems" umount -a
380 mount -n -o remount,ro /
381 run_cmd "Automatic reboot in progress" reboot
382 elif [ "$rc" = "1" ]; then
387 # Check for arguments
388 if strstr "$cmdline" nopnp; then
394 # set up pnp and kernel pnp
395 if [ -n "$PNP" ]; then
396 if ! is_no "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
397 run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
399 if ! is_no "$RUN_KERNELPNP"; then
400 /sbin/modprobe -k isa-pnp 2> /dev/null
401 if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
402 show "Setting up ISA PNP devices (kernelspace pnp)"; busy
403 grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail)
408 # Remount the root filesystem read-write
409 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
411 # Update quotas if fsck was run on /
412 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
413 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
416 # Clean up SELinux labels
417 if [ -n "$SELINUX" ]; then
418 for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache ; do
419 [ -r $file ] && restorecon $file >/dev/null 2>&1
424 # Start logging console output since we have all /dev stuff setup
425 if [ "$RC_BOOTLOG" ]; then
430 # Remove stale backups
431 rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~
433 # Remove /etc/nologin when starting system
434 [ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
436 if ! is_no "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
437 show "Enabling Delay Login"; busy
439 nls "System bootup in progress - please wait" >> /etc/nologin
441 chmod 644 /etc/nologin
442 cp -fp /etc/nologin /etc/nologin.boot
446 # The root filesystem is now read-write, so we can now log via
447 # syslog() directly...
448 if [ -n "$IN_INITLOG" ]; then
452 if ! is_yes "$VSERVER"; then
455 [ -f /etc/cryptomtab ] && :>/etc/cryptomtab
457 # Enter root, /proc, /sys, devfs and other into mtab.
460 [ -f /proc/bus/usb/devices ] && mount -f -t usbfs usbfs /proc/bus/usb
461 [ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev
463 if grep -q sysfs /proc/mounts 2>/dev/null; then
464 mount -f -t sysfs sysfs /sys
465 if grep -q securityfs /proc/mounts 2>/dev/null ; then
466 mount -f -t securityfs securityfs /sys/kernel/security
470 if grep -q selinuxfs /proc/mounts 2>/dev/null; then
471 mount -f -t selinuxfs selinuxfs /selinux
474 if grep -q cpuset /proc/mounts 2>/dev/null; then
475 mount -f -t cpuset none /dev/cpuset
478 if [ ! -f /proc/modules ]; then
480 elif ! strstr "$cmdline" nomodules; then
486 # Adjust symlinks as necessary in /boot to keep system services from
487 # spewing messages about mismatched System maps and so on.
488 if ! is_no "$SET_SLINKS"; then
490 if [ -L /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
491 ln -s -f System.map-$uname_r /boot/System.map
493 if [ ! -e /boot/System.map -a -r /boot/System.map-$uname_r ] ; then
494 ln -s -f System.map-$uname_r /boot/System.map
499 # Run depmod if RUN_DEPMOD != "no" and:
500 # a) user requested or RUN_DEPMOD="";
501 # b) modules.dep is missing
502 # c) modules.dep is older than /etc/modules.conf or /lib/modules/`uname -r`
503 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
504 if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
505 run_cmd "Finding module dependencies" depmod -a
506 elif [ "$RUN_DEPMOD" = "ifmissing" ]; then
507 run_cmd "Finding module dependencies" depmod -A
511 if [ -f /proc/sys/kernel/modprobe ]; then
512 if [ -n "$USEMODULES" ]; then
513 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
515 # We used to set this to NULL, but that causes
516 # 'failed to exec' messages"
517 sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
521 # Load usb storage here, to match most other things
522 if [ -n "$needusbstorage" ]; then
523 modprobe -k usb-storage >/dev/null 2>&1
526 # Load firewire devices
527 if ! strstr "$cmdline" nofirewire; then
528 aliases=$(/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print $3 }')
529 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
530 for alias in $aliases ; do
531 [ "$alias" = "off" ] && continue
532 run_cmd "$(nls 'Initializing firewire controller') ($alias)" /sbin/modprobe $alias
534 LC_ALL=C grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && /sbin/modprobe -s sbp2 > /dev/null 2>&1
538 # Load sound modules if they need persistent DMA buffers
539 if [ $(kernelverser) = "002006" ]; then
540 MODULES_CONF=/etc/modprobe.conf
541 elif [ -r /etc/modules.conf ]; then
542 MODULES_CONF=/etc/modules.conf
544 MODULES_CONF=/etc/conf.modules
547 if grep -q "^options sound dmabuf=1" "$MODULES_CONF" 2>/dev/null ; then
549 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
550 if [ -n "$alias" -a "$alias" != "off" ] ; then
551 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
554 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound-slot-0[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
555 if [ -n "$alias" -a "$alias" != "off" ] ; then
556 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
562 if [ -x /etc/rc.d/rc.modules ]; then
566 if [ -x /sbin/multipath ]; then
567 # first make nodes that were discarded due (possible) new /dev mount
568 /sbin/dmsetup mknodes
569 run_cmd "Activating dm-multipath" /sbin/multipath -v 0
570 /sbin/dmsetup ls --target multipath --exec '/sbin/kpartx -a'
573 if [ -x /sbin/dmraid ]; then
574 run_cmd "Activating ATARAID devices" /sbin/dmraid -ay
577 # Find and activate volume groups:
579 if [ -x /sbin/evms_activate ]; then
580 if [ "$(kernelverser)" -lt "002006" ]; then
581 # Linux 2.4 core modules
582 modprobe -s -k evms > /dev/null 2>&1
583 modprobe -s -k evms_passthru > /dev/null 2>&1
584 modprobe -s -k ldev_mgr > /dev/null 2>&1
585 modprobe -s -k dos_part > /dev/null 2>&1
587 # Linux 2.6 core module
588 modprobe -s -k evmscore > /dev/null 2>&1
591 is_yes "$EVMS_GUID_PTABLE" && modprobe -s -k gpt_part >/dev/null 2>&1
592 is_yes "$EVMS_LVM" && modprobe -s -k lvm_vge >/dev/null 2>&1
593 is_yes "$EVMS_AIX" && modprobe -s -k AIXlvm_vge >/dev/null 2>&1
594 is_yes "$EVMS_OS2" && modprobe -s -k os2lvm_vge >/dev/null 2>&1
595 run_cmd "Discovering EVMS volumes" /sbin/evms_activate
596 if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
597 # Link nodes for compatibility with LVM
598 if [ "$(echo /dev/evms/lvm/*)" != '/dev/evms/lvm/*' ] ; then
599 ln -s /dev/evms/lvm/* /dev
604 # LVM (keep in sync with LVM starting after RAID run!)
605 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
606 lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk '{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version: ",""); gsub(/\..*/,"");print $1; exit}')
607 if [ "$lvmversion" = "1" ] ; then
608 modprobe -s -k lvm-mod >/dev/null 2>&1
610 elif [ "$lvmversion" = "2" ] ; then
611 modprobe -s -k dm-mod >/dev/null 2>&1
612 lvmignorelock="--ignorelockingfailure"
614 modprobe -s -k lvm-mod >/dev/null 2>&1
615 # device mapper (2.5+ and patched 2.4)
616 modprobe -s -k dm-mod >/dev/null 2>&1
620 run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelock
621 run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmignorelock
622 [ "$lvmversion" = "2" ] && /sbin/vgmknodes
626 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ] || [ -f /etc/raidtab ]; then
627 modprobe -s md >/dev/null 2>&1
628 if [ -f /proc/mdstat ]; then
632 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
633 if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 2>/dev/null); then
634 run_cmd "Starting up RAID devices" /sbin/mdadm --assemble --scan --auto=yes
636 [ "$rc" -eq 0 ] && goraidtab=0 && golvm=1
640 if [ -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
641 for i in $(awk '!/^#/ && /raiddev/{print $2}' /etc/raidtab 2>/dev/null); do
643 RAIDDEV=$(basename $i)
644 RAIDSTAT=$(grep "^$RAIDDEV : active" /proc/mdstat 2>/dev/null)
645 show "Starting up RAID device %s" $RAIDDEV
647 if [ -z "$RAIDSTAT" ]; then
648 # Try raidstart first...if that fails then
649 # fall back to raid0run and if that fails too
650 # fall back to raidadd, raidrun.
652 if [ -x /sbin/raidstart ]; then
656 if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
660 if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x /sbin/raidrun ]; then
665 if [ $RESULT -gt 0 ]; then
677 # A non-zero return means there were problems
678 if [ $rc -gt 0 ]; then
679 [ -e /proc/splash ] && echo "verbose" > /proc/splash
680 show "Starting up RAID devices"; fail
683 nls "*** An error occurred during the RAID startup."
684 nls "*** Dropping you to a shell; the system will reboot"
685 nls "*** when you leave the shell."
688 PS1="$(nls '(RAID Repair)# ')"; export PS1
689 [ "$SELINUX" = "1" ] && disable_selinux
690 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
696 run_cmd "Unmounting file systems" umount -a
697 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
698 run_cmd "Automatic reboot in progress" reboot
700 # LVM on RAID (keep in sync with LVM setting few lines above)
701 if [ "$golvm" -eq "1" ]; then
702 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
703 run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelock
704 run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmignorelock
705 [ "$lvmversion" = "2" ] && /sbin/vgmknodes
708 show "Starting up RAID devices"; ok
714 if [ -z "$fastboot" ] && ! strstr "$cmdline" nofsck; then
715 rc_splash "fsck start"
716 show "Checking filesystems"; started
717 initlog -c "fsck -C -T -R -A -a -P $fsckoptions"
721 # A return of 2 or higher means there were serious problems
722 if [ $rc -gt 1 ]; then
723 [ -e /proc/splash ] && echo "verbose" > /proc/splash
726 nls "*** An error occurred during the file system check."
727 nls "*** Dropping you to a shell; the system will reboot"
728 nls "*** when you leave the shell."
731 PS1="$(nls '(Repair filesystem)# ')"; export PS1
732 [ "$SELINUX" = "1" ] && disable_selinux
733 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
739 run_cmd "Unmounting file systems" umount -a
740 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
741 run_cmd "Automatic reboot in progress" reboot
742 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
745 rc_splash "fsck stop"
748 # Mount all other filesystems (except for NFS and /proc, which is already
749 # mounted). Contrary to standard usage,
750 # filesystems are NOT unmounted in single user mode.
752 run_cmd "Mounting local filesystems" mount -a -t nonfs,nfs4,smbfs,ncpfs,proc,cifs -O no_netdev
754 # now we have /usr mounted, recheck if we have gettext and tput available.
755 if is_no "$TPUT"; then
761 # Now do some workaround - encrypted filesystems couldn't have been fsck-ed
762 # before mount - that's where the password is entered.
763 # mount is buggy - when remounting loopback filesystem, loop=XXX
764 # option is removed from /etc/mtab
765 if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
766 show "Checking encrypted filesystems"; started
767 LOOPLIST="$(LC_ALL=C awk '
768 FILENAME=="/proc/mounts" {
771 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ {
772 if ($2 in TAB){print TAB[$2];}
774 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
775 if ($2 in TAB){print TAB[$2];}
776 sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
777 cmd="mount " $2 " -o remount," $4;
780 ' /proc/mounts /etc/fstab)"
781 initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
784 # A return of 2 or higher means there were serious problems.
785 if [ $rc -gt 1 ]; then
786 [ -e /proc/splash ] && echo "verbose" > /proc/splash
789 nls "*** An error occurred during the file system check."
790 nls "*** Dropping you to a shell; the system will reboot"
791 nls "*** when you leave the shell."
794 PS1="$(nls '(Repair filesystem)# ')"; export PS1
795 [ "$SELINUX" = "1" ] && disable_selinux
796 if ! is_no "$RUN_SULOGIN_ON_ERR"; then
802 run_cmd "Unmounting file systems" umount -a
803 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
804 run_cmd "Automatic reboot in progress" reboot
805 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
809 show "Remounting encrypted filesystems back in rw mode"; busy
811 FILENAME=="/proc/mounts" {
814 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
815 sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
816 cmd="mount " $2 " -o remount," $4;
819 ' /proc/mounts /etc/fstab
823 # /var/log should be writable now, so start saving the boot output
824 if [ "$RC_BOOTLOG" ]; then
825 echo > /var/log/boot.msg
829 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
830 run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa
834 if [ -x /sbin/quotaon ]; then
835 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
838 # Turn on process accounting
839 if [ -x /etc/rc.d/rc.acct ]; then
840 /etc/rc.d/rc.acct start
843 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
844 if is_yes "$TIME_SETUP_DELAYED" && [ -e /dev/rtc ]; then
845 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
846 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
850 # Initialize the serial ports
851 if [ -f /etc/rc.d/rc.serial ]; then
852 . /etc/rc.d/rc.serial
855 if [ -f /proc/sys/kernel/panic -a -n "$PANIC_REBOOT_TIME" -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
856 show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
857 if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME >/dev/null 2>&1); then ok; else fail; fi
860 # ... and here finish configuring parameters
861 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
863 # /var/log should be writable now, so start saving the boot output
864 if [ "$RC_BOOTLOG" ]; then
865 echo > /var/log/boot.msg
873 [ -n "$SELINUX" ] && [ -f /.autorelabel ] && relabel_selinux
876 rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff
879 for afile in /var/lock/* /var/run/*; do
881 if [ -d "$afile" ]; then
890 [ "$bafile" != "hwprofile" ] && rm -f $afile 2> /dev/null
894 rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \
895 /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
896 rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
897 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
898 /tmp/scrollkeeper-* /tmp/ssh-*
902 if ! is_no "$NEED_XFILES"; then
905 chown root:utmp /var/run/utmpx /var/log/wtmpx
906 chmod 0664 /var/run/utmpx /var/log/wtmpx
910 chown root:utmp /var/run/utmp /var/log/wtmp
911 chmod 0664 /var/run/utmp /var/log/wtmp
915 if is_yes "$CLEAN_TMP"; then
916 # XXX LC_ALL needed here
917 rm -rf /tmp/* /tmp/.[a-zA-Z0-9]*
920 # System protected dirs
921 mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1
922 chown root:root /tmp/.ICE-unix
923 [ -n "$SELINUX" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1
925 if ! is_yes "$VSERVER"; then
926 run_cmd "Enabling swap space" /bin/true
927 # Right, now turn on swap in case we swap to files
928 swapon -a >/dev/null 2>&1
930 # If a SCSI tape has been detected, load the st module unconditionally
931 # since many SCSI tapes don't deal well with st being loaded and unloaded
932 if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
933 if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
934 if [ -n "$USEMODULES" ] ; then
935 # Try to load the module. If it fails, ignore it...
936 insmod -p st >/dev/null 2>&1 && modprobe -s st >/dev/null 2>&1
941 # Now that we have all of our basic modules loaded and the kernel going,
942 # let's dump the syslog ring somewhere so we can find it later
943 dmesg -s 131072 > /var/log/dmesg
945 while [ $i -ge 0 ]; do
946 if [ -f /var/log/dmesg.$i ]; then
947 chmod 0600 /var/log/dmesg.$i
948 mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
952 cp -f /var/log/dmesg /var/log/dmesg.0
953 chmod 0600 /var/log/dmesg /var/log/dmesg.0
956 kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
959 # extra check if the background process we just spawned is still running,
960 # as in case of vserver bootup it finishes quite instantly.
961 if ! is_no "$RC_PROMPT" && [ -d /proc/$! ]; then
962 /sbin/getkey -c 5 i && touch /var/run/confirm
967 # This must be last line !