3 # /etc/rc.d/rc.sysinit - run once at boot time
6 # Taken in part from Miquel van Smoorenburg's bcheckrc.
7 # Changes: Arkadiusz Mi¶kiewicz <misiek@pld-linux.org>
11 PATH=/bin:/sbin:/usr/bin:/usr/sbin
14 # reasonable start values for bootsplash progress.
20 . /etc/rc.d/init.d/functions
22 # we need /proc mounted before everything
23 mount -n -o gid=17 -t proc /proc /proc
25 # sysfs is also needed before any other things (under kernel > 2.5)
26 if grep -q sysfs /proc/filesystems 2>/dev/null ; then
27 mount -n -o gid=17 -t sysfs sysfs /sys
31 if grep -q selinuxfs /proc/filesystems 2>/dev/null && ! grep -q selinuxfs /proc/mounts 2>/dev/null; then
32 mount -n -o gid=17 -t selinuxfs selinuxfs /selinux
35 if [ $(kernelverser) = "002006" ]; then
36 MODULES_CONF=/etc/modprobe.conf
37 elif [ -r /etc/modules.conf ]; then
38 MODULES_CONF=/etc/modules.conf
40 MODULES_CONF=/etc/conf.modules
44 if [ -x /etc/rc.d/rc.live ]; then
48 # Choose Hardware profile
49 rm -f /var/run/hwprofile 2> /dev/null
50 if [ -f /etc/sysconfig/hwprof ]; then
51 . /etc/sysconfig/hwprof
52 if is_yes "${HWPROFILES}" && [ -x /sbin/hwprofile -a -d /etc/sysconfig/hwprofiles/data ]; then
53 mount -n / -o rw,remount
55 mount -n / -o ro,remount
60 if [ -r /etc/sysconfig/i18n ]; then
62 [ -n "$LANG" ] && export LANG || unset LANG
63 [ -n "$LC_CTYPE" ] && export LC_CTYPE || unset LC_CTYPE
64 [ -n "$LC_COLLATE" ] && export LC_COLLATE || unset LC_COLLATE
65 [ -n "$LC_MESSAGES" ] && export LC_MESSAGES || unset LC_MESSAGES
66 [ -n "$LC_NUMERIC" ] && export LC_NUMERIC || unset LC_NUMERIC
67 [ -n "$LC_MONETARY" ] && export LC_MONETARY || unset LC_MONETARY
68 [ -n "$LC_TIME" ] && export LC_TIME || unset LC_TIME
69 [ -n "$LC_ALL" ] && export LC_ALL || unset LC_ALL
70 [ -n "$LANGUAGE" ] && export LANGUAGE || unset LANGUAGE
71 [ -n "$LINGUAS" ] && export LINGUAS || unset LINGUAS
74 # Read network config data
75 if [ -r /etc/sysconfig/network ]; then
76 . /etc/sysconfig/network
82 # Read system config data
83 if [ -r /etc/sysconfig/system ]; then
84 . /etc/sysconfig/system
86 RUN_SULOGIN_ON_ERR=yes
97 # Disable splash when requested
98 [ -e /proc/splash ] && is_no "$BOOT_SPLASH" && echo "0" > /proc/splash
100 # Check SELinux status
101 selinuxfs=$(awk '/ selinuxfs / { print $2 }' /proc/mounts)
103 if [ -n "$selinuxfs" ] && [ "$(cat /proc/self/attr/current)" != "kernel" ]; then
104 if [ -r $selinuxfs/enforce ] ; then
105 SELINUX=$(cat $selinuxfs/enforce)
107 # assume enforcing if you can't read it
112 if [ -x /sbin/restorecon ] && LC_ALL=C fgrep -q " /dev " /proc/mounts 2>/dev/null ; then
113 /sbin/restorecon -R /dev 2>/dev/null
117 if [ "$CONSOLETYPE" = "vt" -a -x /sbin/setsysfont ]; then
118 run_cmd "Setting default font" /sbin/setsysfont
121 # Print welcome message
122 nls "\t\t\t%sPowered by %sPLD Linux Distribution%s" "$(termput setaf $CPOWEREDBY)" "$(termput setaf $CPLD)" "$(termput op)"
123 if is_yes "$PROMPT"; then
124 nls -n "\t\t Press %sI%s to enter interactive startup" "$(termput setaf $CI)" "$(termput op)"
129 # Set console loglevel
130 if [ -n "$CONSOLE_LOGLEVEL" ]; then
131 /bin/dmesg -n $CONSOLE_LOGLEVEL
134 if [ -f /etc/udev/udev.conf ];then
135 . /etc/udev/udev.conf
138 [ -x /sbin/start_udev ] && run_cmd "Starting udev" /sbin/start_udev
140 # /dev must be also mounted before everything but only if we want use them ;-)
141 if is_yes "$MOUNT_DEVFS"; then
142 run_cmd "Mounting Device Filesystem" mount -n -t devfs /dev /dev
146 if [ -e /dev/.devfsd -a -x /sbin/devfsd ]; then
147 run_cmd "Starting Device Filesystem Daemon" /sbin/devfsd /dev
150 # cpuset support (mounted unconditionally, shouldn't be a problem)
151 if grep -q cpuset /proc/filesystems 2>/dev/null ; then
152 mount -n -t cpuset none /dev/cpuset
155 # Configure Linux kernel (initial configuration, some required modules still
157 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
159 # Set the system clock.
164 if [ -f /etc/sysconfig/clock ]; then
165 . /etc/sysconfig/clock
167 # convert old style clock config to new values
168 if [ "${CLOCKMODE}" = "GMT" ]; then
170 elif [ "${CLOCKMODE}" = "ARC" ]; then
175 if grep "system serial" /proc/cpuinfo 2>/dev/null | grep -q MILO 2>/dev/null ; then
180 CLOCKFLAGS="--hctosys"
182 if is_yes "$UTC" ; then
183 CLOCKFLAGS="$CLOCKFLAGS --utc"
184 CLOCKDEF="$CLOCKDEF (utc)"
186 CLOCKFLAGS="$CLOCKFLAGS --localtime"
187 CLOCKDEF="$CLOCKDEF (local)"
190 if is_yes "$ARC" ; then
191 CLOCKFLAGS="$CLOCKFLAGS -A"
192 CLOCKDEF="$CLOCKDEF (arc)"
195 if is_yes "$SRM" ; then
196 CLOCKFLAGS="$CLOCKFLAGS -S"
197 CLOCKDEF="$CLOCKDEF (srm)"
200 # Check if timezone definition is available
201 if [ -e /etc/localtime ] ; then
202 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
203 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
206 TIME_SETUP_DELAYED=yes
210 run_cmd "Activating swap partitions" swapon -a -e
213 run_cmd "$(nls 'Host:') ${HOSTNAME}" hostname ${HOSTNAME}
215 # Set the NIS domain name
216 if [ -n "$NISDOMAIN" ]; then
217 run_cmd "$(nls 'NIS Domain:') ${NISDOMAIN}" domainname $NISDOMAIN
222 # Initialize USB controllers
224 if ! grep -iq "nousb" /proc/cmdline 2>/dev/null && ! grep -q "usb" /proc/devices 2>/dev/null ; then
225 aliases=$(/sbin/modprobe -c | awk '/^alias usb-controller/ { print $3 }')
226 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
227 /sbin/modprobe -k usbcore
228 for alias in $aliases ; do
229 [ "$alias" = "off" ] && continue
230 run_cmd "$(nls 'Initializing USB controller') ($alias)" /sbin/modprobe $alias
232 [ $? -eq 0 -a -n "$aliases" ] && usb=1
234 if grep -iq "usb" /proc/devices 2>/dev/null ; then
239 if [ "$usb" = "1" -a ! -f /proc/bus/usb/devices ]; then
240 run_cmd "Mounting USB filesystem" mount -t usbfs usbfs /proc/bus/usb
244 if [ "$usb" = "1" ]; then
245 needusbstorage=$(LC_ALL=C cat /proc/bus/usb/devices 2>/dev/null|grep -e "^I.*Cls=08" 2>/dev/null)
246 if [ "$(kernelverser)" -lt "002006" ]; then
247 LC_ALL=C grep -q 'hid' /proc/bus/usb/drivers 2>/dev/null || run_cmd "Initializing USB HID interface" modprobe hid 2> /dev/null
248 mouseoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=02" 2>/dev/null)
249 kbdoutput=$(cat /proc/bus/usb/devices 2>/dev/null|grep -E "^I.*Cls=03.*Prot=01" 2>/dev/null)
250 if [ -n "$kbdoutput" ]; then
251 run_cmd "Initializing USB keyboard" modprobe keybdev
253 if [ -n "$mouseoutput" ]; then
254 run_cmd "Initializing USB mouse" modprobe mousedev
259 # Setup hdparm thing (if exists and is needed)
260 if ! grep -iq nohdparm /proc/cmdline 2>/dev/null; then
261 [ -x /etc/rc.d/rc.hdparm ] && /etc/rc.d/rc.hdparm
264 if [ -f /fastboot ] || grep -iq "fastboot" /proc/cmdline 2>/dev/null ; then
270 if [ -f /fsckoptions ]; then
271 fsckoptions=$(cat /fsckoptions)
276 if [ -f /forcefsck ]; then
277 fsckoptions="-f $fsckoptions"
281 _ROOTFS_TYPE=$(grep " / " /proc/mounts 2>/dev/null | awk '{ print $3 }')
283 if [ -z "$fastboot" -a "$_ROOTFS_TYPE" != "nfs" -a "$_ROOTFS_TYPE" != "romfs" ]; then
284 show "Checking root filesystem"; started
285 initlog -c "fsck -C -T -a $fsckoptions /"
289 # A return of 4 or higher means there were serious problems.
290 if [ $rc -gt 3 ]; then
291 [ -e /proc/splash ] && echo "verbose" > /proc/splash
292 # don't use '\n' in nls macro !
295 nls "*** An error occurred during the file system check."
296 nls "*** Dropping you to a shell; the system will reboot"
297 nls "*** when you leave the shell."
300 PS1="$(nls '(Repair filesystem)# ')"; export PS1
301 [ "$SELINUX" = "1" ] && disable_selinux
302 if is_yes "$RUN_SULOGIN_ON_ERR"; then
308 run_cmd "Unmounting file systems" umount -a
309 mount -n -o remount,ro /
310 run_cmd "Automatic reboot in progress" reboot
311 # A return of 2 or 3 means that filesystem was repaired but we need
313 elif [ "$rc" = "2" -o "$rc" = "3" ]; then
314 [ -e /proc/splash ] && echo "verbose" > /proc/splash
316 nls "*** Filesystem was repaired but system needs to be"
317 nls "*** rebooted before mounting it."
318 nls "*** REBOOTING ***"
321 run_cmd "Unmounting file systems" umount -a
322 mount -n -o remount,ro /
323 run_cmd "Automatic reboot in progress" reboot
324 elif [ "$rc" = "1" ]; then
329 # Unmount the initrd, if necessary
330 if LC_ALL=C grep -q /initrd /proc/mounts 2>/dev/null && ! LC_ALL=C grep -q /initrd/loopfs /proc/mounts 2>/dev/null ; then
331 if [ -e /initrd/dev/.devfsd ]; then
335 /sbin/blockdev --flushbufs /dev/ram0 >/dev/null 2>&1
338 # Check for arguments
339 if grep -iq nopnp /proc/cmdline 2>/dev/null; then
345 # set up pnp and kernel pnp
346 if [ -n "$PNP" ]; then
347 if is_yes "$RUN_USERPNP" && [ -x /sbin/isapnp -a -f /etc/isapnp/isapnp.conf ]; then
348 run_cmd "Setting up ISA PNP devices (userspace pnp)" /sbin/isapnp /etc/isapnp/isapnp.conf
350 if is_yes "$RUN_KERNELPNP"; then
351 /sbin/modprobe -k isa-pnp 2> /dev/null
352 if [ -e /proc/isapnp -a -f /etc/isapnp/isapnp-kernel.conf ]; then
353 show "Setting up ISA PNP devices (kernelspace pnp)"; busy
354 grep -v "^#" /etc/isapnp/isapnp-kernel.conf 2>/dev/null >/proc/isapnp && (deltext; ok) || (deltext; fail)
359 # Remount the root filesystem read-write
360 run_cmd "Remounting root filesystem in rw mode" mount -n -o remount,rw /
362 # Update quotas if fsck was run on /
363 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
364 run_cmd "Checking root filesystem quotas" /sbin/quotacheck -vnug /
367 # Clean up SELinux labels
368 if [ -n "$SELINUX" ]; then
369 for file in /etc/mtab /etc/cryptomtab /etc/ld.so.cache ; do
370 [ -r $file ] && restorecon $file >/dev/null 2>&1
376 [ -f /etc/cryptomtab ] && :>/etc/cryptomtab
378 # Remove stale backups
379 rm -f /etc/mtab~ /etc/mtab~~ /etc/cryptomtab~ /etc/cryptomtab~~
381 # Enter root, /proc, /sys, devfs and other into mtab.
384 [ -f /proc/bus/usb/devices ] && mount -f -t usbfs usbfs /proc/bus/usb
385 [ -e /dev/.devfsd ] && mount -f -t devfs devfs /dev
387 if grep -q sysfs /proc/filesystems 2>/dev/null ; then
388 mount -f -t sysfs sysfs /sys
391 if grep -q selinuxfs /proc/filesystems 2>/dev/null ; then
392 mount -f -t selinuxfs selinuxfs /selinux
395 if grep -q cpuset /proc/filesystems 2>/dev/null ; then
396 mount -n -t cpuset none /dev/cpuset
399 # Remove /etc/nologin when starting system
400 [ -f /etc/nologin.boot ] && rm -f /etc/nologin /etc/nologin.boot
402 if is_yes "$DELAY_LOGIN" && [ ! -f /etc/nologin ]; then
403 show "Enabling Delay Login"; busy
405 nls "System bootup in progress - please wait" >> /etc/nologin
407 chmod 644 /etc/nologin
408 cp -fp /etc/nologin /etc/nologin.boot
412 # The root filesystem is now read-write, so we can now log via
413 # syslog() directly...
414 if [ -n "$IN_INITLOG" ]; then
418 if [ ! -f /proc/modules ]; then
420 elif ! grep -iq nomodules /proc/cmdline 2>/dev/null; then
426 # Adjust symlinks as necessary in /boot to keep system services from
427 # spewing messages about mismatched System maps and so on.
428 if is_yes "$SET_SLINKS"; then
429 if [ -L /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
430 ln -s -f System.map-`uname -r` /boot/System.map
432 if [ ! -e /boot/System.map -a -r /boot/System.map-`uname -r` ] ; then
433 ln -s -f System.map-`uname -r` /boot/System.map
437 # Run depmod if RUN_DEPMOD != "no" and:
438 # a) user requested or RUN_DEPMOD="";
439 # b) modules.dep is missing
440 # c) modules.dep is older than /etc/modules.conf or /lib/modules/`uname -r`
441 if ! is_no "$RUN_DEPMOD" && [ -n "$USEMODULES" ]; then
442 if is_yes "$RUN_DEPMOD" || [ -z "$RUN_DEPMOD" ]; then
443 run_cmd "Finding module dependencies" depmod -a
444 elif [ "$RUN_DEPMOD" = "ifmissing" ]; then
445 run_cmd "Finding module dependencies" depmod -A
449 if [ -f /proc/sys/kernel/modprobe ]; then
450 if [ -n "$USEMODULES" ]; then
451 sysctl -w kernel.modprobe="/sbin/modprobe" >/dev/null 2>&1
452 sysctl -w kernel.hotplug="/sbin/hotplug" >/dev/null 2>&1
454 # We used to set this to NULL, but that causes
455 # 'failed to exec' messages"
456 sysctl -w kernel.modprobe="/bin/true" >/dev/null 2>&1
457 sysctl -w kernel.hotplug="/bin/true" >/dev/null 2>&1
461 # Load usb storage here, to match most other things
462 if [ -n "$needusbstorage" ]; then
463 modprobe -k usb-storage >/dev/null 2>&1
466 # Load firewire devices
467 if ! grep -iq "nofirewire" /proc/cmdline 2>/dev/null ; then
468 aliases=$(/sbin/modprobe -c | awk '/^alias ieee1394-controller/ { print $3 }')
469 if [ -n "$aliases" -a "$aliases" != "off" ] ; then
470 for alias in $aliases ; do
471 [ "$alias" = "off" ] && continue
472 run_cmd "$(nls 'Initializing firewire controller') ($alias)" /sbin/modprobe $alias
474 LC_ALL=C grep -E "SBP2" /proc/bus/ieee1394/devices 2>/dev/null && /sbin/modprobe -s sbp2 > /dev/null 2>&1
478 # Load sound modules if they need persistent DMA buffers
479 if grep -q "^options sound dmabuf=1" "$MODULES_CONF" 2>/dev/null ; then
481 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
482 if [ -n "$alias" -a "$alias" != "off" ] ; then
483 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
486 alias=$(/sbin/modprobe -c | egrep -s "^alias[[:space:]]+sound-slot-0[[:space:]]+" 2>/dev/null | awk '{ print $3 }')
487 if [ -n "$alias" -a "$alias" != "off" ] ; then
488 run_cmd "$(nls 'Loading sound module') ($alias)" modprobe -s $alias
494 if [ -x /etc/rc.d/rc.modules ]; then
498 # Find and activate volume groups:
500 if [ -x /sbin/evms_activate ]; then
502 if [ "$(kernelverser)" -lt "002006" ]; then
503 # Linux 2.4 core modules
504 modprobe -s -k evms > /dev/null 2>&1
505 modprobe -s -k evms_passthru > /dev/null 2>&1
506 modprobe -s -k ldev_mgr > /dev/null 2>&1
507 modprobe -s -k dos_part > /dev/null 2>&1
509 # Linux 2.6 core module
510 modprobe -s -k evmscore > /dev/null 2>&1
513 is_yes "$EVMS_GUID_PTABLE" && modprobe -s -k gpt_part >/dev/null 2>&1
514 is_yes "$EVMS_LVM" && modprobe -s -k lvm_vge >/dev/null 2>&1
515 is_yes "$EVMS_AIX" && modprobe -s -k AIXlvm_vge >/dev/null 2>&1
516 is_yes "$EVMS_OS2" && modprobe -s -k os2lvm_vge >/dev/null 2>&1
517 run_cmd "Discovering EVMS volumes" /sbin/evms_activate
518 if is_yes "$EVMS_LVM" && is_yes "$EVMS_LVM_COMPAT_NODES" ; then
519 # Link nodes for compatibility with LVM
520 if [ "echo /dev/evms/lvm/*" != '/dev/evms/lvm/*' ] ; then
521 ln -s /dev/evms/lvm/* /dev/
525 # LVM (keep in sync with LVM starting after RAID run!)
526 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
527 lvmversion=$(/sbin/vgchange --version 2>/dev/null | awk '{gsub("vgchange: Logical Volume Manager ",""); gsub("LVM version: ",""); gsub(/\..*/,"");print $1; exit}')
528 if [ "$lvmversion" = "1" ] ; then
529 modprobe -s -k lvm-mod >/dev/null 2>&1
531 elif [ "$lvmversion" = "2" ] ; then
532 modprobe -s -k dm-mod >/dev/null 2>&1
533 lvmignorelock="--ignorelockingfailure"
535 modprobe -s -k lvm-mod >/dev/null 2>&1
536 # device mapper (2.5+ and patched 2.4)
537 modprobe -s -k dm-mod >/dev/null 2>&1
542 run_cmd "Scanning for LVM volume groups" /sbin/vgscan $lvmignorelock && \
543 run_cmd "Activating LVM volume groups" /sbin/vgchange -a y $lvmignorelock
544 [ "$lvmversion" = "2" ] && /sbin/vgscan --mknodes $lvmignorelock > /dev/null 2>&1
549 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ] || [ -f /etc/raidtab ]; then
551 modprobe -s md >/dev/null 2>&1
552 if [ -f /proc/mdstat ]; then
557 if [ -x /sbin/mdadm -a -f /etc/mdadm.conf ]; then
558 if (grep -qE "^([[:blank:]]|)ARRAY[[:blank:]]" /etc/mdadm.conf 2>/dev/null); then
559 run_cmd "Starting up RAID devices" /sbin/mdadm --assemble --scan
561 [ "$rc" -eq 0 ] && goraidtab=0 && golvm=1
565 if [ -f /etc/raidtab -a "$goraidtab" -eq 1 ]; then
567 for i in $(grep -v "^#" /etc/raidtab 2>/dev/null | grep "raiddev" 2>/dev/null | awk '{print $2}') ; do
569 RAIDDEV=$(basename $i)
570 RAIDSTAT=$(grep "^$RAIDDEV : active" /proc/mdstat 2>/dev/null)
571 show "Starting up RAID device %s" $RAIDDEV
573 if [ -z "$RAIDSTAT" ]; then
574 # Try raidstart first...if that fails then
575 # fall back to raid0run and if that fails too
576 # fall back to raidadd, raidrun.
578 if [ -x /sbin/raidstart ]; then
582 if [ $RESULT -gt 0 -a -x /sbin/raid0run ]; then
586 if [ $RESULT -gt 0 -a -x /sbin/raidadd -a -x /sbin/raidrun ]; then
591 if [ $RESULT -gt 0 ]; then
603 # A non-zero return means there were problems
604 if [ $rc -gt 0 ]; then
605 [ -e /proc/splash ] && echo "verbose" > /proc/splash
606 show "Starting up RAID devices"; fail
609 nls "*** An error occurred during the RAID startup."
610 nls "*** Dropping you to a shell; the system will reboot"
611 nls "*** when you leave the shell."
614 PS1="$(nls '(RAID Repair)# ')"; export PS1
615 [ "$SELINUX" = "1" ] && disable_selinux
616 if is_yes "$RUN_SULOGIN_ON_ERR"; then
622 run_cmd "Unmounting file systems" umount -a
623 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
624 run_cmd "Automatic reboot in progress" reboot
626 # LVM on RAID (keep in sync with LVM setting few lines above)
627 if [ "$golvm" -eq "1" ]; then
628 if is_yes "$EVMS_LVM" || [ -x /sbin/vgscan -a -x /sbin/vgchange ]; then
629 run_cmd "Scanning for LVM volume groups (on RAID)" /sbin/vgscan $lvmignorelock && \
630 run_cmd "Activating LVM volume groups (on RAID)" /sbin/vgchange -a y $lvmignorelock
631 [ "$lvmversion" = "2" ] && /sbin/vgscan --mknodes $lvmignorelock > /dev/null 2>&1
634 show "Starting up RAID devices"; ok
640 if [ -z "$fastboot" ] && ! grep -q nofsck /proc/cmdline 2>/dev/null; then
641 rc_splash "fsck start"
642 show "Checking filesystems"; started
643 initlog -c "fsck -C -T -R -A -a $fsckoptions"
647 # A return of 2 or higher means there were serious problems
648 if [ $rc -gt 1 ]; then
649 [ -e /proc/splash ] && echo "verbose" > /proc/splash
652 nls "*** An error occurred during the file system check."
653 nls "*** Dropping you to a shell; the system will reboot"
654 nls "*** when you leave the shell."
657 PS1="$(nls '(Repair filesystem)# ')"; export PS1
658 [ "$SELINUX" = "1" ] && disable_selinux
659 if is_yes "$RUN_SULOGIN_ON_ERR"; then
665 run_cmd "Unmounting file systems" umount -a
666 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
667 run_cmd "Automatic reboot in progress" reboot
668 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
671 rc_splash "fsck stop"
674 # Mount all other filesystems (except for NFS and /proc, which is already
675 # mounted). Contrary to standard usage,
676 # filesystems are NOT unmounted in single user mode.
678 run_cmd "Mounting local filesystems" mount -a -t nonfs,smbfs,ncpfs,proc,cifs -O no_netdev
680 # Now do some workaround - encrypted filesystems couldn't have been fsck-ed
681 # before mount - that's where the password is entered.
682 # mount is buggy - when remounting loopback filesystem, loop=XXX
683 # option is removed from /etc/mtab
684 if [ -z "$fastboot" ] && grep "^[^#].*encryption=" /etc/fstab 2>/dev/null | grep -v -q "noauto" 2>/dev/null; then
685 show "Checking encrypted filesystems"; started
687 FILENAME=="/proc/mounts" {
690 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && /[^a-zA-Z_]ro[^a-zA-Z_]/ {
691 if ($2 in TAB){print TAB[$2];}
693 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
694 if ($2 in TAB){print TAB[$2];}
695 sub("loop(=[^,]*)?","loop=" TAB[$2] ",ro",$4);
696 cmd="mount " $2 " -o remount," $4;
699 ' /proc/mounts /etc/fstab)"
700 initlog -c "fsck -T -C -a $fsckoptions $LOOPLIST"
703 # A return of 2 or higher means there were serious problems.
704 if [ $rc -gt 1 ]; then
705 [ -e /proc/splash ] && echo "verbose" > /proc/splash
708 nls "*** An error occurred during the file system check."
709 nls "*** Dropping you to a shell; the system will reboot"
710 nls "*** when you leave the shell."
713 PS1="`nls '(Repair filesystem)# '`"; export PS1
714 [ "$SELINUX" = "1" ] && disable_selinux
715 if is_yes "$RUN_SULOGIN_ON_ERR"; then
721 run_cmd "Unmounting file systems" umount -a
722 run_cmd "Remounting root filesystem in ro mode" mount -n -o remount,ro /
723 run_cmd "Automatic reboot in progress" reboot
724 elif [ "$rc" = "1" -a -x /sbin/quotacheck ]; then
728 show "Remounting encrypted filesystems back in rw mode"; busy
730 FILENAME=="/proc/mounts" {
733 FILENAME=="/etc/fstab" && /encryption=/ && ! /noauto/ && ! /[^a-zA-Z_]ro[^a-zA-Z_]/ {
734 sub("loop(=[^,]*)?","loop=" TAB[$2] ",rw",$4);
735 cmd="mount " $2 " -o remount," $4;
738 ' /proc/mounts /etc/fstab
742 if [ "$_RUN_QUOTACHECK" = "1" -a -x /sbin/quotacheck ]; then
743 run_cmd "Checking filesystem quotas" /sbin/quotacheck -vnugRa
747 if [ -x /sbin/quotaon ]; then
748 run_cmd "Turning on quotas for local filesystems" /sbin/quotaon -aug
751 [ -n "$SELINUX" ] && [ -f /.autorelabel ] && relabel_selinux
753 # Turn on process accounting
754 if [ -x /etc/rc.d/rc.acct ]; then
755 /etc/rc.d/rc.acct start
758 # Set the clock if timezone definition wasn't available (eg. /usr not mounted)
759 if is_yes "$TIME_SETUP_DELAYED"; then
760 if run_cmd "$(nls 'Setting clock')$CLOCKDEF" /sbin/hwclock $CLOCKFLAGS; then
761 show "$(nls 'Today`s date:') $(LC_CTYPE=C date)"; ok
765 # Initialize the serial ports
766 if [ -f /etc/rc.d/rc.serial ]; then
767 . /etc/rc.d/rc.serial
770 if [ -f /proc/sys/kernel/panic -a "$PANIC_REBOOT_TIME" -gt "0" ]; then
771 show 'Setting %s seconds for kernel reboot after panic' "$PANIC_REBOOT_TIME"; busy
772 if (sysctl -w kernel.panic=$PANIC_REBOOT_TIME >/dev/null 2>&1); then ok; else fail; fi
775 # ... and here finish configuring parameters
776 /sbin/sysctl -e -p /etc/sysctl.conf > /dev/null 2>&1
779 rm -f /fastboot /fsckoptions /forcefsck /halt /poweroff
782 # I'd use find, but /usr may not be mounted.
783 for afile in /var/lock/* /var/run/*; do
784 bafile=$(basename $afile)
785 if [ -d "$afile" ]; then
786 [ "$bafile" != "news" -a "$bafile" != "sudo" -a "$bafile" != "mon" ] && rm -rf $afile/*
788 [ "$bafile" != "hwprofile" ] && rm -f $afile 2> /dev/null
792 rm -f /var/lib/rpm/__db* /var/spool/postoffice/.pid.* /tmp/.X*-lock \
793 /tmp/.lock.* /tmp/.gdm_socket /tmp/.s.PGSQL.*
794 rm -rf /tmp/.X*-unix /tmp/.ICE-unix /tmp/.font-unix /tmp/hsperfdata_* \
795 /tmp/kde-* /tmp/ksocket-* /tmp/mc-* /tmp/mcop-* /tmp/orbit-* \
796 /tmp/scrollkeeper-* /tmp/ssh-*
800 if ! is_no "$NEED_XFILES" ; then
803 chown root.utmp /var/run/utmpx /var/log/wtmpx
804 chmod 0664 /var/run/utmpx /var/log/wtmpx
808 chown root.utmp /var/run/utmp /var/log/wtmp
809 chmod 0664 /var/run/utmp /var/log/wtmp
813 if is_yes "$CLEAN_TMP"; then
814 rm -rf /tmp/* /tmp/.[a-zA-Z0-9]*
817 # System protected dirs
818 mkdir -m 1777 -p /tmp/.ICE-unix > /dev/null 2>&1
819 chown root:root /tmp/.ICE-unix
820 [ -n "$SELINUX" ] && restorecon /tmp/.ICE-unix >/dev/null 2>&1
822 # Right, now turn on swap in case we swap to files
823 swapon -a >/dev/null 2>&1
824 run_cmd "Enabling swap space" /bin/true
826 # If a SCSI tape has been detected, load the st module unconditionally
827 # since many SCSI tapes don't deal well with st being loaded and unloaded
828 if [ -f /proc/scsi/scsi ] && grep -q 'Type: Sequential-Access' /proc/scsi/scsi 2>/dev/null ; then
829 if grep -qv ' 9 st' /proc/devices 2>/dev/null; then
830 if [ -n "$USEMODULES" ] ; then
831 # Try to load the module. If it fails, ignore it...
832 insmod -p st >/dev/null 2>&1 && modprobe -s st >/dev/null 2>&1
837 # There could be a new kernel version. Remove old psdevtab database
840 # Now that we have all of our basic modules loaded and the kernel going,
841 # let's dump the syslog ring somewhere so we can find it later
842 dmesg -s 131072 > /var/log/dmesg
844 while [ $i -ge 0 ]; do
845 if [ -f /var/log/dmesg.$i ]; then
846 chmod 0600 /var/log/dmesg.$i
847 mv -f /var/log/dmesg.$i /var/log/dmesg.$(($i+1))
851 cp -f /var/log/dmesg /var/log/dmesg.0
852 chmod 0600 /var/log/dmesg /var/log/dmesg.0
854 kill -TERM $(/sbin/pidof getkey) >/dev/null 2>&1
856 if is_yes "$PROMPT"; then
857 /sbin/getkey i && touch /var/run/confirm
862 # This must be last line !
863 # vi:syntax=sh:ts=8:sw=4