Difference between revisions of "Installation on Slackware 14"

From Linux-VServer

Jump to: navigation, search
(Download the packages)
(Make the guest)
(22 intermediate revisions by one user not shown)
Line 1: Line 1:
The purpose of this note is to setup a guest based on Slackware. What follows was tested on Slackware 14.0, 13.37 and 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working. You can find here a quick and easy howto concerning Linux-Vserver installation and configuration (patching the kernel + utils-vserver installation).
+
The purpose of this note is to setup a guest based on Slackware. What follows was tested on Slackware <b>14.1</b>, 14.0, 13.37 and 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working.
  
 
== Download ==
 
== Download ==
Line 11: Line 11:
 
You have downloaded the following files:
 
You have downloaded the following files:
  
* PKG_LIST is the package list to be installed in the guest
+
* <em>PKG_LIST</em> is the package list to be installed in the guest
* download_slack_pkg.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[64]-version_pkg sub-folder.
+
* <em>download_slack_pkg.sh</em> 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[64]-version_pkg sub-folder.
* make_slack_vserver.sh is the shell script that you have to adjust. It installs the guest.
+
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.
* rc is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc
+
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc
* slackware-14.0.patch is the patch which modify rc.0, rc.6 rc.M, rc.S, rc.inet2 and rc.syslog. It must be applyed after the creation of the vserver process. In the patch I switched off all the mounts and executable that are related to the hardware. Comments would be welcome about this :-).
+
* <em>linux-vserver_slackware-14.1.patch</em> is the patch which modify rc.0, rc.6 rc.M, rc.S, rc.inet2 and rc.syslog. It must be applyed after the creation of the vserver process. In the patch I switched off all the mounts and executable that are related to the hardware.
  
 
== Download the packages ==
 
== Download the packages ==
Line 21: Line 21:
 
First of all select a minimal set of packages to be installed on the virtual server. This list of 110 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. This set fits with the installation of a complete virtual web server including apache, apache-tomcat, php, mysql, postgresql, qmail and related, ftp, named.
 
First of all select a minimal set of packages to be installed on the virtual server. This list of 110 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. This set fits with the installation of a complete virtual web server including apache, apache-tomcat, php, mysql, postgresql, qmail and related, ftp, named.
  
I assume that the packages to be installed are stored in the slackware{$ARCH}-{$VERSION}_pkg folder. If not, adjust its location editing the make_slack_vserver.sh script.
+
I assume that the packages to be installed are stored in the ''slackware{$ARCH}-{$VERSION}_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. It can create a folder like <em>slackware{$ARCH}-{$VERSION}_pkg</em> for you, where <em>$ARCH</em> has to be "64" if you want to download 64b packages and null otherwise, while <em>$VERSION</em> is the Slackware version, so it's something like "14.0".
+
You can download my minimal set of packages running the shell script ''download_slack_pkg.sh''. It can create a folder like ''slackware{$ARCH}-{$VERSION}_pkg'' for you, where ''$ARCH'' has to be "64" if you want to download 64b packages or empty otherwise, while ''$VERSION'' is the Slackware version, so it's something like "14.1".
  
 
<pre>
 
<pre>
 
#!/bin/bash
 
#!/bin/bash
 
#
 
#
# v. 2012.09.29
+
# v. 2013.12.29
 +
# Now the script parses comments in the package list (thanks to Mark Colclough)
  
VERSION="14.0" # Slackware version
+
VERSION="14.1" # Slackware version
 
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders
 
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders
  
Line 43: Line 44:
 
SETUP=$PWD
 
SETUP=$PWD
  
# the directory where you downloaded the slackware packages
+
# the directory where you want to download the slackware packages
 
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"
 
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"
  
 
# create the folder where the pkg will be downloaded
 
# create the folder where the pkg will be downloaded
 
if [ ! -d "$PACKAGES" ]; then
 
if [ ! -d "$PACKAGES" ]; then
        mkdir -p $PACKAGES
+
    mkdir -p $PACKAGES
 
fi
 
fi
  
Line 61: Line 62:
 
if [ -f $LIST ]; then
 
if [ -f $LIST ]; then
 
         while read LINE
 
         while read LINE
             do
+
             do
 +
            [ "$LINE" ] || continue
 +
            [ "${LINE#\#}" = "$LINE" ] || continue
 
             wget "${SRC}slackware${ARCH}/${LINE}*.t?z"
 
             wget "${SRC}slackware${ARCH}/${LINE}*.t?z"
 
         done < $LIST
 
         done < $LIST
 
else
 
else
        echo "Can't find $LIST file."
+
    echo "Can't find $LIST file."
        exit 1
+
    exit 1
 
fi
 
fi
 
rm index.html*
 
  
 
# download packages from the patches folder
 
# download packages from the patches folder
Line 76: Line 77:
 
if [ -f ${LIST} ]; then
 
if [ -f ${LIST} ]; then
 
         while read LINE
 
         while read LINE
        do
+
    do
                IFS='/' read -ra PKG <<< "$LINE"
+
        IFS='/' read -ra PKG <<< "$LINE"
                 PKG_LEN=${#PKG[@]}
+
                 [ "${PKG#\#}" = "${PKG}" ] || continue
 +
        PKG_LEN=${#PKG[@]}
 
                 if [ $PKG_LEN == 2 ]; then
 
                 if [ $PKG_LEN == 2 ]; then
                        wget "${SRC}patches/packages/${PKG[1]}*.t?z"
+
                    wget "${SRC}patches/packages/${PKG[1]}*.t?z"
                fi
+
            fi
 
         done < $LIST
 
         done < $LIST
 
else
 
else
        echo "Can't find $LIST file."
+
    echo "Can't find $LIST file."
 
         exit 1
 
         exit 1
 
fi
 
fi
                                           
 
rm index.html*
 
 
</pre>
 
</pre>
  
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line
+
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.
 
+
<pre>
+
./download_slack_pkg.sh
+
</pre>
+
 
+
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.
+
  
 
== Make the guest ==
 
== 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.
+
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 adjusting and running the script make_slack_vserver.sh:
+
This is done adjusting and running the script ''make_slack_vserver.sh'':
 
<pre>
 
<pre>
 
#!/bin/bash
 
#!/bin/bash
 
#
 
#
# v. 2012.09.29
+
# v. 2013.12.29
 
# Author: Roberto Puzzanghera
 
# Author: Roberto Puzzanghera
 +
# Thanks to Mark Colclough for corrections
 
#
 
#
 
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)
 
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)
Line 117: Line 112:
 
# adjust this to where your things live
 
# adjust this to where your things live
 
NAME=test
 
NAME=test
HOSTNAME=$NAME.domain.com
+
HOSTNAME=$NAME.YOURDOMAIN.XY
IP=10.0.0.34
+
IP=10.0.0.182
 
INTERFACE=eth0:$IP/24
 
INTERFACE=eth0:$IP/24
CONTEXT=34000
+
CONTEXT=5182
VERSION=14.0 # Slackware version
+
VERSION=14.1 # Slackware version
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders
+
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders
  
 
# where is the vservers dir? default is /vservers
 
# where is the vservers dir? default is /vservers
Line 145: Line 140:
 
         echo "Can't find VDIR dir: $VDIR"
 
         echo "Can't find VDIR dir: $VDIR"
 
         echo "Exiting"
 
         echo "Exiting"
        echo
+
    echo
 
         exit 1  
 
         exit 1  
 
fi
 
fi
Line 152: Line 147:
 
         echo "Can't find SETUP dir: $SETUP"
 
         echo "Can't find SETUP dir: $SETUP"
 
         echo "Exiting"
 
         echo "Exiting"
        echo
+
    echo
 
         exit 1
 
         exit 1
 
fi
 
fi
Line 187: Line 182:
  
 
echo
 
echo
read -p "press any key to install packages..."  
+
read -p "press any key to install packages..."
 
cd $PACKAGES
 
cd $PACKAGES
installpkg -root $VDIR/$NAME *.t?z;
+
installpkg --root $VDIR/$NAME *.t?z;
upgradepkg patches/*.t?z;
+
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;
echo "...done"  
+
echo "...done"
 
echo
 
echo
  
Line 215: Line 210:
 
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts
 
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts
 
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts
 
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts
touch $VDIR/$NAME/etc/mtab                        
+
touch $VDIR/$NAME/etc/mtab
 
touch $VDIR/$NAME/etc/fstab
 
touch $VDIR/$NAME/etc/fstab
 
echo "...done"
 
echo "...done"
Line 230: Line 225:
 
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then
 
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then
  
        if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then
+
    if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then
                echo
+
              echo
                echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"
+
        echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"
                echo "Exiting"
+
        echo "Exiting"
                echo
+
        echo
                exit 1
+
        exit 1
        fi
+
    fi
  
 
         cd ${VDIR}/${NAME}/etc/rc.d
 
         cd ${VDIR}/${NAME}/etc/rc.d
Line 256: Line 251:
  
 
echo
 
echo
echo "More info on http://notes.sagredo.eu/node/7"
+
echo "More info at http://notes.sagredo.eu/node/7"
 
echo
 
echo
</pre>
 
 
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.
 
 
Edit the script inserting at least the NAME, the IP and the CONTEXT. The packages' location should be ok if you downloaded them using my script.
 
<pre>
 
./make_slack_vserver.sh
 
 
</pre>
 
</pre>
  
Line 272: Line 260:
 
<pre>
 
<pre>
 
cd /vservers/vserver_name/etc/rc.d
 
cd /vservers/vserver_name/etc/rc.d
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch
+
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch
 
</pre>
 
</pre>
  
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.
+
Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.
  
 
== Post installation tasks ==
 
== Post installation tasks ==
Line 292: Line 280:
 
== Patch applayed ==
 
== Patch applayed ==
 
<pre>
 
<pre>
Patch for Slackware 14.0 guest on a Linux-Vserver host
+
Patch for Slackware 14.1 guest on a Linux-Vserver host
 
========================================================
 
========================================================
 
by Roberto Puzzanghera - http://notes.sagredo.eu
 
by Roberto Puzzanghera - http://notes.sagredo.eu
version: 2012.09.29
+
version: 2013.12.29
 
========================================================
 
========================================================
  
 
+
diff -ruN rc.d-original/rc.0 rc.d/rc.0
diff -urNB rc.d-original/rc.0 rc.d/rc.0
+
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200
+
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100
+++ rc.d/rc.0   2012-09-29 15:23:23.347807225 +0200
+
 
@@ -37,22 +37,6 @@
 
@@ -37,22 +37,6 @@
                ;;
+
;;
 
  esac
 
  esac
 
   
 
   
Line 325: Line 312:
 
  if [ -x /etc/rc.d/rc.local_shutdown ]; then
 
  if [ -x /etc/rc.d/rc.local_shutdown ]; then
 
   /etc/rc.d/rc.local_shutdown stop
 
   /etc/rc.d/rc.local_shutdown stop
@@ -98,32 +82,6 @@
+
@@ -98,24 +82,6 @@
 
   sh /etc/rc.d/rc.messagebus stop
 
   sh /etc/rc.d/rc.messagebus stop
 
  fi
 
  fi
Line 347: Line 334:
 
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs
 
-/bin/umount -v -a -l -f -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
+
@@ -131,45 +97,11 @@
-    /usr/sbin/ppp-off
+
-  fi
+
-fi
+
-
+
# Shut down YP services:
+
if [ -x /etc/rc.d/rc.yp ]; then
+
  if grep -wq stop /etc/rc.d/rc.yp ; then
+
@@ -131,45 +89,11 @@
+
 
   fi
 
   fi
 
  fi
 
  fi
Line 404: Line 383:
 
  if [ ! "$1" = "fast" ]; then
 
  if [ ! "$1" = "fast" ]; then
 
   echo "Sending all processes the SIGTERM signal."
 
   echo "Sending all processes the SIGTERM signal."
@@ -187,16 +111,6 @@
+
@@ -187,16 +119,6 @@
 
   fi
 
   fi
 
  fi
 
  fi
Line 410: Line 389:
 
-# Carry a random seed between reboots.
 
-# Carry a random seed between reboots.
 
-echo "Saving random seed from /dev/urandom in /etc/random-seed."
 
-echo "Saving random seed from /dev/urandom in /etc/random-seed."
-# Use the pool size from /proc, or 512 bytes:
+
-# Use the pool size from /proc, or 4096 bits:
 
-if [ -r /proc/sys/kernel/random/poolsize ]; then
 
-if [ -r /proc/sys/kernel/random/poolsize ]; then
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null
+
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null
 
-else
 
-else
 
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
 
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
Line 421: Line 400:
 
  $command -w
 
  $command -w
 
   
 
   
@@ -205,17 +119,6 @@
+
@@ -205,80 +127,5 @@
 
   rm -f /var/lock/subsys/*
 
   rm -f /var/lock/subsys/*
 
  fi
 
  fi
Line 438: Line 417:
 
  # This never hurts:
 
  # This never hurts:
 
  /bin/sync
 
  /bin/sync
   
+
-
@@ -240,45 +143,10 @@
+
-# Close any volumes opened by cryptsetup:
   done
+
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then
  fi
+
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
+
-   # NOTE: we only support LUKS formatted volumes (except for swap)!
 +
-    LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
 +
-    DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
 +
-    OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
 +
-    if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then
 +
-      echo "Locking LUKS crypt volume '${LUKS}':"
 +
-      /sbin/cryptsetup luksClose ${LUKS}
 +
-    elif echo $OPTS | grep -wq swap ; then
 +
-      # If any of the volumes was used as encrypted swap,
 +
-      # then run mkswap on the underlying device -
 +
-      # in case other Linux installations on this computer should use it:
 +
-      echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"
 +
-      /sbin/cryptsetup remove ${LUKS}
 +
-      mkswap $DEV
 +
-   fi
 +
- done
 +
-fi
 +
-
 
-# Deactivate LVM volume groups:
 
-# Deactivate LVM volume groups:
 
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
 
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
Line 449: Line 445:
 
-fi
 
-fi
 
-
 
-
# This never hurts again (especially since root-on-LVM always fails
+
-# This never hurts again (especially since root-on-LVM always fails
# to deactivate the / logical volume...  but at least it was
+
-# to deactivate the / logical volume...  but at least it was
# remounted as read-only first)
+
-# remounted as read-only first)
/bin/sync
+
-/bin/sync
+
-
 
-# sleep 3 fixes problems with some hard drives that don't
 
-# sleep 3 fixes problems with some hard drives that don't
 
-# otherwise finish syncing before reboot or poweroff
 
-# otherwise finish syncing before reboot or poweroff
 
-/bin/sleep 3
 
-/bin/sleep 3
 
-
 
-
# This is to ensure all processes have completed on SMP machines:
+
-# This is to ensure all processes have completed on SMP machines:
wait
+
-wait
 
-
 
-
 
-if [ -x /sbin/genpowerd ]; then
 
-if [ -x /sbin/genpowerd ]; then
Line 485: Line 481:
 
-fi
 
-fi
 
-
 
-
diff -urNB rc.d-original/rc.6 rc.d/rc.6
+
diff -ruN rc.d-original/rc.0.rej rc.d/rc.0.rej
--- rc.d-original/rc.6  2012-08-15 01:03:12.000000000 +0200
+
--- rc.d-original/rc.0.rej 1970-01-01 01:00:00.000000000 +0100
+++ rc.d/rc.6  2012-09-29 15:23:23.363807355 +0200
+
+++ rc.d/rc.0.rej 2013-12-29 12:13:33.000000000 +0100
 +
@@ -0,0 +1,194 @@
 +
+--- rc.0 2013-09-23 01:43:20.000000000 +0200
 +
++++ rc.0 2013-11-08 22:15:10.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,24 +82,6 @@
 +
+   sh /etc/rc.d/rc.messagebus stop
 +
+ fi
 +
+
 +
+-# Kill any processes (typically gam) that would otherwise prevent
 +
+-# unmounting NFS volumes:
 +
+-unset FUSER_DELAY
 +
+-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do
 +
+-  echo "Killing processes holding NFS mount $dir open..."
 +
+-  # Background this to prevent fuser from also blocking shutdown:
 +
+-  /usr/bin/fuser -k -m $dir &
 +
+-  FUSER_DELAY=5
 +
+-done
 +
+-# If fuser was run, let it have some delay:
 +
+-if [ ! -z "$FUSER_DELAY" ]; then
 +
+-  sleep $FUSER_DELAY
 +
+-fi
 +
+-
 +
+-# Unmount any NFS, SMB, or CIFS filesystems:
 +
+-echo "Unmounting remote filesystems."
 +
+-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs
 +
+-
 +
+ # Try to shut down pppd:
 +
+ PS="$(ps ax)"
 +
+ if echo "$PS" | /bin/grep -q -w pppd ; then
 +
+@@ -131,45 +97,11 @@
 +
+  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
 +
+-  if [ -x /etc/rc.d/rc.inet1 ]; then
 +
+-    . /etc/rc.d/rc.inet1 stop
 +
+-  fi
 +
+-fi
 +
+-
 +
+-# In case dhcpcd might have been manually started on the command line,
 +
+-# look for the .pid file, and shut dhcpcd down if it's found:
 +
+-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
 +
+-  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
 +
+-  # A little time for /etc/resolv.conf and/or other files to
 +
+-  # restore themselves.
 +
+-  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
 +
+ 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
 +
+-
 +
+-# Stop udev:
 +
+-if [ -x /etc/rc.d/rc.udev ]; then
 +
+-  sh /etc/rc.d/rc.udev force-stop
 +
+-fi
 +
+-
 +
+ # Kill all remaining processes.
 +
+ if [ ! "$1" = "fast" ]; then
 +
+  echo "Sending all processes the SIGTERM signal."
 +
+@@ -187,16 +119,6 @@
 +
+  fi
 +
+ fi
 +
+
 +
+-# Carry a random seed between reboots.
 +
+-echo "Saving random seed from /dev/urandom in /etc/random-seed."
 +
+-# Use the pool size from /proc, or 4096 bits:
 +
+-if [ -r /proc/sys/kernel/random/poolsize ]; then
 +
+-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null
 +
+-else
 +
+-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
 +
+-fi
 +
+-/bin/chmod 600 /etc/random-seed
 +
+-
 +
+ # Before unmounting file systems write a reboot or halt record to wtmp.
 +
+ $command -w
 +
+
 +
+@@ -205,80 +127,5 @@
 +
+  rm -f /var/lock/subsys/*
 +
+ fi
 +
+
 +
+-# Turn off swap:
 +
+-echo "Turning off swap."
 +
+-/sbin/swapoff -a
 +
+-/bin/sync
 +
+-
 +
+-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
 +
+-
 +
+-# Close any volumes opened by cryptsetup:
 +
+-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then
 +
+-  cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
 +
+-    # NOTE: we only support LUKS formatted volumes (except for swap)!
 +
+-    LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
 +
+-    DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
 +
+-    OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
 +
+-    if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then
 +
+-      echo "Locking LUKS crypt volume '${LUKS}':"
 +
+-      /sbin/cryptsetup luksClose ${LUKS}
 +
+-    elif echo $OPTS | grep -wq swap ; then
 +
+-      # If any of the volumes was used as encrypted swap,
 +
+-      # then run mkswap on the underlying device -
 +
+-      # in case other Linux installations on this computer should use it:
 +
+-      echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"
 +
+-      /sbin/cryptsetup remove ${LUKS}
 +
+-      mkswap $DEV
 +
+-    fi
 +
+-  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 -ruN rc.d-original/rc.6 rc.d/rc.6
 +
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200
 +
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100
 
@@ -37,22 +37,6 @@
 
@@ -37,22 +37,6 @@
                ;;
+
;;
 
  esac
 
  esac
 
   
 
   
Line 511: Line 705:
 
  if [ -x /etc/rc.d/rc.local_shutdown ]; then
 
  if [ -x /etc/rc.d/rc.local_shutdown ]; then
 
   /etc/rc.d/rc.local_shutdown stop
 
   /etc/rc.d/rc.local_shutdown stop
@@ -98,32 +82,6 @@
+
@@ -98,24 +82,6 @@
 
   sh /etc/rc.d/rc.messagebus stop
 
   sh /etc/rc.d/rc.messagebus stop
 
  fi
 
  fi
Line 533: Line 727:
 
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs
 
-/bin/umount -v -a -l -f -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
+
@@ -131,45 +97,11 @@
-    /usr/sbin/ppp-off
+
-  fi
+
-fi
+
-
+
# Shut down YP services:
+
if [ -x /etc/rc.d/rc.yp ]; then
+
  if grep -wq stop /etc/rc.d/rc.yp ; then
+
@@ -131,45 +89,11 @@
+
 
   fi
 
   fi
 
  fi
 
  fi
Line 590: Line 776:
 
  if [ ! "$1" = "fast" ]; then
 
  if [ ! "$1" = "fast" ]; then
 
   echo "Sending all processes the SIGTERM signal."
 
   echo "Sending all processes the SIGTERM signal."
@@ -187,16 +111,6 @@
+
@@ -187,16 +119,6 @@
 
   fi
 
   fi
 
  fi
 
  fi
Line 596: Line 782:
 
-# Carry a random seed between reboots.
 
-# Carry a random seed between reboots.
 
-echo "Saving random seed from /dev/urandom in /etc/random-seed."
 
-echo "Saving random seed from /dev/urandom in /etc/random-seed."
-# Use the pool size from /proc, or 512 bytes:
+
-# Use the pool size from /proc, or 4096 bits:
 
-if [ -r /proc/sys/kernel/random/poolsize ]; then
 
-if [ -r /proc/sys/kernel/random/poolsize ]; then
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null
+
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null
 
-else
 
-else
 
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
 
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
Line 607: Line 793:
 
  $command -w
 
  $command -w
 
   
 
   
@@ -205,17 +119,6 @@
+
@@ -205,80 +127,5 @@
 
   rm -f /var/lock/subsys/*
 
   rm -f /var/lock/subsys/*
 
  fi
 
  fi
Line 624: Line 810:
 
  # This never hurts:
 
  # This never hurts:
 
  /bin/sync
 
  /bin/sync
   
+
-
@@ -240,45 +143,10 @@
+
-# Close any volumes opened by cryptsetup:
   done
+
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then
  fi
+
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
+
-   # NOTE: we only support LUKS formatted volumes (except for swap)!
 +
-    LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
 +
-    DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
 +
-    OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
 +
-    if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then
 +
-      echo "Locking LUKS crypt volume '${LUKS}':"
 +
-      /sbin/cryptsetup luksClose ${LUKS}
 +
-    elif echo $OPTS | grep -wq swap ; then
 +
-      # If any of the volumes was used as encrypted swap,
 +
-      # then run mkswap on the underlying device -
 +
-      # in case other Linux installations on this computer should use it:
 +
-      echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"
 +
-      /sbin/cryptsetup remove ${LUKS}
 +
-      mkswap $DEV
 +
-   fi
 +
- done
 +
-fi
 +
-
 
-# Deactivate LVM volume groups:
 
-# Deactivate LVM volume groups:
 
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
 
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then
Line 635: Line 838:
 
-fi
 
-fi
 
-
 
-
# This never hurts again (especially since root-on-LVM always fails
+
-# This never hurts again (especially since root-on-LVM always fails
# to deactivate the / logical volume...  but at least it was
+
-# to deactivate the / logical volume...  but at least it was
# remounted as read-only first)
+
-# remounted as read-only first)
/bin/sync
+
-/bin/sync
+
-
 
-# sleep 3 fixes problems with some hard drives that don't
 
-# sleep 3 fixes problems with some hard drives that don't
 
-# otherwise finish syncing before reboot or poweroff
 
-# otherwise finish syncing before reboot or poweroff
 
-/bin/sleep 3
 
-/bin/sleep 3
 
-
 
-
# This is to ensure all processes have completed on SMP machines:
+
-# This is to ensure all processes have completed on SMP machines:
wait
+
-wait
 
-
 
-
 
-if [ -x /sbin/genpowerd ]; then
 
-if [ -x /sbin/genpowerd ]; then
Line 671: Line 874:
 
-fi
 
-fi
 
-
 
-
diff -urNB rc.d-original/rc.M rc.d/rc.M
+
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2
--- rc.d-original/rc.M  2012-09-25 19:47:07.000000000 +0200
+
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200
+++ rc.d/rc.M  2012-09-29 15:33:01.756524040 +0200
+
+++ rc.d/rc.inet2 2013-12-29 12:13:33.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 .)
+
@@ -47,31 +43,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
+
@@ -83,40 +54,11 @@
+
  /usr/bin/fc-cache -f &
+
fi
+
+
-# Run rc.udev again.  This will start udev if it is not already running
+
-# (for example, upon return from runlevel 1), otherwise it will trigger it
+
-# to look for device changes and to generate persistent rules if needed.
+
-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
+
fi
+
+
-# Mount any additional filesystem types that haven't already been mounted:
+
-mount -a -v 2> /dev/null | grep -v "already mounted"
+
-
+
-# Start the Control Script for automounter:
+
-if [ -x /etc/rc.d/rc.autofs ]; then
+
-  sh /etc/rc.d/rc.autofs start
+
-fi
+
-
+
# Start the Network Time Protocol daemon:
+
if [ -x /etc/rc.d/rc.ntpd ]; then
+
  sh /etc/rc.d/rc.ntpd start
+
@@ -135,17 +77,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
+
@@ -183,18 +114,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 or networkmanager:
+
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then
+
-  sh /etc/rc.d/rc.wicd start
+
-elif [ -x /etc/rc.d/rc.networkmanager ]; then
+
-  sh /etc/rc.d/rc.networkmanager start
+
-fi
+
-
+
# These GTK+/pango files need to be kept up to date for
+
# proper input method, pixbuf loaders, and font support.
+
if [ -x /usr/bin/update-gtk-immodules ]; then
+
@@ -207,60 +126,11 @@
+
  /usr/bin/update-pango-querymodules --verbose
+
fi
+
+
-# Start dnsmasq, a simple DHCP/DNS server:
+
-if [ -x /etc/rc.d/rc.dnsmasq ]; then
+
-  /etc/rc.d/rc.dnsmasq start
+
-fi
+
-
+
# Start snmpd:
+
if [ -x /etc/rc.d/rc.snmpd ]; then
+
  /etc/rc.d/rc.snmpd start
+
fi
+
+
-# Start the print spooling system.  This will usually be LPRng (lpd) or CUPS.
+
-if [ -x /etc/rc.d/rc.cups ]; then
+
-  # Start CUPS:
+
-  /etc/rc.d/rc.cups start
+
-elif [ -x /etc/rc.d/rc.lprng ]; then
+
-  # Start LPRng (lpd):
+
-  . /etc/rc.d/rc.lprng start
+
-fi
+
-
+
-# Start netatalk. (a file/print server for Macs using Appletalk)
+
-if [ -x /etc/rc.d/rc.atalk ]; then
+
-  /etc/rc.d/rc.atalk start
+
-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
+
@@ -325,11 +195,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
+
@@ -361,11 +226,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.S rc.d/rc.S
+
--- rc.d-original/rc.S  2012-09-13 21:38:34.000000000 +0200
+
+++ rc.d/rc.S  2012-09-29 15:23:23.391807582 +0200
+
@@ -48,16 +48,6 @@
+
  fi
+
fi
+
+
-# Mount Control Groups filesystem interface:
+
-if grep -wq cgroup /proc/filesystems ; then
+
-  if [ -d /sys/fs/cgroup ]; then
+
-    mount -t cgroup cgroup /sys/fs/cgroup
+
-  else
+
-    mkdir -p /dev/cgroup
+
-    mount -t cgroup cgroup /dev/cgroup
+
-  fi
+
-fi
+
-
+
# Initialize the Logical Volume Manager.
+
# This won't start unless we find /etc/lvmtab (LVM1) or
+
# /etc/lvm/backup/ (LVM2).  This is created by /sbin/vgscan, so to
+
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2
+
--- rc.d-original/rc.inet2      2012-08-15 00:53:35.000000000 +0200
+
+++ rc.d/rc.inet2       2012-09-29 15:23:23.403807679 +0200
+
 
@@ -16,26 +16,6 @@
 
@@ -16,26 +16,6 @@
 
  # At this point, we are ready to talk to The World...
 
  # At this point, we are ready to talk to The World...
Line 954: Line 928:
 
  # is on a network partition).
 
  # is on a network partition).
 
  if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then
 
  if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog
+
diff -ruN rc.d-original/rc.M rc.d/rc.M
--- rc.d-original/rc.syslog     2010-10-21 01:03:54.000000000 +0200
+
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100
+++ rc.d/rc.syslog     2012-09-29 15:23:23.419807809 +0200
+
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100
@@ -5,8 +5,9 @@
+
@@ -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 .)
 +
diff -ruN rc.d-original/rc.S rc.d/rc.S
 +
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100
 +
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100
 +
@@ -48,31 +48,6 @@
 +
  fi
 +
fi
 +
 +
-# Mount Control Groups filesystem interface:
 +
-if grep -wq cgroup /proc/filesystems ; then
 +
-  if [ -d /sys/fs/cgroup ]; then
 +
-    # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
 +
-    # Check if we have some tools to autodetect the available cgroup controllers
 +
-    if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then
 +
-      # Mount a tmpfs as the cgroup filesystem root
 +
-      mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup
 +
-      # Autodetect available controllers and mount them in subfolders
 +
-      controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"
 +
-      for i in $controllers; do
 +
-        mkdir /sys/fs/cgroup/$i
 +
-        mount -t cgroup -o $i $i /sys/fs/cgroup/$i
 +
-      done
 +
-      unset i controllers
 +
-    else
 +
-      # We can't use autodetection so fall back mounting them all together
 +
-      mount -t cgroup cgroup /sys/fs/cgroup
 +
-    fi
 +
-  else
 +
-    mkdir -p /dev/cgroup
 +
-    mount -t cgroup cgroup /dev/cgroup
 +
-  fi
 +
-fi
 +
-
 +
# Initialize the Logical Volume Manager.
 +
# This won't start unless we find /etc/lvmtab (LVM1) or
 +
# /etc/lvm/backup/ (LVM2).  This is created by /sbin/vgscan, so to
 +
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog
 +
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200
 +
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100
 +
@@ -5,7 +5,7 @@
 
   
 
   
 
  syslogd_start() {
 
  syslogd_start() {
 
   if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then
 
   if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then
 
-    echo -n "Starting sysklogd daemons:  "
 
-    echo -n "Starting sysklogd daemons:  "
-    echo -n "/usr/sbin/syslogd "
 
 
+#    echo -n "Starting sysklogd daemons:  "
 
+#    echo -n "Starting sysklogd daemons:  "
+    echo -n "Starting /usr/sbin/syslogd "
+
    echo -n "/usr/sbin/syslogd "
+    echo
+
 
     /usr/sbin/syslogd
 
     /usr/sbin/syslogd
 
     # prevent syslogd/klogd race condition on SMP kernels
 
     # prevent syslogd/klogd race condition on SMP kernels
    if ps acx | grep -q udevd ; then
+
@@ -16,10 +16,10 @@
@@ -16,10 +17,10 @@
+
 
     else
 
     else
 
       sleep 1
 
       sleep 1
Line 982: Line 1,002:
 
  }
 
  }
 
</pre>
 
</pre>
 +
 +
== Contact ==
 +
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)

Revision as of 19:28, 5 January 2014

The purpose of this note is to setup a guest based on Slackware. What follows was tested on Slackware 14.1, 14.0, 13.37 and 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working.

Contents

Download

wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz
tar xzf slack_vserver.tar.gz
cd slack_vserver
ls

You have downloaded the following files:

  • PKG_LIST is the package list to be installed in the guest
  • download_slack_pkg.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[64]-version_pkg sub-folder.
  • make_slack_vserver.sh is the shell script that you have to adjust. It installs the guest.
  • rc is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc
  • linux-vserver_slackware-14.1.patch is the patch which modify rc.0, rc.6 rc.M, rc.S, rc.inet2 and rc.syslog. It must be applyed after the creation of the vserver process. In the patch I switched off all the mounts and executable that are related to the hardware.

Download the packages

First of all select a minimal set of packages to be installed on the virtual server. This list of 110 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. This set fits with the installation of a complete virtual web server including apache, apache-tomcat, php, mysql, postgresql, qmail and related, ftp, named.

I assume that the packages to be installed are stored in the slackware{$ARCH}-{$VERSION}_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. It can create a folder like slackware{$ARCH}-{$VERSION}_pkg for you, where $ARCH has to be "64" if you want to download 64b packages or empty otherwise, while $VERSION is the Slackware version, so it's something like "14.1".

#!/bin/bash
#
# v. 2013.12.29
# Now the script parses comments in the package list (thanks to Mark Colclough)

VERSION="14.1" # Slackware version
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders

# Put here your favourite Slackware repository
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"

# put here your pkg list
LIST="${PWD}/PKG_LIST"

# the directory where you unpacked slack_vserver.tar.gz
# $PWD should work, otherwise put /path/to/slack_vserver
SETUP=$PWD

# the directory where you want to download the slackware packages
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"

# create the folder where the pkg will be downloaded
if [ ! -d "$PACKAGES" ]; then
    mkdir -p $PACKAGES
fi

# create the "patches" sub-folder
if [ ! -d "${PACKAGES}/patches" ]; then
        mkdir -p "${PACKAGES}/patches"
fi

# download
cd $PACKAGES

if [ -f $LIST ]; then
        while read LINE
            do
            [ "$LINE" ] || continue
            [ "${LINE#\#}" = "$LINE" ] || continue
            wget "${SRC}slackware${ARCH}/${LINE}*.t?z"
        done < $LIST
else
    echo "Can't find $LIST file."
    exit 1
fi

# download packages from the patches folder
cd ${PACKAGES}/patches

if [ -f ${LIST} ]; then
        while read LINE
    do
        IFS='/' read -ra PKG <<< "$LINE"
                [ "${PKG#\#}" = "${PKG}" ] || continue
        PKG_LEN=${#PKG[@]}
                if [ $PKG_LEN == 2 ]; then
                    wget "${SRC}patches/packages/${PKG[1]}*.t?z"
            fi
        done < $LIST
else
    echo "Can't find $LIST file."
        exit 1
fi

NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.

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 adjusting and running the script make_slack_vserver.sh:

#!/bin/bash
#
# v. 2013.12.29
# Author: Roberto Puzzanghera
# Thanks to Mark Colclough for corrections
#
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)
#
# Comments are welcome :-)
# More info here: http://notes.sagredo.eu/node/7

# adjust this to where your things live
NAME=test
HOSTNAME=$NAME.YOURDOMAIN.XY
IP=10.0.0.182
INTERFACE=eth0:$IP/24
CONTEXT=5182
VERSION=14.1 # Slackware version
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders

# 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${ARCH}-${VERSION}_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} \
        --context $CONTEXT \
        --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 the /dev folder 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;
ROOT=$VDIR/$NAME upgradepkg patches/*.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"
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/
echo "...done"

echo
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $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 -n "Do you want that I apply the patch for you y/n? [y] "
read VAR_PATCH

if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then

    if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then
              echo
        echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"
        echo "Exiting"
        echo
        exit 1
    fi

        cd ${VDIR}/${NAME}/etc/rc.d
        patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch
        echo "patch applyed."
        echo
        echo "You can start and enter the virtual server typing: "
        echo
        echo "vserver $NAME start"
        echo "vserver $NAME enter"
        
        else
                echo
                echo "DON'T FORGET to patch /etc/rc.d as follows: "
                echo
                echo "cd $VDIR/$NAME/etc/rc.d"
                echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"
fi

echo
echo "More info at http://notes.sagredo.eu/node/7"
echo

Apply the patch

The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:

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

Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.

Post installation tasks

Put this inside your rc.local:

/usr/local/etc/rc.d/init.d/vprocunhide  start

Start the new server

vserver <vserver_name> start
vserver <vserver_name> enter

Patch applayed

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

diff -ruN rc.d-original/rc.0 rc.d/rc.0
--- rc.d-original/rc.0	2013-09-23 01:43:20.000000000 +0200
+++ rc.d/rc.0	2013-12-29 12:13:33.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,24 +82,6 @@
   sh /etc/rc.d/rc.messagebus stop
 fi
 
-# Kill any processes (typically gam) that would otherwise prevent
-# unmounting NFS volumes:
-unset FUSER_DELAY
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do
-  echo "Killing processes holding NFS mount $dir open..."
-  # Background this to prevent fuser from also blocking shutdown:
-  /usr/bin/fuser -k -m $dir &
-  FUSER_DELAY=5
-done
-# If fuser was run, let it have some delay:
-if [ ! -z "$FUSER_DELAY" ]; then
-  sleep $FUSER_DELAY
-fi
-
-# Unmount any NFS, SMB, or CIFS filesystems:
-echo "Unmounting remote filesystems."
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs
-
 # Try to shut down pppd:
 PS="$(ps ax)"
 if echo "$PS" | /bin/grep -q -w pppd ; then
@@ -131,45 +97,11 @@
   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
-  if [ -x /etc/rc.d/rc.inet1 ]; then
-    . /etc/rc.d/rc.inet1 stop
-  fi
-fi
-
-# In case dhcpcd might have been manually started on the command line,
-# look for the .pid file, and shut dhcpcd down if it's found:
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
-  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
-  # A little time for /etc/resolv.conf and/or other files to
-  # restore themselves.
-  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
 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
-
-# Stop udev:
-if [ -x /etc/rc.d/rc.udev ]; then
-  sh /etc/rc.d/rc.udev force-stop
-fi
-
 # Kill all remaining processes.
 if [ ! "$1" = "fast" ]; then
   echo "Sending all processes the SIGTERM signal."
@@ -187,16 +119,6 @@
   fi
 fi
 
-# Carry a random seed between reboots.
-echo "Saving random seed from /dev/urandom in /etc/random-seed."
-# Use the pool size from /proc, or 4096 bits:
-if [ -r /proc/sys/kernel/random/poolsize ]; then
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null
-else
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
-fi
-/bin/chmod 600 /etc/random-seed
-
 # Before unmounting file systems write a reboot or halt record to wtmp.
 $command -w
 
@@ -205,80 +127,5 @@
   rm -f /var/lock/subsys/*
 fi
 
-# Turn off swap:
-echo "Turning off swap."
-/sbin/swapoff -a
-/bin/sync
-
-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
-
-# Close any volumes opened by cryptsetup:
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then
-  cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
-    # NOTE: we only support LUKS formatted volumes (except for swap)!
-    LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
-    DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
-    OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
-    if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then
-      echo "Locking LUKS crypt volume '${LUKS}':"
-      /sbin/cryptsetup luksClose ${LUKS}
-    elif echo $OPTS | grep -wq swap ; then
-      # If any of the volumes was used as encrypted swap,
-      # then run mkswap on the underlying device -
-      # in case other Linux installations on this computer should use it:
-      echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"
-      /sbin/cryptsetup remove ${LUKS}
-      mkswap $DEV
-    fi
-  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 -ruN rc.d-original/rc.0.rej rc.d/rc.0.rej
--- rc.d-original/rc.0.rej	1970-01-01 01:00:00.000000000 +0100
+++ rc.d/rc.0.rej	2013-12-29 12:13:33.000000000 +0100
@@ -0,0 +1,194 @@
+--- rc.0	2013-09-23 01:43:20.000000000 +0200
++++ rc.0	2013-11-08 22:15:10.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,24 +82,6 @@
+   sh /etc/rc.d/rc.messagebus stop
+ fi
+ 
+-# Kill any processes (typically gam) that would otherwise prevent
+-# unmounting NFS volumes:
+-unset FUSER_DELAY
+-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do
+-  echo "Killing processes holding NFS mount $dir open..."
+-  # Background this to prevent fuser from also blocking shutdown:
+-  /usr/bin/fuser -k -m $dir &
+-  FUSER_DELAY=5
+-done
+-# If fuser was run, let it have some delay:
+-if [ ! -z "$FUSER_DELAY" ]; then
+-  sleep $FUSER_DELAY
+-fi
+-
+-# Unmount any NFS, SMB, or CIFS filesystems:
+-echo "Unmounting remote filesystems."
+-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs
+-
+ # Try to shut down pppd:
+ PS="$(ps ax)"
+ if echo "$PS" | /bin/grep -q -w pppd ; then
+@@ -131,45 +97,11 @@
+   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
+-  if [ -x /etc/rc.d/rc.inet1 ]; then
+-    . /etc/rc.d/rc.inet1 stop
+-  fi
+-fi
+-
+-# In case dhcpcd might have been manually started on the command line,
+-# look for the .pid file, and shut dhcpcd down if it's found:
+-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
+-  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
+-  # A little time for /etc/resolv.conf and/or other files to
+-  # restore themselves.
+-  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
+ 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
+-
+-# Stop udev:
+-if [ -x /etc/rc.d/rc.udev ]; then
+-  sh /etc/rc.d/rc.udev force-stop
+-fi
+-
+ # Kill all remaining processes.
+ if [ ! "$1" = "fast" ]; then
+   echo "Sending all processes the SIGTERM signal."
+@@ -187,16 +119,6 @@
+   fi
+ fi
+ 
+-# Carry a random seed between reboots.
+-echo "Saving random seed from /dev/urandom in /etc/random-seed."
+-# Use the pool size from /proc, or 4096 bits:
+-if [ -r /proc/sys/kernel/random/poolsize ]; then
+-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null
+-else
+-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
+-fi
+-/bin/chmod 600 /etc/random-seed
+-
+ # Before unmounting file systems write a reboot or halt record to wtmp.
+ $command -w
+ 
+@@ -205,80 +127,5 @@
+   rm -f /var/lock/subsys/*
+ fi
+ 
+-# Turn off swap:
+-echo "Turning off swap."
+-/sbin/swapoff -a
+-/bin/sync
+-
+-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
+-
+-# Close any volumes opened by cryptsetup:
+-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then
+-  cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
+-    # NOTE: we only support LUKS formatted volumes (except for swap)!
+-    LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
+-    DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
+-    OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
+-    if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then
+-      echo "Locking LUKS crypt volume '${LUKS}':"
+-      /sbin/cryptsetup luksClose ${LUKS}
+-    elif echo $OPTS | grep -wq swap ; then
+-      # If any of the volumes was used as encrypted swap,
+-      # then run mkswap on the underlying device -
+-      # in case other Linux installations on this computer should use it:
+-      echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"
+-      /sbin/cryptsetup remove ${LUKS}
+-      mkswap $DEV
+-    fi
+-  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 -ruN rc.d-original/rc.6 rc.d/rc.6
--- rc.d-original/rc.6	2013-09-23 01:43:20.000000000 +0200
+++ rc.d/rc.6	2013-12-29 12:13:33.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,24 +82,6 @@
   sh /etc/rc.d/rc.messagebus stop
 fi
 
-# Kill any processes (typically gam) that would otherwise prevent
-# unmounting NFS volumes:
-unset FUSER_DELAY
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do
-  echo "Killing processes holding NFS mount $dir open..."
-  # Background this to prevent fuser from also blocking shutdown:
-  /usr/bin/fuser -k -m $dir &
-  FUSER_DELAY=5
-done
-# If fuser was run, let it have some delay:
-if [ ! -z "$FUSER_DELAY" ]; then
-  sleep $FUSER_DELAY
-fi
-
-# Unmount any NFS, SMB, or CIFS filesystems:
-echo "Unmounting remote filesystems."
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs
-
 # Try to shut down pppd:
 PS="$(ps ax)"
 if echo "$PS" | /bin/grep -q -w pppd ; then
@@ -131,45 +97,11 @@
   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
-  if [ -x /etc/rc.d/rc.inet1 ]; then
-    . /etc/rc.d/rc.inet1 stop
-  fi
-fi
-
-# In case dhcpcd might have been manually started on the command line,
-# look for the .pid file, and shut dhcpcd down if it's found:
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then
-  /sbin/dhcpcd -k 1> /dev/null 2> /dev/null
-  # A little time for /etc/resolv.conf and/or other files to
-  # restore themselves.
-  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
 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
-
-# Stop udev:
-if [ -x /etc/rc.d/rc.udev ]; then
-  sh /etc/rc.d/rc.udev force-stop
-fi
-
 # Kill all remaining processes.
 if [ ! "$1" = "fast" ]; then
   echo "Sending all processes the SIGTERM signal."
@@ -187,16 +119,6 @@
   fi
 fi
 
-# Carry a random seed between reboots.
-echo "Saving random seed from /dev/urandom in /etc/random-seed."
-# Use the pool size from /proc, or 4096 bits:
-if [ -r /proc/sys/kernel/random/poolsize ]; then
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null
-else
-  /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null
-fi
-/bin/chmod 600 /etc/random-seed
-
 # Before unmounting file systems write a reboot or halt record to wtmp.
 $command -w
 
@@ -205,80 +127,5 @@
   rm -f /var/lock/subsys/*
 fi
 
-# Turn off swap:
-echo "Turning off swap."
-/sbin/swapoff -a
-/bin/sync
-
-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
-
-# Close any volumes opened by cryptsetup:
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then
-  cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do
-    # NOTE: we only support LUKS formatted volumes (except for swap)!
-    LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')
-    DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')
-    OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')
-    if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then
-      echo "Locking LUKS crypt volume '${LUKS}':"
-      /sbin/cryptsetup luksClose ${LUKS}
-    elif echo $OPTS | grep -wq swap ; then
-      # If any of the volumes was used as encrypted swap,
-      # then run mkswap on the underlying device -
-      # in case other Linux installations on this computer should use it:
-      echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"
-      /sbin/cryptsetup remove ${LUKS}
-      mkswap $DEV
-    fi
-  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 -ruN rc.d-original/rc.inet2 rc.d/rc.inet2
--- rc.d-original/rc.inet2	2012-08-15 00:53:35.000000000 +0200
+++ rc.d/rc.inet2	2013-12-29 12:13:33.000000000 +0100
@@ -16,26 +16,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
@@ -44,23 +24,6 @@
   sh /etc/rc.d/rc.rpc start
 fi
 
-# Mount remote CIFS filesystems.  Note that where possible, using CIFS is
-# preferred over SMBFS.  SMBFS is no longer actively maintained.
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then
-  echo "Mounting remote CIFS file systems:  /sbin/mount -a -t cifs"
-  /sbin/mount -a -t cifs
-  # Show the mounted volumes:
-  /sbin/mount -v -t cifs
-fi
-
-# Mount remote SMB filesystems:
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then
-  echo "Mounting remote SMBFS file systems:  /sbin/mount -a -t smbfs"
-  /sbin/mount -a -t smbfs
-  # Show the mounted volumes:
-  /sbin/mount -v -t smbfs
-fi
-
 # Start the system logger if it is not already running (maybe because /usr
 # is on a network partition).
 if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then
diff -ruN rc.d-original/rc.M rc.d/rc.M
--- rc.d-original/rc.M	2013-10-28 06:07:17.000000000 +0100
+++ rc.d/rc.M	2013-12-29 12:14:08.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 .)
diff -ruN rc.d-original/rc.S rc.d/rc.S
--- rc.d-original/rc.S	2013-10-28 06:06:39.000000000 +0100
+++ rc.d/rc.S	2013-12-29 12:13:33.000000000 +0100
@@ -48,31 +48,6 @@
   fi
 fi
 
-# Mount Control Groups filesystem interface:
-if grep -wq cgroup /proc/filesystems ; then
-  if [ -d /sys/fs/cgroup ]; then
-    # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)
-    # Check if we have some tools to autodetect the available cgroup controllers
-    if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then
-      # Mount a tmpfs as the cgroup filesystem root
-      mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup
-      # Autodetect available controllers and mount them in subfolders
-      controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"
-      for i in $controllers; do
-        mkdir /sys/fs/cgroup/$i
-        mount -t cgroup -o $i $i /sys/fs/cgroup/$i
-      done
-      unset i controllers
-    else
-      # We can't use autodetection so fall back mounting them all together
-      mount -t cgroup cgroup /sys/fs/cgroup
-    fi
-  else
-    mkdir -p /dev/cgroup
-    mount -t cgroup cgroup /dev/cgroup
-  fi
-fi
-
 # Initialize the Logical Volume Manager.
 # This won't start unless we find /etc/lvmtab (LVM1) or
 # /etc/lvm/backup/ (LVM2).  This is created by /sbin/vgscan, so to
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog
--- rc.d-original/rc.syslog	2013-06-22 22:49:03.000000000 +0200
+++ rc.d/rc.syslog	2013-12-29 12:13:33.000000000 +0100
@@ -5,7 +5,7 @@
 
 syslogd_start() {
   if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then
-    echo -n "Starting sysklogd daemons:  "
+#    echo -n "Starting sysklogd daemons:  "
     echo -n "/usr/sbin/syslogd "
     /usr/sbin/syslogd
     # prevent syslogd/klogd race condition on SMP kernels
@@ -16,10 +16,10 @@
     else
       sleep 1
     fi
-    echo "/usr/sbin/klogd -c 3 -x"
+#    echo "/usr/sbin/klogd -c 3 -x"
     # '-c 3' = display level 'error' or higher messages on console
     # '-x' = turn off broken EIP translation
-    /usr/sbin/klogd -c 3 -x
+#    /usr/sbin/klogd -c 3 -x
   fi
 }

Contact

Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)

Personal tools