Difference between revisions of "Installation on Slackware 13"

From Linux-VServer

Jump to: navigation, search
(Apply the patch and start the guest)
(Patch used)
Line 246: Line 246:
 
== Patch used ==
 
== Patch used ==
 
<pre>
 
<pre>
Patch for Slackware 13.1
+
Patch for Slackware 13.1 guest on a Linux-Vserver host
====================================================================
+
======================================================
by Roberto Puzzanghera - roberto dot puzzanghera at sagredo dot eu
+
by Roberto Puzzanghera - http://notes.sagredo.eu
October 22 2010
+
version: 2010.12.28
  
diff -crB rc.d-original/rc.0 rc.d-patched/rc.0
+
======================================================
*** rc.d-original/rc.0 2010-03-20 01:14:07.000000000 +0100
+
 
--- rc.d-patched/rc.0 2010-10-11 23:35:12.000000000 +0200
+
diff -urNB rc.d-original/rc.0 rc.d-patched/rc.0
***************
+
--- rc.d-original/rc.0 2010-03-20 01:14:07.000000000 +0100
*** 37,58 ****
+
+++ rc.d-patched/rc.0 2010-12-28 17:37:41.000000000 +0100
  ;;
+
@@ -37,22 +37,6 @@
  esac
+
;;
 
+
esac
- # Save the system time to the hardware clock using hwclock --systohc.
+
- if [ -x /sbin/hwclock ]; then
+
-# Save the system time to the hardware clock using hwclock --systohc.
-   # Check for a broken motherboard RTC clock (where ioports for rtc are
+
-if [ -x /sbin/hwclock ]; then
-   # unknown) to prevent hwclock causing a hang:
+
- # Check for a broken motherboard RTC clock (where ioports for rtc are
-   if ! grep -q -w rtc /proc/ioports ; then
+
- # unknown) to prevent hwclock causing a hang:
-     CLOCK_OPT="--directisa"
+
- if ! grep -q -w rtc /proc/ioports ; then
-   fi
+
-   CLOCK_OPT="--directisa"
-   if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
+
- fi
-     echo "Saving system time to the hardware clock (UTC)."
+
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
-     /sbin/hwclock $CLOCK_OPT --utc --systohc
+
-   echo "Saving system time to the hardware clock (UTC)."
-   else
+
-   /sbin/hwclock $CLOCK_OPT --utc --systohc
-     echo "Saving system time to the hardware clock (localtime)."
+
- else
-     /sbin/hwclock  $CLOCK_OPT --localtime --systohc
+
-   echo "Saving system time to the hardware clock (localtime)."
-   fi
+
-   /sbin/hwclock  $CLOCK_OPT --localtime --systohc
- fi
+
- fi
-  
+
-fi
  # Run any local shutdown scripts:
+
-
  if [ -x /etc/rc.d/rc.local_shutdown ]; then
+
# Run any local shutdown scripts:
    /etc/rc.d/rc.local_shutdown stop
+
if [ -x /etc/rc.d/rc.local_shutdown ]; then
--- 37,42 ----
+
  /etc/rc.d/rc.local_shutdown stop
***************
+
@@ -98,18 +82,6 @@
*** 98,115 ****
+
  sh /etc/rc.d/rc.messagebus stop
    sh /etc/rc.d/rc.messagebus stop
+
fi
  fi
+
 
+
-# Unmount any NFS, SMB, or CIFS filesystems:
- # Unmount any NFS, SMB, or CIFS filesystems:
+
-echo "Unmounting remote filesystems."
- echo "Unmounting remote filesystems."
+
-/bin/umount -v -a -r -t nfs,smbfs,cifs
- /bin/umount -v -a -r -t nfs,smbfs,cifs
+
-
-  
+
-# Try to shut down pppd:
- # Try to shut down pppd:
+
-PS="$(ps ax)"
- PS="$(ps ax)"
+
-if echo "$PS" | /bin/grep -q -w pppd ; then
- if echo "$PS" | /bin/grep -q -w pppd ; then
+
- if [ -x /usr/sbin/ppp-off ]; then
-   if [ -x /usr/sbin/ppp-off ]; then
+
-   /usr/sbin/ppp-off
-     /usr/sbin/ppp-off
+
- fi
-   fi
+
-fi
- fi
+
-
-  
+
# Bring down the networking system, but first make sure that this
  # Bring down the networking system, but first make sure that this
+
# isn't a diskless client with the / partition mounted via NFS:
  # isn't a diskless client with the / partition mounted via NFS:
+
if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
  if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
+
@@ -127,13 +99,6 @@
--- 82,87 ----
+
  sleep 2
***************
+
fi
*** 127,139 ****
+
    sleep 2
+
-# Shut down PCMCIA devices:
  fi
+
-if [ -x /etc/rc.d/rc.pcmcia ]; then
 
+
- . /etc/rc.d/rc.pcmcia stop
- # Shut down PCMCIA devices:
+
- # The cards might need a little extra time here to deactivate:
- if [ -x /etc/rc.d/rc.pcmcia ]; then
+
- /bin/sleep 5
-   . /etc/rc.d/rc.pcmcia stop
+
-fi
-   # The cards might need a little extra time here to deactivate:
+
-
-   /bin/sleep 5
+
# Turn off process accounting:
- fi
+
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
-  
+
  /sbin/accton off
  # Turn off process accounting:
+
@@ -181,23 +146,6 @@
  if [ -x /sbin/accton -a -r /var/log/pacct ]; then
+
  rm -f /var/lock/subsys/*
    /sbin/accton off
+
fi
--- 99,104 ----
+
***************
+
-# Turn off swap:
*** 181,203 ****
+
-echo "Turning off swap."
    rm -f /var/lock/subsys/*
+
-/sbin/swapoff -a
  fi
+
-/bin/sync
 
+
-
- # Turn off swap:
+
-# Umount any LVM volumes:
- echo "Turning off swap."
+
-if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
- /sbin/swapoff -a
+
- echo "Unmounting LVM volumes."
- /bin/sync
+
- /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
-  
+
-fi
- # Umount any LVM volumes:
+
-
- if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
+
-echo "Unmounting local file systems."
-   echo "Unmounting LVM volumes."
+
-/bin/umount -v -a -t no,proc,sysfs
-   /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
+
-
- fi
+
-echo "Remounting root filesystem read-only."
-  
+
-/bin/mount -v -n -o remount,ro /
- echo "Unmounting local file systems."
+
-
- /bin/umount -v -a -t no,proc,sysfs
+
# This never hurts:
-  
+
/bin/sync
- echo "Remounting root filesystem read-only."
+
- /bin/mount -v -n -o remount,ro /
+
@@ -222,45 +170,5 @@
-  
+
  done
  # This never hurts:
+
fi
  /bin/sync
+
 
+
-# Deactivate LVM volume groups:
--- 146,151 ----
+
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
***************
+
- echo "Deactivating LVM volume groups:"
*** 222,266 ****
+
- /sbin/vgchange -an --ignorelockingfailure
    done
+
-fi
  fi
+
-
 
+
-# This never hurts again (especially since root-on-LVM always fails
- # Deactivate LVM volume groups:
+
-# to deactivate the / logical volume...  but at least it was
- if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
+
-# remounted as read-only first)
-   echo "Deactivating LVM volume groups:"
+
-/bin/sync
-   /sbin/vgchange -an --ignorelockingfailure
+
-
- fi
+
-# sleep 3 fixes problems with some hard drives that don't
-  
+
-# otherwise finish syncing before reboot or poweroff
- # This never hurts again (especially since root-on-LVM always fails
+
-/bin/sleep 3
- # to deactivate the / logical volume...  but at least it was
+
-
- # remounted as read-only first)
+
# This is to ensure all processes have completed on SMP machines:
- /bin/sync
+
wait
-  
+
-
- # sleep 3 fixes problems with some hard drives that don't
+
-if [ -x /sbin/genpowerd ]; then
- # otherwise finish syncing before reboot or poweroff
+
- # See if this is a powerfail situation:
- /bin/sleep 3
+
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
-  
+
-   # Signal UPS to shut off the inverter:
  # This is to ensure all processes have completed on SMP machines:
+
-   /sbin/genpowerd -k
  wait
+
-   if [ ! $? = 0 ]; then
-  
+
-     echo
- if [ -x /sbin/genpowerd ]; then
+
-     echo "There was an error signaling the UPS."
-   # See if this is a powerfail situation:
+
-     echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
-   if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
+
-     echo "the serial line and UPS type."
-     # Signal UPS to shut off the inverter:
+
-     # Wasting 15 seconds of precious power:
-     /sbin/genpowerd -k
+
-     /bin/sleep 15
-     if [ ! $? = 0 ]; then
+
-   fi
-       echo
+
- fi
-       echo "There was an error signaling the UPS."
+
-fi
-       echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
+
-
-       echo "the serial line and UPS type."
+
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
-       # Wasting 15 seconds of precious power:
+
-if [ "$command" = "reboot" ]; then
-       /bin/sleep 15
+
- echo "Rebooting."
-     fi
+
- /sbin/reboot
-   fi
+
-else
- fi
+
- /sbin/poweroff
-  
+
-fi
- # Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
+
-
- if [ "$command" = "reboot" ]; then
+
diff -urNB rc.d-original/rc.6 rc.d-patched/rc.6
-   echo "Rebooting."
+
--- rc.d-original/rc.6 2010-03-20 01:14:07.000000000 +0100
-   /sbin/reboot
+
+++ rc.d-patched/rc.6 2010-12-28 17:37:41.000000000 +0100
- else
+
@@ -37,22 +37,6 @@
-   /sbin/poweroff
+
;;
- fi
+
esac
-
+
--- 170,174 ----
+
-# Save the system time to the hardware clock using hwclock --systohc.
diff -crB rc.d-original/rc.6 rc.d-patched/rc.6
+
-if [ -x /sbin/hwclock ]; then
*** rc.d-original/rc.6 2010-03-20 01:14:07.000000000 +0100
+
- # Check for a broken motherboard RTC clock (where ioports for rtc are
--- rc.d-patched/rc.6 2010-10-11 23:35:12.000000000 +0200
+
- # unknown) to prevent hwclock causing a hang:
***************
+
- if ! grep -q -w rtc /proc/ioports ; then
*** 37,58 ****
+
-   CLOCK_OPT="--directisa"
  ;;
+
- fi
  esac
+
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
 
+
-   echo "Saving system time to the hardware clock (UTC)."
- # Save the system time to the hardware clock using hwclock --systohc.
+
-   /sbin/hwclock $CLOCK_OPT --utc --systohc
- if [ -x /sbin/hwclock ]; then
+
- else
-   # Check for a broken motherboard RTC clock (where ioports for rtc are
+
-   echo "Saving system time to the hardware clock (localtime)."
-   # unknown) to prevent hwclock causing a hang:
+
-   /sbin/hwclock  $CLOCK_OPT --localtime --systohc
-   if ! grep -q -w rtc /proc/ioports ; then
+
- fi
-     CLOCK_OPT="--directisa"
+
-fi
-   fi
+
-
-   if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
+
# Run any local shutdown scripts:
-     echo "Saving system time to the hardware clock (UTC)."
+
if [ -x /etc/rc.d/rc.local_shutdown ]; then
-     /sbin/hwclock $CLOCK_OPT --utc --systohc
+
  /etc/rc.d/rc.local_shutdown stop
-   else
+
@@ -98,18 +82,6 @@
-     echo "Saving system time to the hardware clock (localtime)."
+
  sh /etc/rc.d/rc.messagebus stop
-     /sbin/hwclock  $CLOCK_OPT --localtime --systohc
+
fi
-   fi
+
- fi
+
-# Unmount any NFS, SMB, or CIFS filesystems:
-  
+
-echo "Unmounting remote filesystems."
  # Run any local shutdown scripts:
+
-/bin/umount -v -a -r -t nfs,smbfs,cifs
  if [ -x /etc/rc.d/rc.local_shutdown ]; then
+
-
    /etc/rc.d/rc.local_shutdown stop
+
-# Try to shut down pppd:
--- 37,42 ----
+
-PS="$(ps ax)"
***************
+
-if echo "$PS" | /bin/grep -q -w pppd ; then
*** 98,115 ****
+
- if [ -x /usr/sbin/ppp-off ]; then
    sh /etc/rc.d/rc.messagebus stop
+
-   /usr/sbin/ppp-off
  fi
+
- fi
 
+
-fi
- # Unmount any NFS, SMB, or CIFS filesystems:
+
-
- echo "Unmounting remote filesystems."
+
# Bring down the networking system, but first make sure that this
- /bin/umount -v -a -r -t nfs,smbfs,cifs
+
# isn't a diskless client with the / partition mounted via NFS:
-  
+
if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
- # Try to shut down pppd:
+
@@ -127,13 +99,6 @@
- PS="$(ps ax)"
+
  sleep 2
- if echo "$PS" | /bin/grep -q -w pppd ; then
+
fi
-   if [ -x /usr/sbin/ppp-off ]; then
+
-     /usr/sbin/ppp-off
+
-# Shut down PCMCIA devices:
-   fi
+
-if [ -x /etc/rc.d/rc.pcmcia ]; then
- fi
+
- . /etc/rc.d/rc.pcmcia stop
-  
+
- # The cards might need a little extra time here to deactivate:
  # Bring down the networking system, but first make sure that this
+
- /bin/sleep 5
  # isn't a diskless client with the / partition mounted via NFS:
+
-fi
  if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
+
-
--- 82,87 ----
+
# Turn off process accounting:
***************
+
if [ -x /sbin/accton -a -r /var/log/pacct ]; then
*** 127,139 ****
+
  /sbin/accton off
    sleep 2
+
@@ -181,23 +146,6 @@
  fi
+
  rm -f /var/lock/subsys/*
 
+
fi
- # Shut down PCMCIA devices:
+
- if [ -x /etc/rc.d/rc.pcmcia ]; then
+
-# Turn off swap:
-   . /etc/rc.d/rc.pcmcia stop
+
-echo "Turning off swap."
-   # The cards might need a little extra time here to deactivate:
+
-/sbin/swapoff -a
-   /bin/sleep 5
+
-/bin/sync
- fi
+
-
-  
+
-# Umount any LVM volumes:
  # Turn off process accounting:
+
-if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
  if [ -x /sbin/accton -a -r /var/log/pacct ]; then
+
- echo "Unmounting LVM volumes."
    /sbin/accton off
+
- /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
--- 99,104 ----
+
-fi
***************
+
-
*** 181,203 ****
+
-echo "Unmounting local file systems."
    rm -f /var/lock/subsys/*
+
-/bin/umount -v -a -t no,proc,sysfs
  fi
+
-
 
+
-echo "Remounting root filesystem read-only."
- # Turn off swap:
+
-/bin/mount -v -n -o remount,ro /
- echo "Turning off swap."
+
-
- /sbin/swapoff -a
+
# This never hurts:
- /bin/sync
+
/bin/sync
-  
+
- # Umount any LVM volumes:
+
@@ -222,45 +170,5 @@
- if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
+
  done
-   echo "Unmounting LVM volumes."
+
fi
-   /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
+
- fi
+
-# Deactivate LVM volume groups:
-  
+
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
- echo "Unmounting local file systems."
+
- echo "Deactivating LVM volume groups:"
- /bin/umount -v -a -t no,proc,sysfs
+
- /sbin/vgchange -an --ignorelockingfailure
-  
+
-fi
- echo "Remounting root filesystem read-only."
+
-
- /bin/mount -v -n -o remount,ro /
+
-# This never hurts again (especially since root-on-LVM always fails
-  
+
-# to deactivate the / logical volume...  but at least it was
  # This never hurts:
+
-# remounted as read-only first)
  /bin/sync
+
-/bin/sync
 
+
-
--- 146,151 ----
+
-# sleep 3 fixes problems with some hard drives that don't
***************
+
-# otherwise finish syncing before reboot or poweroff
*** 222,266 ****
+
-/bin/sleep 3
    done
+
-
  fi
+
# This is to ensure all processes have completed on SMP machines:
 
+
wait
- # Deactivate LVM volume groups:
+
-
- if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
+
-if [ -x /sbin/genpowerd ]; then
-   echo "Deactivating LVM volume groups:"
+
- # See if this is a powerfail situation:
-   /sbin/vgchange -an --ignorelockingfailure
+
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
- fi
+
-   # Signal UPS to shut off the inverter:
-  
+
-   /sbin/genpowerd -k
- # This never hurts again (especially since root-on-LVM always fails
+
-   if [ ! $? = 0 ]; then
- # to deactivate the / logical volume...  but at least it was
+
-     echo
- # remounted as read-only first)
+
-     echo "There was an error signaling the UPS."
- /bin/sync
+
-     echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
-  
+
-     echo "the serial line and UPS type."
- # sleep 3 fixes problems with some hard drives that don't
+
-     # Wasting 15 seconds of precious power:
- # otherwise finish syncing before reboot or poweroff
+
-     /bin/sleep 15
- /bin/sleep 3
+
-   fi
-  
+
- fi
  # This is to ensure all processes have completed on SMP machines:
+
-fi
  wait
+
-
-  
+
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
- if [ -x /sbin/genpowerd ]; then
+
-if [ "$command" = "reboot" ]; then
-   # See if this is a powerfail situation:
+
- echo "Rebooting."
-   if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
+
- /sbin/reboot
-     # Signal UPS to shut off the inverter:
+
-else
-     /sbin/genpowerd -k
+
- /sbin/poweroff
-     if [ ! $? = 0 ]; then
+
-fi
-       echo
+
-
-       echo "There was an error signaling the UPS."
+
diff -urNB rc.d-original/rc.K rc.d-patched/rc.K
-       echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
+
--- rc.d-original/rc.K 2008-12-02 21:31:48.000000000 +0100
-       echo "the serial line and UPS type."
+
+++ rc.d-patched/rc.K 2010-12-28 17:37:41.000000000 +0100
-       # Wasting 15 seconds of precious power:
+
@@ -57,22 +57,6 @@
-       /bin/sleep 15
+
  /etc/rc.d/rc.nfsd stop
-     fi
+
fi
-   fi
+
- fi
+
-# Unmount any NFS, SMB, or CIFS filesystems:
-  
+
-echo "Unmounting remote filesystems."
- # Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
+
-umount -a -r -t nfs,smbfs,cifs
- if [ "$command" = "reboot" ]; then
+
-
-   echo "Rebooting."
+
-# Shut down PCMCIA devices:
-   /sbin/reboot
+
-if [ -x /etc/rc.d/rc.pcmcia ] ; then
- else
+
- . /etc/rc.d/rc.pcmcia stop
-   /sbin/poweroff
+
- # The cards might need a little extra time here to deactivate:
- fi
+
- sleep 5
-
+
-fi
--- 170,174 ----
+
-
diff -crB rc.d-original/rc.K rc.d-patched/rc.K
+
-# Terminate acpid before syslog:
*** rc.d-original/rc.K 2008-12-02 21:31:48.000000000 +0100
+
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
--- rc.d-patched/rc.K 2010-10-11 23:37:36.000000000 +0200
+
- . /etc/rc.d/rc.acpid stop
***************
+
-fi
*** 57,78 ****
+
-
    /etc/rc.d/rc.nfsd stop
+
# Kill all processes.
  fi
+
echo
 
+
echo "Sending all processes the SIGHUP signal."
- # Unmount any NFS, SMB, or CIFS filesystems:
+
diff -urNB rc.d-original/rc.M rc.d-patched/rc.M
- echo "Unmounting remote filesystems."
+
--- rc.d-original/rc.M 2010-02-07 04:01:28.000000000 +0100
- umount -a -r -t nfs,smbfs,cifs
+
+++ rc.d-patched/rc.M 2010-12-28 17:37:41.000000000 +0100
-  
+
@@ -20,10 +20,6 @@
- # Shut down PCMCIA devices:
+
  /sbin/ldconfig &
- if [ -x /etc/rc.d/rc.pcmcia ] ; then
+
fi
-   . /etc/rc.d/rc.pcmcia stop
+
-   # The cards might need a little extra time here to deactivate:
+
-# Screen blanks after 15 minutes idle time, and powers down in one hour
-   sleep 5
+
-# if the kernel supports APM or ACPI power management:
- fi
+
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60
-  
+
-
- # Terminate acpid before syslog:
+
# Set the hostname.
- if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
+
if [ -r /etc/HOSTNAME ]; then
-   . /etc/rc.d/rc.acpid stop
+
  /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
- fi
+
@@ -36,31 +32,6 @@
-  
+
# Save the contents of 'dmesg':
  # Kill all processes.
+
/bin/dmesg -s 65536 > /var/log/dmesg
  echo
+
  echo "Sending all processes the SIGHUP signal."
+
-# Initialize PCMCIA devices:
--- 57,62 ----
+
-#
diff -crB rc.d-original/rc.M rc.d-patched/rc.M
+
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices
*** rc.d-original/rc.M 2010-02-07 04:01:28.000000000 +0100
+
-# could be fsck'ed along with the other drives.  This had some unfortunate
--- rc.d-patched/rc.M 2010-10-11 23:44:13.000000000 +0200
+
-# side effects, however, since root isn't yet read-write, and /var might not
***************
+
-# even be mounted the .pid files can't be correctly written in /var/run and
*** 20,29 ****
+
-# the pcmcia system can't be correctly shut down.  If you want some PCMCIA
    /sbin/ldconfig &
+
-# partition to be mounted at boot (or when the card is inserted) then add
  fi
+
-# the appropriate lines to /etc/pcmcia/scsi.opts.
 
+
-#
- # Screen blanks after 15 minutes idle time, and powers down in one hour
+
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using
- # if the kernel supports APM or ACPI power management:
+
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!).  For example, with a
- /bin/setterm -blank 15 -powersave powerdown -powerdown 60
+
-# wireless card you might need to set options in /etc/pcmcia OR in
-  
+
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with
  # Set the hostname.
+
-# extra options if needed for the encryption key, ESSID, etc.)
  if [ -r /etc/HOSTNAME ]; then
+
-#
    /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
+
-# Hopefully this situation will be unified in the future, but for now
--- 20,25 ----
+
-# that's how it is...
***************
+
-#
*** 36,66 ****
+
-if [ -x /etc/rc.d/rc.pcmcia ]; then
  # Save the contents of 'dmesg':
+
- . /etc/rc.d/rc.pcmcia start
  /bin/dmesg -s 65536 > /var/log/dmesg
+
- # The cards might need a little extra time here to initialize.
 
+
- sleep 5
- # Initialize PCMCIA devices:
+
-fi
- #
+
-
- # NOTE: This used to be started near the top of rc.S so that PCMCIA devices
+
# Start the system logger.
- # could be fsck'ed along with the other drives.  This had some unfortunate
+
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then
- # side effects, however, since root isn't yet read-write, and /var might not
+
  . /etc/rc.d/rc.syslog start
- # even be mounted the .pid files can't be correctly written in /var/run and
+
@@ -72,26 +43,11 @@
- # the pcmcia system can't be correctly shut down.  If you want some PCMCIA
+
  /usr/bin/fc-cache -f &
- # partition to be mounted at boot (or when the card is inserted) then add
+
fi
- # the appropriate lines to /etc/pcmcia/scsi.opts.
+
- #
+
-# If we are returning from single-user mode we will need to restart
- # Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using
+
-# udevd on systems that use udev:
- # 16-bit PCMCIA cards (not 32-bit Cardbus cards!).  For example, with a
+
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then
- # wireless card you might need to set options in /etc/pcmcia OR in
+
- if ! grep -wq nohotplug /proc/cmdline ; then
- # /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with
+
-   if [ -x /etc/rc.d/rc.udev ]; then
- # extra options if needed for the encryption key, ESSID, etc.)
+
-     /bin/sh /etc/rc.d/rc.udev start
- #
+
-   fi
- # Hopefully this situation will be unified in the future, but for now
+
- fi
- # that's how it is...
+
-fi
- #
+
-
- if [ -x /etc/rc.d/rc.pcmcia ]; then
+
# Initialize the networking hardware.
-   . /etc/rc.d/rc.pcmcia start
+
if [ -x /etc/rc.d/rc.inet1 ]; then
-   # The cards might need a little extra time here to initialize.
+
  . /etc/rc.d/rc.inet1
-   sleep 5
+
fi
- fi
+
-  
+
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:
  # Start the system logger.
+
-if [ -x /etc/rc.d/rc.scanluns ]; then
  if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then
+
- . /etc/rc.d/rc.scanluns
    . /etc/rc.d/rc.syslog start
+
-fi
--- 32,37 ----
+
-
***************
+
# Start networking daemons:
*** 72,97 ****
+
if [ -x /etc/rc.d/rc.inet2 ]; then
    /usr/bin/fc-cache -f &
+
  . /etc/rc.d/rc.inet2
  fi
+
@@ -118,17 +74,6 @@
 
+
chmod 755 / 2> /dev/null
- # If we are returning from single-user mode we will need to restart
+
chmod 1777 /tmp /var/tmp
- # udevd on systems that use udev:
+
- if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then
+
-# Start APM or ACPI daemon.
-   if ! grep -wq nohotplug /proc/cmdline ; then
+
-# If APM is enabled in the kernel, start apmd:
-     if [ -x /etc/rc.d/rc.udev ]; then
+
-if [ -e /proc/apm ]; then
-       /bin/sh /etc/rc.d/rc.udev start
+
- if [ -x /usr/sbin/apmd ]; then
-     fi
+
-   echo "Starting APM daemon:  /usr/sbin/apmd"
-   fi
+
-   /usr/sbin/apmd
- fi
+
- fi
-  
+
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:
  # Initialize the networking hardware.
+
- . /etc/rc.d/rc.acpid start
  if [ -x /etc/rc.d/rc.inet1 ]; then
+
-fi
    . /etc/rc.d/rc.inet1
+
-
  fi
+
# Update any existing icon cache files:
 
+
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
- # Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:
+
  for theme_dir in /usr/share/icons/* ; do
- if [ -x /etc/rc.d/rc.scanluns ]; then
+
@@ -161,11 +106,6 @@
-   . /etc/rc.d/rc.scanluns
+
  sh /etc/rc.d/rc.hald start
- fi
+
fi
-  
+
  # Start networking daemons:
+
-# Start Bluetooth:
  if [ -x /etc/rc.d/rc.inet2 ]; then
+
-if [ -x /etc/rc.d/rc.bluetooth ]; then
    . /etc/rc.d/rc.inet2
+
- sh /etc/rc.d/rc.bluetooth start
--- 43,53 ----
+
-fi
***************
+
-
*** 118,134 ****
+
# Start wicd:
  chmod 755 / 2> /dev/null
+
if [ -x /etc/rc.d/rc.wicd ]; then
  chmod 1777 /tmp /var/tmp
+
  sh /etc/rc.d/rc.wicd start
 
+
@@ -207,36 +147,6 @@
- # Start APM or ACPI daemon.
+
  /etc/rc.d/rc.atalk
- # If APM is enabled in the kernel, start apmd:
+
fi
- if [ -e /proc/apm ]; then
+
-   if [ -x /usr/sbin/apmd ]; then
+
-# Start smartd, which monitors the status of S.M.A.R.T. compatible
-     echo "Starting APM daemon:  /usr/sbin/apmd"
+
-# hard drives and reports any problems.  Note some devices (which aren't
-     /usr/sbin/apmd
+
-# smart, I guess ;) will hang if probed by smartd, so it's commented out
-   fi
+
-# by default.
- elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:
+
-#if [ -x /usr/sbin/smartd ]; then
-   . /etc/rc.d/rc.acpid start
+
-#  /usr/sbin/smartd
- fi
+
-#fi
-  
+
-
  # Update any existing icon cache files:
+
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks
  if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
+
-# if some udev rule hasn't made them already:
    for theme_dir in /usr/share/icons/* ; do
+
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then
--- 74,79 ----
+
- if ! grep -wq nohotplug /proc/cmdline ; then
***************
+
-   if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then
*** 161,171 ****
+
-     /bin/sh /lib/udev/rc.optical-symlinks
    sh /etc/rc.d/rc.hald start
+
-   fi
  fi
+
- fi
 
+
-fi
- # Start Bluetooth:
+
-
- if [ -x /etc/rc.d/rc.bluetooth ]; then
+
-# Monitor the UPS with genpowerd.
-   sh /etc/rc.d/rc.bluetooth start
+
-# To use this, uncomment this section and edit your settings in
- fi
+
-# /etc/genpowerd.conf (serial device, UPS type, etc).  For more information,
-  
+
-# see "man genpowerd" or the extensive documentation in the
  # Start wicd:
+
-# /usr/doc/genpower-*/ directory.
  if [ -x /etc/rc.d/rc.wicd ]; then
+
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want
    sh /etc/rc.d/rc.wicd start
+
-# support for stopping the UPS's inverter after the machine halts.
--- 106,111 ----
+
-#if [ -x /sbin/genpowerd ]; then
***************
+
-#  echo "Starting genpowerd daemon..."
*** 207,242 ****
+
-#  /sbin/genpowerd
    /etc/rc.d/rc.atalk
+
-#fi
  fi
+
-
 
+
# Turn on process accounting.  To enable process accounting, make sure the
- # Start smartd, which monitors the status of S.M.A.R.T. compatible
+
# option for BSD process accounting is enabled in your kernel, and then
- # hard drives and reports any problems.  Note some devices (which aren't
+
# create the file /var/log/pacct (touch /var/log/pacct).  By default, process
- # smart, I guess ;) will hang if probed by smartd, so it's commented out
+
@@ -301,11 +211,6 @@
- # by default.
+
  . /etc/rc.d/rc.sendmail start
- #if [ -x /usr/sbin/smartd ]; then
+
fi
- #  /usr/sbin/smartd
+
- #fi
+
-# Load ALSA (sound) defaults:
-  
+
-if [ -x /etc/rc.d/rc.alsa ]; then
- # If we're using udev, make /dev/cdrom and any other optical drive symlinks
+
- . /etc/rc.d/rc.alsa
- # if some udev rule hasn't made them already:
+
-fi
- if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then
+
-
-   if ! grep -wq nohotplug /proc/cmdline ; then
+
# Load a custom screen font if the user has an rc.font script.
-     if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then
+
if [ -x /etc/rc.d/rc.font ]; then
-       /bin/sh /lib/udev/rc.optical-symlinks
+
  . /etc/rc.d/rc.font
-     fi
+
@@ -337,11 +242,6 @@
-   fi
+
  . /etc/rc.d/rc.samba start
- fi
+
fi
-  
+
- # Monitor the UPS with genpowerd.
+
-# Start the GPM mouse server:
- # To use this, uncomment this section and edit your settings in
+
-if [ -x /etc/rc.d/rc.gpm ]; then
- # /etc/genpowerd.conf (serial device, UPS type, etc).  For more information,
+
- . /etc/rc.d/rc.gpm start
- # see "man genpowerd" or the extensive documentation in the
+
-fi
- # /usr/doc/genpower-*/ directory.
+
-
- # You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want
+
# If there are SystemV init scripts for this runlevel, run them.
- # support for stopping the UPS's inverter after the machine halts.
+
if [ -x /etc/rc.d/rc.sysvinit ]; then
- #if [ -x /sbin/genpowerd ]; then
+
  . /etc/rc.d/rc.sysvinit
- #  echo "Starting genpowerd daemon..."
+
diff -urNB rc.d-original/rc.inet2 rc.d-patched/rc.inet2
- #  /sbin/genpowerd
+
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200
- #fi
+
+++ rc.d-patched/rc.inet2 2010-12-28 17:37:41.000000000 +0100
-  
+
@@ -15,27 +15,6 @@
  # Turn on process accounting.  To enable process accounting, make sure the
+
  # option for BSD process accounting is enabled in your kernel, and then
+
# At this point, we are ready to talk to The World...
  # create the file /var/log/pacct (touch /var/log/pacct).  By default, process
+
--- 147,152 ----
+
-
***************
+
-# Mount remote (NFS) filesystems:
*** 301,311 ****
+
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then
    . /etc/rc.d/rc.sendmail start
+
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS
  fi
+
- # volumes defined in /etc/fstab since these will need to be running in order
 
+
- # to mount them.  If they are not running, attempting to mount an NFS
- # Load ALSA (sound) defaults:
+
- # partition will cause mount to hang, or at least result in unreliable
- if [ -x /etc/rc.d/rc.alsa ]; then
+
- # operation.  Keep this in mind if you plan to mount unlisted NFS
-   . /etc/rc.d/rc.alsa
+
- # partitions...  
- fi
+
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run
-  
+
- # whether it is set as executable or not.  If you don't want to run it,
  # Load a custom screen font if the user has an rc.font script.
+
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.
  if [ -x /etc/rc.d/rc.font ]; then
+
- if [ -r /etc/rc.d/rc.rpc ]; then
    . /etc/rc.d/rc.font
+
-   sh /etc/rc.d/rc.rpc start
--- 211,216 ----
+
- fi
***************
+
- echo "Mounting remote (NFS) file systems:  /sbin/mount -a -t nfs"
*** 337,347 ****
+
- /sbin/mount -a -t nfs          # This may be our /usr runtime!
    . /etc/rc.d/rc.samba start
+
- # Show the mounted volumes:
  fi
+
- /sbin/mount -v -t nfs
 
+
-fi
- # Start the GPM mouse server:
+
-
- if [ -x /etc/rc.d/rc.gpm ]; then
+
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,
-   . /etc/rc.d/rc.gpm start
+
# and rpc.statd.  This might be needed to mount NFS partitions that are not
- fi
+
# listed in /etc/fstab.  Starting this twice won't hurt as the script will
-  
+
  # If there are SystemV init scripts for this runlevel, run them.
+
  if [ -x /etc/rc.d/rc.sysvinit ]; then
+
    . /etc/rc.d/rc.sysvinit
+
--- 242,247 ----
+
diff -crB rc.d-original/rc.inet2 rc.d-patched/rc.inet2
+
*** rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200
+
--- rc.d-patched/rc.inet2 2010-10-11 23:46:08.000000000 +0200
+
***************
+
*** 15,41 ****
+
 
+
  # At this point, we are ready to talk to The World...
+
 
+
-  
+
- # Mount remote (NFS) filesystems:
+
- if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then
+
-   # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS
+
-   # volumes defined in /etc/fstab since these will need to be running in order
+
-   # to mount them.  If they are not running, attempting to mount an NFS
+
-   # partition will cause mount to hang, or at least result in unreliable
+
-   # operation.  Keep this in mind if you plan to mount unlisted NFS
+
-   # partitions...  
+
-   # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run
+
-   # whether it is set as executable or not.  If you don't want to run it,
+
-   # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.
+
-   if [ -r /etc/rc.d/rc.rpc ]; then
+
-     sh /etc/rc.d/rc.rpc start
+
-   fi
+
-   echo "Mounting remote (NFS) file systems:  /sbin/mount -a -t nfs"
+
-   /sbin/mount -a -t nfs          # This may be our /usr runtime!
+
-   # Show the mounted volumes:
+
-   /sbin/mount -v -t nfs
+
- fi
+
-  
+
  # If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,
+
  # and rpc.statd.  This might be needed to mount NFS partitions that are not
+
  # listed in /etc/fstab.  Starting this twice won't hurt as the script will
+
--- 15,20 ----
+
 
</pre>
 
</pre>

Revision as of 19:45, 28 December 2010

What follows was tested on a Slackware 13.1 guest. I assume you have a Linux-Vserver host working.

Contents

Download the patch and the installer script

tar xzf slack_vserver.tar.gz
cd slack_vserver 

ls 
  • PKG_LIST is the package list to be installed in the guest
  • slackware_pkg/ is the folder were the packages (txz) to be installed are stored.
  • download_slack.sh is a script that you can use to download all the PKG_LIST. If you use this scriptlet all the package will be stored in the slackware_pkg sub-folder.
  • make_slack_vserver.sh is the shell script that you have to adjust. It installs the guest.
  • slackware-13.1.patch is the patch which modify rc.0 rc.6 rc.M rc.K and rc.inet2. It must be applyed after the creation of the guest. In the patch I switched off all the mounts and executable that are related to the hardware.
  • rc is the startup script for the virtual server. It will be automatically copied in /etc/rc.d/init.d/rc
# more rc

if [ $1 -eq 3 ]; then
  echo "entering runlevel 3: multi";
  /etc/rc.d/rc.M
fi
if [ $1 -eq 6 ]; then
  echo "entering runlevel 6: reboot";
  /etc/rc.d/rc.6
fi
if [ $1 -eq 0 ]; then
  echo "entering runlevel 0: shutdown";
  /etc/rc.d/rc.0
fi
if [ $1 -eq 4 ]; then
  echo "entering runlevel 4";
fi
if [ $1 -eq 5 ]; then
  echo "entering runlevel 5";
fi
if [ $1 -eq 1 ]; then
  echo "entering runlevel 1:single";
  /etc/rc.d/rc.K
fi
if [ $1 -eq 2 ]; then
  echo "entering runlevel 2:multi";
  /etc/rc.d/rc.M
fi

Download the slack packages

First of all select a minimal set of packages to be installed on the virtual server. This list of 108 packages is based on the Minimal System reported at http://slackwiki.org/Minimal_System without all hardware, kernel and multimedia related packages. The install leads to a guest of about 448M of size.

I assume that the packages to be installed are stored in the slackware_pkg folder. If not, adjust its location editing the make_slack_vserver.sh script.

You can download my minimal set of packages running the shell script download_slack_pkg.sh

#!/bin/bash
#
# Put here your favourite Slackware repository
 
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/"   # 32-bit
#"ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/"  # 64-bit
 
LIST="../PKG_LIST"
 
cd slackware_pkg
 
if [ -f $LIST ]; then
        while read line 
            do 
            wget "$SRC$line*.t?z"
        done < $LIST
else
  echo "Can't find $LIST file."
  exit 1
fi
 
rm index.html*

Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line

./download_slack_pkg.sh

Make the guest

Now let's create the guest and install the packages. As you know you must choose at least a "name", a "context" and an ip. In addition you have to modify most of the rc.* startup scripts removing all the hardware related daemons, and finally replace the /dev dir.

This is done running the script make_slack_vserver.sh:

#!/bin/bash
#
# More info here: http://notes.sagredo.eu/node/7
 
if [ $# != 1 ]; then
  echo "usage: $0 <server-name>"
  exit 1
fi
 
# adjust this to where your things live
NAME=$1
HOSTNAME=$NAME.myserver.net
IP=10.0.0.147
INTERFACE=eth0:$IP/24
CONTEXT=1010
 
# where is the vservers dir? default is /vservers
VDIR="/usr/local/vservers"
 
# the directory where you unpacked slack_vserver.tar.gz
# $PWD should work, otherwise put /path/to/slack_vserver
SETUP=$PWD
 
# the directory where you downloaded the slackware packages
PACKAGES="$SETUP/slackware_pkg"
 
# the path to rc script file (leave as is)
RC="$SETUP/rc"
 
################### end configuration
 
# sanity check
 
if [ ! -d "$VDIR" ]; then
        echo ""
        echo "Can't find VDIR dir: $VDIR"
        echo "Exiting"
        echo ""
        exit 1 
fi
if [ ! -d "$SETUP" ]; then
        echo ""  
        echo "Can't find SETUP dir: $SETUP"
        echo "Exiting"
        echo ""
        exit 1
fi
if [ ! -d "$PACKAGES" ]; then
        echo ""
        echo "Can't find PACKAGES dir: $PACKAGES"
        echo "Exiting"
        echo ""
        exit 1
fi
if [ ! -f "$RC" ]; then
        echo ""
        echo "Can't find RC path: $RC"
        echo "Exiting"
        echo ""
        exit 1
fi
 
# if everything is ok start the install
 
echo ""
read -p "press any key to make skeleton..."
vserver ${NAME} build -m skeleton \
        --hostname ${HOSTNAME} \
        --interface ${INTERFACE} \
        --flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \
        --initstyle sysv
echo "...done"
echo ""
 
read -p "press any key to move to a temp dir the /dev folder..."
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2
 
echo ""
read -p "press any key to install packages..." 
cd $PACKAGES
installpkg -root $VDIR/$NAME *.t?z; 
echo "...done" 
echo ""
 
echo ""
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."
echo ""
echo "copying rc to /etc/rc.d/init.d/rc"
echo ""
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/
echo "done"
 
echo ""
echo "removing x flag to rc.inet1 and rc.sshd"
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.sshd
echo "done"
echo ""
 
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."
cp /etc/resolv.conf $VDIR/$NAME/etc/
cp /etc/localtime $VDIR/$NAME/etc/
rm $VDIR/$NAME/etc/profile
cp /etc/profile $VDIR/$NAME/etc/
echo $HOSTNAME >  $VDIR/$NAME/etc/HOSTNAME
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts
touch $VDIR/$NAME/etc/mtab                                                                  
touch $VDIR/$NAME/etc/fstab
echo "done"
echo ""
 
read -p "press any key to restore /dev2 to /dev"
rm -r $VDIR/$NAME/dev
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev
 
echo ""
echo "done; DON'T FORGET to patch /etc/rc.d as follows: "
echo ""
echo "cd $VDIR/$NAME/etc/rc.d"
echo "patch -p1 < $SETUP/slackware-13.1.patch"
echo ""
echo "More info on http://notes.sagredo.eu/node/7"
echo ""

Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.

Run it to install the guest and all the packages you downloaded.

./make_slack_vserver.sh

Apply the patch and start the guest

Once you have installed the guest apply the patch and if everything is ok start the server:

cd /vservers/vserver_name/etc/rc.d
patch -p1 < /path/to/slack_vserver/slackware-13.1.patch

vserver <vserver_name> start
vserver <vserver_name> enter

Hints

My patch has been tested with Slackware 13.1, but I suppose that this solution will work also in future version with some small adjustment. In any case, if the patch doesn't work with your version of Slackware try to replace rc.0 rc.6 rc.K rc.M rc.inet2 with these (download here). In addition remember to

  • leave /etc/rc.d/init.d/rc script as is. These is a very essential script which is started first and runs rc.M on startup or rc.6 on shutdown
  • chmod -x rc.inet1 the network is brought up configuring the guest by /etc/vservers
  • chmod -x all hardware related services like rc.acpid rc.alsa rc.pcmcia rc.wireless rc.gpm rc.bluetooth rc.hald
  • delete all mounts and other hardware related commands in rc.0 rc.6 rc.K rc.M rc.inet2

Contact

Any comments/suggestions/questions to roberto dot puzzanghera at sagredo dot eu, [1]

Patch used

Patch for Slackware 13.1 guest on a Linux-Vserver host
======================================================
by Roberto Puzzanghera - http://notes.sagredo.eu
version: 2010.12.28

======================================================

diff -urNB rc.d-original/rc.0 rc.d-patched/rc.0
--- rc.d-original/rc.0	2010-03-20 01:14:07.000000000 +0100
+++ rc.d-patched/rc.0	2010-12-28 17:37:41.000000000 +0100
@@ -37,22 +37,6 @@
 		;;
 esac
 
-# Save the system time to the hardware clock using hwclock --systohc.
-if [ -x /sbin/hwclock ]; then
-  # Check for a broken motherboard RTC clock (where ioports for rtc are
-  # unknown) to prevent hwclock causing a hang:
-  if ! grep -q -w rtc /proc/ioports ; then
-    CLOCK_OPT="--directisa"
-  fi
-  if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
-    echo "Saving system time to the hardware clock (UTC)."
-    /sbin/hwclock $CLOCK_OPT --utc --systohc
-  else
-    echo "Saving system time to the hardware clock (localtime)."
-    /sbin/hwclock  $CLOCK_OPT --localtime --systohc
-  fi
-fi
-
 # Run any local shutdown scripts:
 if [ -x /etc/rc.d/rc.local_shutdown ]; then
   /etc/rc.d/rc.local_shutdown stop
@@ -98,18 +82,6 @@
   sh /etc/rc.d/rc.messagebus stop
 fi
 
-# Unmount any NFS, SMB, or CIFS filesystems:
-echo "Unmounting remote filesystems."
-/bin/umount -v -a -r -t nfs,smbfs,cifs
-
-# Try to shut down pppd:
-PS="$(ps ax)"
-if echo "$PS" | /bin/grep -q -w pppd ; then
-  if [ -x /usr/sbin/ppp-off ]; then
-    /usr/sbin/ppp-off
-  fi
-fi
-
 # Bring down the networking system, but first make sure that this
 # isn't a diskless client with the / partition mounted via NFS:
 if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
@@ -127,13 +99,6 @@
   sleep 2
 fi
 
-# Shut down PCMCIA devices:
-if [ -x /etc/rc.d/rc.pcmcia ]; then
-  . /etc/rc.d/rc.pcmcia stop
-  # The cards might need a little extra time here to deactivate:
-  /bin/sleep 5
-fi
-
 # Turn off process accounting:
 if [ -x /sbin/accton -a -r /var/log/pacct ]; then
   /sbin/accton off
@@ -181,23 +146,6 @@
   rm -f /var/lock/subsys/*
 fi
 
-# Turn off swap:
-echo "Turning off swap."
-/sbin/swapoff -a
-/bin/sync
-
-# Umount any LVM volumes:
-if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
-  echo "Unmounting LVM volumes."
-  /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
-fi
-
-echo "Unmounting local file systems."
-/bin/umount -v -a -t no,proc,sysfs
-
-echo "Remounting root filesystem read-only."
-/bin/mount -v -n -o remount,ro /
-
 # This never hurts:
 /bin/sync
 
@@ -222,45 +170,5 @@
   done
 fi
 
-# Deactivate LVM volume groups:
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
-  echo "Deactivating LVM volume groups:"
-  /sbin/vgchange -an --ignorelockingfailure
-fi
-
-# This never hurts again (especially since root-on-LVM always fails
-# to deactivate the / logical volume...  but at least it was
-# remounted as read-only first)
-/bin/sync
-
-# sleep 3 fixes problems with some hard drives that don't
-# otherwise finish syncing before reboot or poweroff
-/bin/sleep 3
-
 # This is to ensure all processes have completed on SMP machines:
 wait
-
-if [ -x /sbin/genpowerd ]; then
-  # See if this is a powerfail situation:
-  if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
-    # Signal UPS to shut off the inverter:
-    /sbin/genpowerd -k
-    if [ ! $? = 0 ]; then
-      echo
-      echo "There was an error signaling the UPS."
-      echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
-      echo "the serial line and UPS type."
-      # Wasting 15 seconds of precious power:
-      /bin/sleep 15
-    fi
-  fi
-fi
-
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
-if [ "$command" = "reboot" ]; then
-  echo "Rebooting."
-  /sbin/reboot
-else
-  /sbin/poweroff
-fi
-
diff -urNB rc.d-original/rc.6 rc.d-patched/rc.6
--- rc.d-original/rc.6	2010-03-20 01:14:07.000000000 +0100
+++ rc.d-patched/rc.6	2010-12-28 17:37:41.000000000 +0100
@@ -37,22 +37,6 @@
 		;;
 esac
 
-# Save the system time to the hardware clock using hwclock --systohc.
-if [ -x /sbin/hwclock ]; then
-  # Check for a broken motherboard RTC clock (where ioports for rtc are
-  # unknown) to prevent hwclock causing a hang:
-  if ! grep -q -w rtc /proc/ioports ; then
-    CLOCK_OPT="--directisa"
-  fi
-  if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then
-    echo "Saving system time to the hardware clock (UTC)."
-    /sbin/hwclock $CLOCK_OPT --utc --systohc
-  else
-    echo "Saving system time to the hardware clock (localtime)."
-    /sbin/hwclock  $CLOCK_OPT --localtime --systohc
-  fi
-fi
-
 # Run any local shutdown scripts:
 if [ -x /etc/rc.d/rc.local_shutdown ]; then
   /etc/rc.d/rc.local_shutdown stop
@@ -98,18 +82,6 @@
   sh /etc/rc.d/rc.messagebus stop
 fi
 
-# Unmount any NFS, SMB, or CIFS filesystems:
-echo "Unmounting remote filesystems."
-/bin/umount -v -a -r -t nfs,smbfs,cifs
-
-# Try to shut down pppd:
-PS="$(ps ax)"
-if echo "$PS" | /bin/grep -q -w pppd ; then
-  if [ -x /usr/sbin/ppp-off ]; then
-    /usr/sbin/ppp-off
-  fi
-fi
-
 # Bring down the networking system, but first make sure that this
 # isn't a diskless client with the / partition mounted via NFS:
 if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then
@@ -127,13 +99,6 @@
   sleep 2
 fi
 
-# Shut down PCMCIA devices:
-if [ -x /etc/rc.d/rc.pcmcia ]; then
-  . /etc/rc.d/rc.pcmcia stop
-  # The cards might need a little extra time here to deactivate:
-  /bin/sleep 5
-fi
-
 # Turn off process accounting:
 if [ -x /sbin/accton -a -r /var/log/pacct ]; then
   /sbin/accton off
@@ -181,23 +146,6 @@
   rm -f /var/lock/subsys/*
 fi
 
-# Turn off swap:
-echo "Turning off swap."
-/sbin/swapoff -a
-/bin/sync
-
-# Umount any LVM volumes:
-if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then
-  echo "Unmounting LVM volumes."
-  /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)
-fi
-
-echo "Unmounting local file systems."
-/bin/umount -v -a -t no,proc,sysfs
-
-echo "Remounting root filesystem read-only."
-/bin/mount -v -n -o remount,ro /
-
 # This never hurts:
 /bin/sync
 
@@ -222,45 +170,5 @@
   done
 fi
 
-# Deactivate LVM volume groups:
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
-  echo "Deactivating LVM volume groups:"
-  /sbin/vgchange -an --ignorelockingfailure
-fi
-
-# This never hurts again (especially since root-on-LVM always fails
-# to deactivate the / logical volume...  but at least it was
-# remounted as read-only first)
-/bin/sync
-
-# sleep 3 fixes problems with some hard drives that don't
-# otherwise finish syncing before reboot or poweroff
-/bin/sleep 3
-
 # This is to ensure all processes have completed on SMP machines:
 wait
-
-if [ -x /sbin/genpowerd ]; then
-  # See if this is a powerfail situation:
-  if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then
-    # Signal UPS to shut off the inverter:
-    /sbin/genpowerd -k
-    if [ ! $? = 0 ]; then
-      echo
-      echo "There was an error signaling the UPS."
-      echo "Perhaps you need to edit /etc/genpowerd.conf to configure"
-      echo "the serial line and UPS type."
-      # Wasting 15 seconds of precious power:
-      /bin/sleep 15
-    fi
-  fi
-fi
-
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.
-if [ "$command" = "reboot" ]; then
-  echo "Rebooting."
-  /sbin/reboot
-else
-  /sbin/poweroff
-fi
-
diff -urNB rc.d-original/rc.K rc.d-patched/rc.K
--- rc.d-original/rc.K	2008-12-02 21:31:48.000000000 +0100
+++ rc.d-patched/rc.K	2010-12-28 17:37:41.000000000 +0100
@@ -57,22 +57,6 @@
   /etc/rc.d/rc.nfsd stop
 fi
 
-# Unmount any NFS, SMB, or CIFS filesystems:
-echo "Unmounting remote filesystems."
-umount -a -r -t nfs,smbfs,cifs
-
-# Shut down PCMCIA devices:
-if [ -x /etc/rc.d/rc.pcmcia ] ; then
-  . /etc/rc.d/rc.pcmcia stop
-  # The cards might need a little extra time here to deactivate:
-  sleep 5
-fi
-
-# Terminate acpid before syslog:
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit
-  . /etc/rc.d/rc.acpid stop
-fi
-
 # Kill all processes.
 echo
 echo "Sending all processes the SIGHUP signal."
diff -urNB rc.d-original/rc.M rc.d-patched/rc.M
--- rc.d-original/rc.M	2010-02-07 04:01:28.000000000 +0100
+++ rc.d-patched/rc.M	2010-12-28 17:37:41.000000000 +0100
@@ -20,10 +20,6 @@
   /sbin/ldconfig &
 fi
 
-# Screen blanks after 15 minutes idle time, and powers down in one hour
-# if the kernel supports APM or ACPI power management:
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60
-
 # Set the hostname.
 if [ -r /etc/HOSTNAME ]; then
   /bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)
@@ -36,31 +32,6 @@
 # Save the contents of 'dmesg':
 /bin/dmesg -s 65536 > /var/log/dmesg
 
-# Initialize PCMCIA devices:
-#
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices
-# could be fsck'ed along with the other drives.  This had some unfortunate
-# side effects, however, since root isn't yet read-write, and /var might not
-# even be mounted the .pid files can't be correctly written in /var/run and
-# the pcmcia system can't be correctly shut down.  If you want some PCMCIA
-# partition to be mounted at boot (or when the card is inserted) then add
-# the appropriate lines to /etc/pcmcia/scsi.opts.
-#
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!).  For example, with a
-# wireless card you might need to set options in /etc/pcmcia OR in
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with
-# extra options if needed for the encryption key, ESSID, etc.)
-#
-# Hopefully this situation will be unified in the future, but for now
-# that's how it is...
-#
-if [ -x /etc/rc.d/rc.pcmcia ]; then
-  . /etc/rc.d/rc.pcmcia start
-  # The cards might need a little extra time here to initialize.
-  sleep 5
-fi
-
 # Start the system logger.
 if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then
   . /etc/rc.d/rc.syslog start
@@ -72,26 +43,11 @@
   /usr/bin/fc-cache -f &
 fi
 
-# If we are returning from single-user mode we will need to restart
-# udevd on systems that use udev:
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then
-  if ! grep -wq nohotplug /proc/cmdline ; then
-    if [ -x /etc/rc.d/rc.udev ]; then
-      /bin/sh /etc/rc.d/rc.udev start
-    fi
-  fi
-fi
-
 # Initialize the networking hardware.
 if [ -x /etc/rc.d/rc.inet1 ]; then
   . /etc/rc.d/rc.inet1
 fi
 
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:
-if [ -x /etc/rc.d/rc.scanluns ]; then
-  . /etc/rc.d/rc.scanluns
-fi
-
 # Start networking daemons:
 if [ -x /etc/rc.d/rc.inet2 ]; then
   . /etc/rc.d/rc.inet2
@@ -118,17 +74,6 @@
 chmod 755 / 2> /dev/null
 chmod 1777 /tmp /var/tmp
 
-# Start APM or ACPI daemon.
-# If APM is enabled in the kernel, start apmd:
-if [ -e /proc/apm ]; then
-  if [ -x /usr/sbin/apmd ]; then
-    echo "Starting APM daemon:  /usr/sbin/apmd"
-    /usr/sbin/apmd
-  fi
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:
-  . /etc/rc.d/rc.acpid start
-fi
-
 # Update any existing icon cache files:
 if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then
   for theme_dir in /usr/share/icons/* ; do
@@ -161,11 +106,6 @@
   sh /etc/rc.d/rc.hald start
 fi
 
-# Start Bluetooth:
-if [ -x /etc/rc.d/rc.bluetooth ]; then
-  sh /etc/rc.d/rc.bluetooth start
-fi
-
 # Start wicd:
 if [ -x /etc/rc.d/rc.wicd ]; then
   sh /etc/rc.d/rc.wicd start
@@ -207,36 +147,6 @@
   /etc/rc.d/rc.atalk
 fi
 
-# Start smartd, which monitors the status of S.M.A.R.T. compatible
-# hard drives and reports any problems.  Note some devices (which aren't
-# smart, I guess ;) will hang if probed by smartd, so it's commented out
-# by default.
-#if [ -x /usr/sbin/smartd ]; then
-#  /usr/sbin/smartd
-#fi
-
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks
-# if some udev rule hasn't made them already:
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then
-  if ! grep -wq nohotplug /proc/cmdline ; then
-    if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then
-      /bin/sh /lib/udev/rc.optical-symlinks
-    fi
-  fi
-fi
-
-# Monitor the UPS with genpowerd.
-# To use this, uncomment this section and edit your settings in
-# /etc/genpowerd.conf (serial device, UPS type, etc).  For more information,
-# see "man genpowerd" or the extensive documentation in the
-# /usr/doc/genpower-*/ directory.
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want
-# support for stopping the UPS's inverter after the machine halts.
-#if [ -x /sbin/genpowerd ]; then
-#  echo "Starting genpowerd daemon..."
-#  /sbin/genpowerd
-#fi
-
 # Turn on process accounting.  To enable process accounting, make sure the
 # option for BSD process accounting is enabled in your kernel, and then
 # create the file /var/log/pacct (touch /var/log/pacct).  By default, process
@@ -301,11 +211,6 @@
   . /etc/rc.d/rc.sendmail start
 fi
 
-# Load ALSA (sound) defaults:
-if [ -x /etc/rc.d/rc.alsa ]; then
-  . /etc/rc.d/rc.alsa
-fi
-
 # Load a custom screen font if the user has an rc.font script.
 if [ -x /etc/rc.d/rc.font ]; then
   . /etc/rc.d/rc.font
@@ -337,11 +242,6 @@
   . /etc/rc.d/rc.samba start
 fi
 
-# Start the GPM mouse server:
-if [ -x /etc/rc.d/rc.gpm ]; then
-  . /etc/rc.d/rc.gpm start
-fi
-
 # If there are SystemV init scripts for this runlevel, run them.
 if [ -x /etc/rc.d/rc.sysvinit ]; then
   . /etc/rc.d/rc.sysvinit
diff -urNB rc.d-original/rc.inet2 rc.d-patched/rc.inet2
--- rc.d-original/rc.inet2	2007-09-18 00:07:32.000000000 +0200
+++ rc.d-patched/rc.inet2	2010-12-28 17:37:41.000000000 +0100
@@ -15,27 +15,6 @@
 
 # At this point, we are ready to talk to The World...
 
-
-# Mount remote (NFS) filesystems:
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then
-  # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS
-  # volumes defined in /etc/fstab since these will need to be running in order
-  # to mount them.  If they are not running, attempting to mount an NFS
-  # partition will cause mount to hang, or at least result in unreliable
-  # operation.  Keep this in mind if you plan to mount unlisted NFS
-  # partitions... 
-  # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run
-  # whether it is set as executable or not.  If you don't want to run it,
-  # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.
-  if [ -r /etc/rc.d/rc.rpc ]; then
-    sh /etc/rc.d/rc.rpc start
-  fi
-  echo "Mounting remote (NFS) file systems:  /sbin/mount -a -t nfs"
-  /sbin/mount -a -t nfs          # This may be our /usr runtime!
-  # Show the mounted volumes:
-  /sbin/mount -v -t nfs
-fi
-
 # If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,
 # and rpc.statd.  This might be needed to mount NFS partitions that are not
 # listed in /etc/fstab.  Starting this twice won't hurt as the script will
Personal tools