http://svn.linux-vserver.org/api.php?action=feedcontributions&user=Roberto.puzzanghera&feedformat=atom
Linux-VServer - User contributions [en]
2024-03-29T07:18:35Z
User contributions
MediaWiki 1.20.2
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2019-07-21T12:59:49Z
<p>Roberto.puzzanghera: /* Contact */</p>
<hr />
<div>The purpose of this note is to setup a guest based on Slackware. What follows was tested on Slackware 14.2 to 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working.<br />
<br />
== Download ==<br />
<pre><br />
wget https://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.07.05<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: https://notes.sagredo.eu/other-contents-186/slackware-guest-on-linux-vserver-7.html<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.2 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd<br />
rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.2.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.1, 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2016-03-26 17:48:37.000000000 +0100<br />
+++ rc.d/rc.6 2016-07-09 14:08:48.470713168 +0200<br />
@@ -37,36 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-# This will also create or update the timestamps in /etc/adjtime.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q " : rtc" /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if [ /etc/adjtime -nt /etc/hardwareclock ]; then<br />
- if grep -q "^LOCAL" /etc/adjtime ; then<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- else<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --systohc<br />
- elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -126,10 +96,6 @@<br />
sleep $FUSER_DELAY<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems:"<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -215,22 +181,11 @@<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$shutdown_command -w<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
# Stop cgmanager and cgproxy:<br />
if [ -x /etc/rc.d/rc.cgmanager ]; then<br />
sh /etc/rc.d/rc.cgmanager stop<br />
fi<br />
<br />
-echo "Unmounting local file systems:"<br />
-/bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null<br />
-<br />
-echo "Remounting root filesystem read-only:"<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -288,12 +243,3 @@<br />
fi<br />
fi<br />
fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$shutdown_command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2016-05-05 06:27:00.000000000 +0200<br />
+++ rc.d/rc.M 2016-07-09 14:14:20.090096570 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -109,13 +105,6 @@<br />
sh /etc/rc.d/rc.bluetooth start<br />
fi<br />
<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
@@ -126,14 +115,6 @@<br />
. /etc/rc.d/rc.scanluns<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -153,16 +134,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start ACPI daemon.<br />
-if [ -x /etc/rc.d/rc.acpid ]; then<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
-# Enable CPU frequency scaling:<br />
-if [ -x /etc/rc.d/rc.cpufreq ]; then<br />
- . /etc/rc.d/rc.cpufreq start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2016-07-09 14:10:49.388841574 +0200<br />
@@ -16,51 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
-# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
-# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
-# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
-# check if things are already running before trying to start them.<br />
-if [ -x /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
-fi<br />
-<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (https://notes.sagredo.eu/other-contents-186/slackware-guest-on-linux-vserver-7.html)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2019-07-21T12:59:09Z
<p>Roberto.puzzanghera: /* Make the guest */</p>
<hr />
<div>The purpose of this note is to setup a guest based on Slackware. What follows was tested on Slackware 14.2 to 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working.<br />
<br />
== Download ==<br />
<pre><br />
wget https://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.07.05<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: https://notes.sagredo.eu/other-contents-186/slackware-guest-on-linux-vserver-7.html<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.2 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd<br />
rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.2.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.1, 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2016-03-26 17:48:37.000000000 +0100<br />
+++ rc.d/rc.6 2016-07-09 14:08:48.470713168 +0200<br />
@@ -37,36 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-# This will also create or update the timestamps in /etc/adjtime.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q " : rtc" /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if [ /etc/adjtime -nt /etc/hardwareclock ]; then<br />
- if grep -q "^LOCAL" /etc/adjtime ; then<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- else<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --systohc<br />
- elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -126,10 +96,6 @@<br />
sleep $FUSER_DELAY<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems:"<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -215,22 +181,11 @@<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$shutdown_command -w<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
# Stop cgmanager and cgproxy:<br />
if [ -x /etc/rc.d/rc.cgmanager ]; then<br />
sh /etc/rc.d/rc.cgmanager stop<br />
fi<br />
<br />
-echo "Unmounting local file systems:"<br />
-/bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null<br />
-<br />
-echo "Remounting root filesystem read-only:"<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -288,12 +243,3 @@<br />
fi<br />
fi<br />
fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$shutdown_command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2016-05-05 06:27:00.000000000 +0200<br />
+++ rc.d/rc.M 2016-07-09 14:14:20.090096570 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -109,13 +105,6 @@<br />
sh /etc/rc.d/rc.bluetooth start<br />
fi<br />
<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
@@ -126,14 +115,6 @@<br />
. /etc/rc.d/rc.scanluns<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -153,16 +134,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start ACPI daemon.<br />
-if [ -x /etc/rc.d/rc.acpid ]; then<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
-# Enable CPU frequency scaling:<br />
-if [ -x /etc/rc.d/rc.cpufreq ]; then<br />
- . /etc/rc.d/rc.cpufreq start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2016-07-09 14:10:49.388841574 +0200<br />
@@ -16,51 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
-# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
-# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
-# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
-# check if things are already running before trying to start them.<br />
-if [ -x /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
-fi<br />
-<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2019-07-21T12:58:14Z
<p>Roberto.puzzanghera: /* Download */</p>
<hr />
<div>The purpose of this note is to setup a guest based on Slackware. What follows was tested on Slackware 14.2 to 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working.<br />
<br />
== Download ==<br />
<pre><br />
wget https://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.07.05<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.2 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd<br />
rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.2.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.1, 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2016-03-26 17:48:37.000000000 +0100<br />
+++ rc.d/rc.6 2016-07-09 14:08:48.470713168 +0200<br />
@@ -37,36 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-# This will also create or update the timestamps in /etc/adjtime.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q " : rtc" /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if [ /etc/adjtime -nt /etc/hardwareclock ]; then<br />
- if grep -q "^LOCAL" /etc/adjtime ; then<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- else<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --systohc<br />
- elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -126,10 +96,6 @@<br />
sleep $FUSER_DELAY<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems:"<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -215,22 +181,11 @@<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$shutdown_command -w<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
# Stop cgmanager and cgproxy:<br />
if [ -x /etc/rc.d/rc.cgmanager ]; then<br />
sh /etc/rc.d/rc.cgmanager stop<br />
fi<br />
<br />
-echo "Unmounting local file systems:"<br />
-/bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null<br />
-<br />
-echo "Remounting root filesystem read-only:"<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -288,12 +243,3 @@<br />
fi<br />
fi<br />
fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$shutdown_command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2016-05-05 06:27:00.000000000 +0200<br />
+++ rc.d/rc.M 2016-07-09 14:14:20.090096570 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -109,13 +105,6 @@<br />
sh /etc/rc.d/rc.bluetooth start<br />
fi<br />
<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
@@ -126,14 +115,6 @@<br />
. /etc/rc.d/rc.scanluns<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -153,16 +134,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start ACPI daemon.<br />
-if [ -x /etc/rc.d/rc.acpid ]; then<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
-# Enable CPU frequency scaling:<br />
-if [ -x /etc/rc.d/rc.cpufreq ]; then<br />
- . /etc/rc.d/rc.cpufreq start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2016-07-09 14:10:49.388841574 +0200<br />
@@ -16,51 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
-# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
-# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
-# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
-# check if things are already running before trying to start them.<br />
-if [ -x /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
-fi<br />
-<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2016-07-09T12:26:25Z
<p>Roberto.puzzanghera: /* Patch applayed */</p>
<hr />
<div>The purpose of this note is to setup a guest based on Slackware. What follows was tested on Slackware 14.2 to 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.07.05<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.2 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd<br />
rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.2.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.1, 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2016-03-26 17:48:37.000000000 +0100<br />
+++ rc.d/rc.6 2016-07-09 14:08:48.470713168 +0200<br />
@@ -37,36 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-# This will also create or update the timestamps in /etc/adjtime.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q " : rtc" /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if [ /etc/adjtime -nt /etc/hardwareclock ]; then<br />
- if grep -q "^LOCAL" /etc/adjtime ; then<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- else<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --systohc<br />
- elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -126,10 +96,6 @@<br />
sleep $FUSER_DELAY<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems:"<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -215,22 +181,11 @@<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$shutdown_command -w<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
# Stop cgmanager and cgproxy:<br />
if [ -x /etc/rc.d/rc.cgmanager ]; then<br />
sh /etc/rc.d/rc.cgmanager stop<br />
fi<br />
<br />
-echo "Unmounting local file systems:"<br />
-/bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null<br />
-<br />
-echo "Remounting root filesystem read-only:"<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -288,12 +243,3 @@<br />
fi<br />
fi<br />
fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$shutdown_command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2016-05-05 06:27:00.000000000 +0200<br />
+++ rc.d/rc.M 2016-07-09 14:14:20.090096570 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -109,13 +105,6 @@<br />
sh /etc/rc.d/rc.bluetooth start<br />
fi<br />
<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
@@ -126,14 +115,6 @@<br />
. /etc/rc.d/rc.scanluns<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -153,16 +134,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start ACPI daemon.<br />
-if [ -x /etc/rc.d/rc.acpid ]; then<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
-# Enable CPU frequency scaling:<br />
-if [ -x /etc/rc.d/rc.cpufreq ]; then<br />
- . /etc/rc.d/rc.cpufreq start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2016-07-09 14:10:49.388841574 +0200<br />
@@ -16,51 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
-# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
-# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
-# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
-# check if things are already running before trying to start them.<br />
-if [ -x /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
-fi<br />
-<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2016-07-05T12:29:50Z
<p>Roberto.puzzanghera: </p>
<hr />
<div>The purpose of this note is to setup a guest based on Slackware. What follows was tested on Slackware 14.2 to 13.1 (both 32b and 64b). I will assume that you have a Linux-Vserver box working.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.07.05<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.2 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd<br />
rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.2.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.1, 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.2 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2016.06.08<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2016-03-26 17:48:37.000000000 +0100<br />
+++ rc.d/rc.6 2016-06-08 21:57:26.990957045 +0200<br />
@@ -37,36 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-# This will also create or update the timestamps in /etc/adjtime.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q " : rtc" /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if [ /etc/adjtime -nt /etc/hardwareclock ]; then<br />
- if grep -q "^LOCAL" /etc/adjtime ; then<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- else<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --systohc<br />
- elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -126,10 +96,6 @@<br />
sleep $FUSER_DELAY<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems:"<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -215,22 +181,11 @@<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$shutdown_command -w<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
# Stop cgmanager and cgproxy:<br />
if [ -x /etc/rc.d/rc.cgmanager ]; then<br />
sh /etc/rc.d/rc.cgmanager stop<br />
fi<br />
<br />
-echo "Unmounting local file systems:"<br />
-/bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null<br />
-<br />
-echo "Remounting root filesystem read-only:"<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -288,12 +243,3 @@<br />
fi<br />
fi<br />
fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$shutdown_command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2016-05-05 06:27:00.000000000 +0200<br />
+++ rc.d/rc.M 2016-06-08 21:36:45.097439107 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -109,18 +105,6 @@<br />
sh /etc/rc.d/rc.bluetooth start<br />
fi<br />
<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
-# Start networking daemons:<br />
-if [ -x /etc/rc.d/rc.inet2 ]; then<br />
- . /etc/rc.d/rc.inet2<br />
-fi<br />
-<br />
# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
if [ -x /etc/rc.d/rc.scanluns ]; then<br />
. /etc/rc.d/rc.scanluns<br />
@@ -129,11 +113,6 @@<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done<br />
<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -153,16 +132,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start ACPI daemon.<br />
-if [ -x /etc/rc.d/rc.acpid ]; then<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
-# Enable CPU frequency scaling:<br />
-if [ -x /etc/rc.d/rc.cpufreq ]; then<br />
- . /etc/rc.d/rc.cpufreq start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2016-07-05T12:28:33Z
<p>Roberto.puzzanghera: /* Patch applayed */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.07.05<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.2 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd<br />
rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.2.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.1, 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.2 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2016.06.08<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2016-03-26 17:48:37.000000000 +0100<br />
+++ rc.d/rc.6 2016-06-08 21:57:26.990957045 +0200<br />
@@ -37,36 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-# This will also create or update the timestamps in /etc/adjtime.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q " : rtc" /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if [ /etc/adjtime -nt /etc/hardwareclock ]; then<br />
- if grep -q "^LOCAL" /etc/adjtime ; then<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- else<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --systohc<br />
- elif grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- if [ ! -r /etc/adjtime ]; then<br />
- echo "Creating system time correction file /etc/adjtime."<br />
- fi<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -126,10 +96,6 @@<br />
sleep $FUSER_DELAY<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems:"<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g"<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -215,22 +181,11 @@<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$shutdown_command -w<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
# Stop cgmanager and cgproxy:<br />
if [ -x /etc/rc.d/rc.cgmanager ]; then<br />
sh /etc/rc.d/rc.cgmanager stop<br />
fi<br />
<br />
-echo "Unmounting local file systems:"<br />
-/bin/umount -v -a -t no,proc,sysfs | tr -d ' ' | grep successfully | sed "s/:successfullyunmounted/ has been successfully unmounted./g" 2> /dev/null<br />
-<br />
-echo "Remounting root filesystem read-only:"<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -288,12 +243,3 @@<br />
fi<br />
fi<br />
fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$shutdown_command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2016-05-05 06:27:00.000000000 +0200<br />
+++ rc.d/rc.M 2016-06-08 21:36:45.097439107 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -109,18 +105,6 @@<br />
sh /etc/rc.d/rc.bluetooth start<br />
fi<br />
<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
-# Start networking daemons:<br />
-if [ -x /etc/rc.d/rc.inet2 ]; then<br />
- . /etc/rc.d/rc.inet2<br />
-fi<br />
-<br />
# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
if [ -x /etc/rc.d/rc.scanluns ]; then<br />
. /etc/rc.d/rc.scanluns<br />
@@ -129,11 +113,6 @@<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
mount -a -v 2> /dev/null | grep -v -e "already mounted" -e "ignored" | cut -f 1 -d : | tr -d ' ' | while read dev ; do mount | grep "${dev} " ; done<br />
<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -153,16 +132,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start ACPI daemon.<br />
-if [ -x /etc/rc.d/rc.acpid ]; then<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
-# Enable CPU frequency scaling:<br />
-if [ -x /etc/rc.d/rc.cpufreq ]; then<br />
- . /etc/rc.d/rc.cpufreq start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons -maxdepth 2 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2016-07-05T12:26:41Z
<p>Roberto.puzzanghera: /* Apply the patch */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.07.05<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.2 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd<br />
rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.2.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.1, 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2016-07-05T12:25:42Z
<p>Roberto.puzzanghera: /* Make the guest */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.07.05<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.2 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.sshd and rc.inetd, removing not needed rc scripts"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.sshd $VDIR/$NAME/etc/rc.d/rc.inetd<br />
rm $VDIR/$NAME/etc/rc.d/rc.cpufreq $VDIR/$NAME/etc/rc.d/rc.modules* $VDIR/$NAME/etc/rc.d/rc.inet1* $VDIR/$NAME/etc/rc.d/rc.loop<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check them later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2016-07-05T12:24:43Z
<p>Roberto.puzzanghera: /* Download the packages */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. This list of 123 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 460M 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.<br />
<br />
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''.<br />
<br />
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.2".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2016.06.08<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.2" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info at http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2016-07-05T12:23:23Z
<p>Roberto.puzzanghera: /* Download */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>linux-vserver_slackware-14.2.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info at http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2014-08-05T18:31:47Z
<p>Roberto.puzzanghera: /* Patch applayed */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info at http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Documentation
Documentation
2014-01-05T18:49:16Z
<p>Roberto.puzzanghera: /* Installation */</p>
<hr />
<div><div style="margin: 2em auto 2em auto; padding: 10px; background-color: #F9ECCD; border: 1px solid #004433; text-align: center;"><br />
[[Image:Icon-Caution.png|left]]<br />
We are currently migrating to MediaWiki from our old system, but not all content has been migrated yet. Take a look at the [[Wiki Team]] page for instructions how to help or look at the [http://oldwiki.linux-vserver.org old wiki] to find the information not migrated yet.<br />
<br />
'''To ease migration we created a [[List of old Documentation pages]].'''<br />
</div><br />
<br />
== Introduction ==<br />
<br />
* [[Overview|Virtualization Overview]]<br />
* [[Usage Scenarios]]<br />
* [[Feature Matrix]]<br />
<br />
== Installation ==<br />
<br />
* [[Installation Considerations]]<br />
* [[Installation on Linux 2.6]]: from source, both the kernel and util-vserver<br />
* [[Installation on ArchLinux]]<br />
* [[Installation on CentOS]]<br />
* [[Installation on Debian]]<br />
* [[Installation on Fedora]]<br />
* [[Installation on Gentoo]]<br />
* [[Installation on Mandrake]]<br />
* [http://www.pld-linux.org/Docs/Vserver Installation on PLD-Linux]<br />
* [[Installation on Redhat]]<br />
* [[Installation on Slackware]]<br />
* [[Installation on Slackware 14]]<br />
* [[Installation on SuSE/OpenSUSE]]<br />
* [[Installation on Ubuntu]]<br />
<br />
== Configuration ==<br />
<br />
* [[Util-vserver:Documentation|util-vserver Documentation]]<br />
* [[vcd:Documentation|VServer Control Daemon Documentation]]<br />
* [[Share a directory among multiple guests]]<br />
* [[Standard_non-shared_quota]]<br />
<br />
== Guides and Howtos ==<br />
<br />
* [[Building Guest Systems]]<br />
* [[util-vserver:Howto virtualize an exisiting Linux server|Howto virtualize an existing Linux server]]<br />
* [[VCMD HowTo]]<br />
* [[Howto make bsd-style init sysv-compatible|Howto make Bsd-style init sysv-compatible (archlinux guest system)]]<br />
* [[Installing 32-bit Fedora on 64-bit Debian]]<br />
* [[Installing Ubuntu on Debian]]<br />
* [[Installing an openSUSE vserver guest]]<br />
* [[Networking vserver guests]]<br />
* [[Howto HostAuth]]<br />
* [[Fuse_GlusterFS| Fuse and GlusterFS]]<br />
* [[yum-patch|How to patch vyum]]<br />
* [[yum-upgrade-3.2.4|Upgrading existing installations to yum-3.2.4]]<br />
* [[Migrating from OpenVZ to Linux-Vserver]]<br />
* [[Getting_high_with_lenny]]<br />
* [[Installing_Ubuntu_8.04_Hardy_as_guest]]<br />
* [[Applying CPU Limits]]<br />
* [[Upgrading from Etch to Lenny]]<br />
* [[Upstart issues]]<br />
* [[Limit Networking on Multihomed hosts]]<br />
* [[Read-only_RootFS]]<br />
* [[Building_CentOS_6_Guest]]<br />
* [[Building_CentOS_6_ALT_Guest]]<br />
<br />
== Lists &amp; Theory ==<br />
<br />
* Basic configuration<br />
** [[Capabilities and Flags]]<br />
** [[CPU Scheduler]]<br />
** [[Disk Limits and Quota]]<br />
** [[Resource Limits]]<br />
*** [[Memory Limits]]<br />
*** [[Network Bandwidth Management]]<br />
** [[Virtual System Information]]<br />
** [[Unification]]<br />
<br />
* Security Considerations<br />
** [[Secure Capabilities]]<br />
** [[Secure chroot Barrier]]<br />
** [[Secure Device Nodes]]<br />
** [[Secure ProcFS Entries]]<br />
<br />
* Performance and Stability<br />
** [[Virtualization Overhead]]<br />
<br />
* Implementation Details<br />
** [[Context Accounting]]<br />
** [[Filesystem Attributes]]<br />
** [[Filesystem Tagging]]<br />
** [[Filesystem Namespaces]]<br />
** [[Kernel Userspace Helper]]<br />
** [[Mainline Kernel Virtualization]]<br />
** [[ProcFS]]<br />
** [[Syscall Command Switch]]<br />
<br />
== External Resources ==<br />
<br />
* [http://vserver.13thfloor.at/Remote-Reset/ Simple Remote reset] (remote reset/power your vserver box)<br />
* [http://vserver.13thfloor.at/Null-Modem/ NullModem cables] [http://www.loop-back.com/null-mod.html II] [http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/serial-pc-terminal.html III] (cable required for serial console)<br />
* [http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/index.html Serial Console HOWTO]<br />
<br />
[[Category:Documentation| ]]<br />
[[Category:Community]]</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Documentation
Documentation
2014-01-05T18:47:50Z
<p>Roberto.puzzanghera: /* Installation */</p>
<hr />
<div><div style="margin: 2em auto 2em auto; padding: 10px; background-color: #F9ECCD; border: 1px solid #004433; text-align: center;"><br />
[[Image:Icon-Caution.png|left]]<br />
We are currently migrating to MediaWiki from our old system, but not all content has been migrated yet. Take a look at the [[Wiki Team]] page for instructions how to help or look at the [http://oldwiki.linux-vserver.org old wiki] to find the information not migrated yet.<br />
<br />
'''To ease migration we created a [[List of old Documentation pages]].'''<br />
</div><br />
<br />
== Introduction ==<br />
<br />
* [[Overview|Virtualization Overview]]<br />
* [[Usage Scenarios]]<br />
* [[Feature Matrix]]<br />
<br />
== Installation ==<br />
<br />
* [[Installation Considerations]]<br />
* [[Installation on Linux 2.6]]: from source, both the kernel and util-vserver<br />
* [[Installation on ArchLinux]]<br />
* [[Installation on CentOS]]<br />
* [[Installation on Debian]]<br />
* [[Installation on Fedora]]<br />
* [[Installation on Gentoo]]<br />
* [[Installation on Mandrake]]<br />
* [http://www.pld-linux.org/Docs/Vserver Installation on PLD-Linux]<br />
* [[Installation on Redhat]]<br />
* [[Installation on Slackware]]<br />
* [[Installation on Slackware 14.1]]<br />
* [[Installation on SuSE/OpenSUSE]]<br />
* [[Installation on Ubuntu]]<br />
<br />
== Configuration ==<br />
<br />
* [[Util-vserver:Documentation|util-vserver Documentation]]<br />
* [[vcd:Documentation|VServer Control Daemon Documentation]]<br />
* [[Share a directory among multiple guests]]<br />
* [[Standard_non-shared_quota]]<br />
<br />
== Guides and Howtos ==<br />
<br />
* [[Building Guest Systems]]<br />
* [[util-vserver:Howto virtualize an exisiting Linux server|Howto virtualize an existing Linux server]]<br />
* [[VCMD HowTo]]<br />
* [[Howto make bsd-style init sysv-compatible|Howto make Bsd-style init sysv-compatible (archlinux guest system)]]<br />
* [[Installing 32-bit Fedora on 64-bit Debian]]<br />
* [[Installing Ubuntu on Debian]]<br />
* [[Installing an openSUSE vserver guest]]<br />
* [[Networking vserver guests]]<br />
* [[Howto HostAuth]]<br />
* [[Fuse_GlusterFS| Fuse and GlusterFS]]<br />
* [[yum-patch|How to patch vyum]]<br />
* [[yum-upgrade-3.2.4|Upgrading existing installations to yum-3.2.4]]<br />
* [[Migrating from OpenVZ to Linux-Vserver]]<br />
* [[Getting_high_with_lenny]]<br />
* [[Installing_Ubuntu_8.04_Hardy_as_guest]]<br />
* [[Applying CPU Limits]]<br />
* [[Upgrading from Etch to Lenny]]<br />
* [[Upstart issues]]<br />
* [[Limit Networking on Multihomed hosts]]<br />
* [[Read-only_RootFS]]<br />
* [[Building_CentOS_6_Guest]]<br />
* [[Building_CentOS_6_ALT_Guest]]<br />
<br />
== Lists &amp; Theory ==<br />
<br />
* Basic configuration<br />
** [[Capabilities and Flags]]<br />
** [[CPU Scheduler]]<br />
** [[Disk Limits and Quota]]<br />
** [[Resource Limits]]<br />
*** [[Memory Limits]]<br />
*** [[Network Bandwidth Management]]<br />
** [[Virtual System Information]]<br />
** [[Unification]]<br />
<br />
* Security Considerations<br />
** [[Secure Capabilities]]<br />
** [[Secure chroot Barrier]]<br />
** [[Secure Device Nodes]]<br />
** [[Secure ProcFS Entries]]<br />
<br />
* Performance and Stability<br />
** [[Virtualization Overhead]]<br />
<br />
* Implementation Details<br />
** [[Context Accounting]]<br />
** [[Filesystem Attributes]]<br />
** [[Filesystem Tagging]]<br />
** [[Filesystem Namespaces]]<br />
** [[Kernel Userspace Helper]]<br />
** [[Mainline Kernel Virtualization]]<br />
** [[ProcFS]]<br />
** [[Syscall Command Switch]]<br />
<br />
== External Resources ==<br />
<br />
* [http://vserver.13thfloor.at/Remote-Reset/ Simple Remote reset] (remote reset/power your vserver box)<br />
* [http://vserver.13thfloor.at/Null-Modem/ NullModem cables] [http://www.loop-back.com/null-mod.html II] [http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/serial-pc-terminal.html III] (cable required for serial console)<br />
* [http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/index.html Serial Console HOWTO]<br />
<br />
[[Category:Documentation| ]]<br />
[[Category:Community]]</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2014-01-05T18:28:40Z
<p>Roberto.puzzanghera: /* Make the guest */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info at http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.0.rej rc.d/rc.0.rej<br />
--- rc.d-original/rc.0.rej 1970-01-01 01:00:00.000000000 +0100<br />
+++ rc.d/rc.0.rej 2013-12-29 12:13:33.000000000 +0100<br />
@@ -0,0 +1,194 @@<br />
+--- rc.0 2013-09-23 01:43:20.000000000 +0200<br />
++++ rc.0 2013-11-08 22:15:10.000000000 +0100<br />
+@@ -37,22 +37,6 @@<br />
+ ;;<br />
+ esac<br />
+ <br />
+-# Save the system time to the hardware clock using hwclock --systohc.<br />
+-if [ -x /sbin/hwclock ]; then<br />
+- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
+- # unknown) to prevent hwclock causing a hang:<br />
+- if ! grep -q -w rtc /proc/ioports ; then<br />
+- CLOCK_OPT="--directisa"<br />
+- fi<br />
+- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
+- echo "Saving system time to the hardware clock (UTC)."<br />
+- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
+- else<br />
+- echo "Saving system time to the hardware clock (localtime)."<br />
+- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
+- fi<br />
+-fi<br />
+-<br />
+ # Run any local shutdown scripts:<br />
+ if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
+ /etc/rc.d/rc.local_shutdown stop<br />
+@@ -98,24 +82,6 @@<br />
+ sh /etc/rc.d/rc.messagebus stop<br />
+ fi<br />
+ <br />
+-# Kill any processes (typically gam) that would otherwise prevent<br />
+-# unmounting NFS volumes:<br />
+-unset FUSER_DELAY<br />
+-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
+- echo "Killing processes holding NFS mount $dir open..."<br />
+- # Background this to prevent fuser from also blocking shutdown:<br />
+- /usr/bin/fuser -k -m $dir &<br />
+- FUSER_DELAY=5<br />
+-done<br />
+-# If fuser was run, let it have some delay:<br />
+-if [ ! -z "$FUSER_DELAY" ]; then<br />
+- sleep $FUSER_DELAY<br />
+-fi<br />
+-<br />
+-# Unmount any NFS, SMB, or CIFS filesystems:<br />
+-echo "Unmounting remote filesystems."<br />
+-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
+-<br />
+ # Try to shut down pppd:<br />
+ PS="$(ps ax)"<br />
+ if echo "$PS" | /bin/grep -q -w pppd ; then<br />
+@@ -131,45 +97,11 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Bring down the networking system, but first make sure that this<br />
+-# isn't a diskless client with the / partition mounted via NFS:<br />
+-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
+- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
+- . /etc/rc.d/rc.inet1 stop<br />
+- fi<br />
+-fi<br />
+-<br />
+-# In case dhcpcd might have been manually started on the command line,<br />
+-# look for the .pid file, and shut dhcpcd down if it's found:<br />
+-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
+- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
+- # A little time for /etc/resolv.conf and/or other files to<br />
+- # restore themselves.<br />
+- sleep 2<br />
+-fi<br />
+-<br />
+-# Shut down PCMCIA devices:<br />
+-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
+- . /etc/rc.d/rc.pcmcia stop<br />
+- # The cards might need a little extra time here to deactivate:<br />
+- /bin/sleep 5<br />
+-fi<br />
+-<br />
+ # Turn off process accounting:<br />
+ if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
+ /sbin/accton off<br />
+ fi<br />
+ <br />
+-# Terminate acpid before syslog:<br />
+-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
+- . /etc/rc.d/rc.acpid stop<br />
+-fi<br />
+-<br />
+-# Stop udev:<br />
+-if [ -x /etc/rc.d/rc.udev ]; then<br />
+- sh /etc/rc.d/rc.udev force-stop<br />
+-fi<br />
+-<br />
+ # Kill all remaining processes.<br />
+ if [ ! "$1" = "fast" ]; then<br />
+ echo "Sending all processes the SIGTERM signal."<br />
+@@ -187,16 +119,6 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Carry a random seed between reboots.<br />
+-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
+-# Use the pool size from /proc, or 4096 bits:<br />
+-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
+-else<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
+-fi<br />
+-/bin/chmod 600 /etc/random-seed<br />
+-<br />
+ # Before unmounting file systems write a reboot or halt record to wtmp.<br />
+ $command -w<br />
+ <br />
+@@ -205,80 +127,5 @@<br />
+ rm -f /var/lock/subsys/*<br />
+ fi<br />
+ <br />
+-# Turn off swap:<br />
+-echo "Turning off swap."<br />
+-/sbin/swapoff -a<br />
+-/bin/sync<br />
+-<br />
+-echo "Unmounting local file systems."<br />
+-/bin/umount -v -a -t no,proc,sysfs<br />
+-<br />
+-echo "Remounting root filesystem read-only."<br />
+-/bin/mount -v -n -o remount,ro /<br />
+-<br />
+ # This never hurts:<br />
+ /bin/sync<br />
+-<br />
+-# Close any volumes opened by cryptsetup:<br />
+-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
+- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
+- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
+- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
+- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
+- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
+- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
+- echo "Locking LUKS crypt volume '${LUKS}':"<br />
+- /sbin/cryptsetup luksClose ${LUKS}<br />
+- elif echo $OPTS | grep -wq swap ; then<br />
+- # If any of the volumes was used as encrypted swap,<br />
+- # then run mkswap on the underlying device -<br />
+- # in case other Linux installations on this computer should use it:<br />
+- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
+- /sbin/cryptsetup remove ${LUKS}<br />
+- mkswap $DEV<br />
+- fi<br />
+- done<br />
+-fi<br />
+-<br />
+-# Deactivate LVM volume groups:<br />
+-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
+- echo "Deactivating LVM volume groups:"<br />
+- /sbin/vgchange -an --ignorelockingfailure<br />
+-fi<br />
+-<br />
+-# This never hurts again (especially since root-on-LVM always fails<br />
+-# to deactivate the / logical volume... but at least it was<br />
+-# remounted as read-only first)<br />
+-/bin/sync<br />
+-<br />
+-# sleep 3 fixes problems with some hard drives that don't<br />
+-# otherwise finish syncing before reboot or poweroff<br />
+-/bin/sleep 3<br />
+-<br />
+-# This is to ensure all processes have completed on SMP machines:<br />
+-wait<br />
+-<br />
+-if [ -x /sbin/genpowerd ]; then<br />
+- # See if this is a powerfail situation:<br />
+- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
+- # Signal UPS to shut off the inverter:<br />
+- /sbin/genpowerd -k<br />
+- if [ ! $? = 0 ]; then<br />
+- echo<br />
+- echo "There was an error signaling the UPS."<br />
+- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
+- echo "the serial line and UPS type."<br />
+- # Wasting 15 seconds of precious power:<br />
+- /bin/sleep 15<br />
+- fi<br />
+- fi<br />
+-fi<br />
+-<br />
+-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
+-if [ "$command" = "reboot" ]; then<br />
+- echo "Rebooting."<br />
+- /sbin/reboot<br />
+-else<br />
+- /sbin/poweroff<br />
+-fi<br />
+-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2014-01-05T18:24:59Z
<p>Roberto.puzzanghera: /* Contact */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.0.rej rc.d/rc.0.rej<br />
--- rc.d-original/rc.0.rej 1970-01-01 01:00:00.000000000 +0100<br />
+++ rc.d/rc.0.rej 2013-12-29 12:13:33.000000000 +0100<br />
@@ -0,0 +1,194 @@<br />
+--- rc.0 2013-09-23 01:43:20.000000000 +0200<br />
++++ rc.0 2013-11-08 22:15:10.000000000 +0100<br />
+@@ -37,22 +37,6 @@<br />
+ ;;<br />
+ esac<br />
+ <br />
+-# Save the system time to the hardware clock using hwclock --systohc.<br />
+-if [ -x /sbin/hwclock ]; then<br />
+- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
+- # unknown) to prevent hwclock causing a hang:<br />
+- if ! grep -q -w rtc /proc/ioports ; then<br />
+- CLOCK_OPT="--directisa"<br />
+- fi<br />
+- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
+- echo "Saving system time to the hardware clock (UTC)."<br />
+- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
+- else<br />
+- echo "Saving system time to the hardware clock (localtime)."<br />
+- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
+- fi<br />
+-fi<br />
+-<br />
+ # Run any local shutdown scripts:<br />
+ if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
+ /etc/rc.d/rc.local_shutdown stop<br />
+@@ -98,24 +82,6 @@<br />
+ sh /etc/rc.d/rc.messagebus stop<br />
+ fi<br />
+ <br />
+-# Kill any processes (typically gam) that would otherwise prevent<br />
+-# unmounting NFS volumes:<br />
+-unset FUSER_DELAY<br />
+-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
+- echo "Killing processes holding NFS mount $dir open..."<br />
+- # Background this to prevent fuser from also blocking shutdown:<br />
+- /usr/bin/fuser -k -m $dir &<br />
+- FUSER_DELAY=5<br />
+-done<br />
+-# If fuser was run, let it have some delay:<br />
+-if [ ! -z "$FUSER_DELAY" ]; then<br />
+- sleep $FUSER_DELAY<br />
+-fi<br />
+-<br />
+-# Unmount any NFS, SMB, or CIFS filesystems:<br />
+-echo "Unmounting remote filesystems."<br />
+-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
+-<br />
+ # Try to shut down pppd:<br />
+ PS="$(ps ax)"<br />
+ if echo "$PS" | /bin/grep -q -w pppd ; then<br />
+@@ -131,45 +97,11 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Bring down the networking system, but first make sure that this<br />
+-# isn't a diskless client with the / partition mounted via NFS:<br />
+-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
+- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
+- . /etc/rc.d/rc.inet1 stop<br />
+- fi<br />
+-fi<br />
+-<br />
+-# In case dhcpcd might have been manually started on the command line,<br />
+-# look for the .pid file, and shut dhcpcd down if it's found:<br />
+-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
+- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
+- # A little time for /etc/resolv.conf and/or other files to<br />
+- # restore themselves.<br />
+- sleep 2<br />
+-fi<br />
+-<br />
+-# Shut down PCMCIA devices:<br />
+-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
+- . /etc/rc.d/rc.pcmcia stop<br />
+- # The cards might need a little extra time here to deactivate:<br />
+- /bin/sleep 5<br />
+-fi<br />
+-<br />
+ # Turn off process accounting:<br />
+ if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
+ /sbin/accton off<br />
+ fi<br />
+ <br />
+-# Terminate acpid before syslog:<br />
+-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
+- . /etc/rc.d/rc.acpid stop<br />
+-fi<br />
+-<br />
+-# Stop udev:<br />
+-if [ -x /etc/rc.d/rc.udev ]; then<br />
+- sh /etc/rc.d/rc.udev force-stop<br />
+-fi<br />
+-<br />
+ # Kill all remaining processes.<br />
+ if [ ! "$1" = "fast" ]; then<br />
+ echo "Sending all processes the SIGTERM signal."<br />
+@@ -187,16 +119,6 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Carry a random seed between reboots.<br />
+-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
+-# Use the pool size from /proc, or 4096 bits:<br />
+-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
+-else<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
+-fi<br />
+-/bin/chmod 600 /etc/random-seed<br />
+-<br />
+ # Before unmounting file systems write a reboot or halt record to wtmp.<br />
+ $command -w<br />
+ <br />
+@@ -205,80 +127,5 @@<br />
+ rm -f /var/lock/subsys/*<br />
+ fi<br />
+ <br />
+-# Turn off swap:<br />
+-echo "Turning off swap."<br />
+-/sbin/swapoff -a<br />
+-/bin/sync<br />
+-<br />
+-echo "Unmounting local file systems."<br />
+-/bin/umount -v -a -t no,proc,sysfs<br />
+-<br />
+-echo "Remounting root filesystem read-only."<br />
+-/bin/mount -v -n -o remount,ro /<br />
+-<br />
+ # This never hurts:<br />
+ /bin/sync<br />
+-<br />
+-# Close any volumes opened by cryptsetup:<br />
+-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
+- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
+- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
+- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
+- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
+- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
+- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
+- echo "Locking LUKS crypt volume '${LUKS}':"<br />
+- /sbin/cryptsetup luksClose ${LUKS}<br />
+- elif echo $OPTS | grep -wq swap ; then<br />
+- # If any of the volumes was used as encrypted swap,<br />
+- # then run mkswap on the underlying device -<br />
+- # in case other Linux installations on this computer should use it:<br />
+- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
+- /sbin/cryptsetup remove ${LUKS}<br />
+- mkswap $DEV<br />
+- fi<br />
+- done<br />
+-fi<br />
+-<br />
+-# Deactivate LVM volume groups:<br />
+-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
+- echo "Deactivating LVM volume groups:"<br />
+- /sbin/vgchange -an --ignorelockingfailure<br />
+-fi<br />
+-<br />
+-# This never hurts again (especially since root-on-LVM always fails<br />
+-# to deactivate the / logical volume... but at least it was<br />
+-# remounted as read-only first)<br />
+-/bin/sync<br />
+-<br />
+-# sleep 3 fixes problems with some hard drives that don't<br />
+-# otherwise finish syncing before reboot or poweroff<br />
+-/bin/sleep 3<br />
+-<br />
+-# This is to ensure all processes have completed on SMP machines:<br />
+-wait<br />
+-<br />
+-if [ -x /sbin/genpowerd ]; then<br />
+- # See if this is a powerfail situation:<br />
+- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
+- # Signal UPS to shut off the inverter:<br />
+- /sbin/genpowerd -k<br />
+- if [ ! $? = 0 ]; then<br />
+- echo<br />
+- echo "There was an error signaling the UPS."<br />
+- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
+- echo "the serial line and UPS type."<br />
+- # Wasting 15 seconds of precious power:<br />
+- /bin/sleep 15<br />
+- fi<br />
+- fi<br />
+-fi<br />
+-<br />
+-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
+-if [ "$command" = "reboot" ]; then<br />
+- echo "Rebooting."<br />
+- /sbin/reboot<br />
+-else<br />
+- /sbin/poweroff<br />
+-fi<br />
+-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://notes.sagredo.eu/node/7)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2014-01-05T18:23:43Z
<p>Roberto.puzzanghera: /* Apply the patch */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 14.0, 13.37 and 13.1, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.0.rej rc.d/rc.0.rej<br />
--- rc.d-original/rc.0.rej 1970-01-01 01:00:00.000000000 +0100<br />
+++ rc.d/rc.0.rej 2013-12-29 12:13:33.000000000 +0100<br />
@@ -0,0 +1,194 @@<br />
+--- rc.0 2013-09-23 01:43:20.000000000 +0200<br />
++++ rc.0 2013-11-08 22:15:10.000000000 +0100<br />
+@@ -37,22 +37,6 @@<br />
+ ;;<br />
+ esac<br />
+ <br />
+-# Save the system time to the hardware clock using hwclock --systohc.<br />
+-if [ -x /sbin/hwclock ]; then<br />
+- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
+- # unknown) to prevent hwclock causing a hang:<br />
+- if ! grep -q -w rtc /proc/ioports ; then<br />
+- CLOCK_OPT="--directisa"<br />
+- fi<br />
+- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
+- echo "Saving system time to the hardware clock (UTC)."<br />
+- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
+- else<br />
+- echo "Saving system time to the hardware clock (localtime)."<br />
+- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
+- fi<br />
+-fi<br />
+-<br />
+ # Run any local shutdown scripts:<br />
+ if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
+ /etc/rc.d/rc.local_shutdown stop<br />
+@@ -98,24 +82,6 @@<br />
+ sh /etc/rc.d/rc.messagebus stop<br />
+ fi<br />
+ <br />
+-# Kill any processes (typically gam) that would otherwise prevent<br />
+-# unmounting NFS volumes:<br />
+-unset FUSER_DELAY<br />
+-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
+- echo "Killing processes holding NFS mount $dir open..."<br />
+- # Background this to prevent fuser from also blocking shutdown:<br />
+- /usr/bin/fuser -k -m $dir &<br />
+- FUSER_DELAY=5<br />
+-done<br />
+-# If fuser was run, let it have some delay:<br />
+-if [ ! -z "$FUSER_DELAY" ]; then<br />
+- sleep $FUSER_DELAY<br />
+-fi<br />
+-<br />
+-# Unmount any NFS, SMB, or CIFS filesystems:<br />
+-echo "Unmounting remote filesystems."<br />
+-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
+-<br />
+ # Try to shut down pppd:<br />
+ PS="$(ps ax)"<br />
+ if echo "$PS" | /bin/grep -q -w pppd ; then<br />
+@@ -131,45 +97,11 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Bring down the networking system, but first make sure that this<br />
+-# isn't a diskless client with the / partition mounted via NFS:<br />
+-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
+- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
+- . /etc/rc.d/rc.inet1 stop<br />
+- fi<br />
+-fi<br />
+-<br />
+-# In case dhcpcd might have been manually started on the command line,<br />
+-# look for the .pid file, and shut dhcpcd down if it's found:<br />
+-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
+- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
+- # A little time for /etc/resolv.conf and/or other files to<br />
+- # restore themselves.<br />
+- sleep 2<br />
+-fi<br />
+-<br />
+-# Shut down PCMCIA devices:<br />
+-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
+- . /etc/rc.d/rc.pcmcia stop<br />
+- # The cards might need a little extra time here to deactivate:<br />
+- /bin/sleep 5<br />
+-fi<br />
+-<br />
+ # Turn off process accounting:<br />
+ if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
+ /sbin/accton off<br />
+ fi<br />
+ <br />
+-# Terminate acpid before syslog:<br />
+-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
+- . /etc/rc.d/rc.acpid stop<br />
+-fi<br />
+-<br />
+-# Stop udev:<br />
+-if [ -x /etc/rc.d/rc.udev ]; then<br />
+- sh /etc/rc.d/rc.udev force-stop<br />
+-fi<br />
+-<br />
+ # Kill all remaining processes.<br />
+ if [ ! "$1" = "fast" ]; then<br />
+ echo "Sending all processes the SIGTERM signal."<br />
+@@ -187,16 +119,6 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Carry a random seed between reboots.<br />
+-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
+-# Use the pool size from /proc, or 4096 bits:<br />
+-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
+-else<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
+-fi<br />
+-/bin/chmod 600 /etc/random-seed<br />
+-<br />
+ # Before unmounting file systems write a reboot or halt record to wtmp.<br />
+ $command -w<br />
+ <br />
+@@ -205,80 +127,5 @@<br />
+ rm -f /var/lock/subsys/*<br />
+ fi<br />
+ <br />
+-# Turn off swap:<br />
+-echo "Turning off swap."<br />
+-/sbin/swapoff -a<br />
+-/bin/sync<br />
+-<br />
+-echo "Unmounting local file systems."<br />
+-/bin/umount -v -a -t no,proc,sysfs<br />
+-<br />
+-echo "Remounting root filesystem read-only."<br />
+-/bin/mount -v -n -o remount,ro /<br />
+-<br />
+ # This never hurts:<br />
+ /bin/sync<br />
+-<br />
+-# Close any volumes opened by cryptsetup:<br />
+-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
+- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
+- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
+- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
+- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
+- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
+- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
+- echo "Locking LUKS crypt volume '${LUKS}':"<br />
+- /sbin/cryptsetup luksClose ${LUKS}<br />
+- elif echo $OPTS | grep -wq swap ; then<br />
+- # If any of the volumes was used as encrypted swap,<br />
+- # then run mkswap on the underlying device -<br />
+- # in case other Linux installations on this computer should use it:<br />
+- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
+- /sbin/cryptsetup remove ${LUKS}<br />
+- mkswap $DEV<br />
+- fi<br />
+- done<br />
+-fi<br />
+-<br />
+-# Deactivate LVM volume groups:<br />
+-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
+- echo "Deactivating LVM volume groups:"<br />
+- /sbin/vgchange -an --ignorelockingfailure<br />
+-fi<br />
+-<br />
+-# This never hurts again (especially since root-on-LVM always fails<br />
+-# to deactivate the / logical volume... but at least it was<br />
+-# remounted as read-only first)<br />
+-/bin/sync<br />
+-<br />
+-# sleep 3 fixes problems with some hard drives that don't<br />
+-# otherwise finish syncing before reboot or poweroff<br />
+-/bin/sleep 3<br />
+-<br />
+-# This is to ensure all processes have completed on SMP machines:<br />
+-wait<br />
+-<br />
+-if [ -x /sbin/genpowerd ]; then<br />
+- # See if this is a powerfail situation:<br />
+- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
+- # Signal UPS to shut off the inverter:<br />
+- /sbin/genpowerd -k<br />
+- if [ ! $? = 0 ]; then<br />
+- echo<br />
+- echo "There was an error signaling the UPS."<br />
+- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
+- echo "the serial line and UPS type."<br />
+- # Wasting 15 seconds of precious power:<br />
+- /bin/sleep 15<br />
+- fi<br />
+- fi<br />
+-fi<br />
+-<br />
+-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
+-if [ "$command" = "reboot" ]; then<br />
+- echo "Rebooting."<br />
+- /sbin/reboot<br />
+-else<br />
+- /sbin/poweroff<br />
+-fi<br />
+-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2014-01-05T18:23:10Z
<p>Roberto.puzzanghera: /* Apply the patch */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.1.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.0.rej rc.d/rc.0.rej<br />
--- rc.d-original/rc.0.rej 1970-01-01 01:00:00.000000000 +0100<br />
+++ rc.d/rc.0.rej 2013-12-29 12:13:33.000000000 +0100<br />
@@ -0,0 +1,194 @@<br />
+--- rc.0 2013-09-23 01:43:20.000000000 +0200<br />
++++ rc.0 2013-11-08 22:15:10.000000000 +0100<br />
+@@ -37,22 +37,6 @@<br />
+ ;;<br />
+ esac<br />
+ <br />
+-# Save the system time to the hardware clock using hwclock --systohc.<br />
+-if [ -x /sbin/hwclock ]; then<br />
+- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
+- # unknown) to prevent hwclock causing a hang:<br />
+- if ! grep -q -w rtc /proc/ioports ; then<br />
+- CLOCK_OPT="--directisa"<br />
+- fi<br />
+- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
+- echo "Saving system time to the hardware clock (UTC)."<br />
+- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
+- else<br />
+- echo "Saving system time to the hardware clock (localtime)."<br />
+- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
+- fi<br />
+-fi<br />
+-<br />
+ # Run any local shutdown scripts:<br />
+ if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
+ /etc/rc.d/rc.local_shutdown stop<br />
+@@ -98,24 +82,6 @@<br />
+ sh /etc/rc.d/rc.messagebus stop<br />
+ fi<br />
+ <br />
+-# Kill any processes (typically gam) that would otherwise prevent<br />
+-# unmounting NFS volumes:<br />
+-unset FUSER_DELAY<br />
+-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
+- echo "Killing processes holding NFS mount $dir open..."<br />
+- # Background this to prevent fuser from also blocking shutdown:<br />
+- /usr/bin/fuser -k -m $dir &<br />
+- FUSER_DELAY=5<br />
+-done<br />
+-# If fuser was run, let it have some delay:<br />
+-if [ ! -z "$FUSER_DELAY" ]; then<br />
+- sleep $FUSER_DELAY<br />
+-fi<br />
+-<br />
+-# Unmount any NFS, SMB, or CIFS filesystems:<br />
+-echo "Unmounting remote filesystems."<br />
+-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
+-<br />
+ # Try to shut down pppd:<br />
+ PS="$(ps ax)"<br />
+ if echo "$PS" | /bin/grep -q -w pppd ; then<br />
+@@ -131,45 +97,11 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Bring down the networking system, but first make sure that this<br />
+-# isn't a diskless client with the / partition mounted via NFS:<br />
+-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
+- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
+- . /etc/rc.d/rc.inet1 stop<br />
+- fi<br />
+-fi<br />
+-<br />
+-# In case dhcpcd might have been manually started on the command line,<br />
+-# look for the .pid file, and shut dhcpcd down if it's found:<br />
+-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
+- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
+- # A little time for /etc/resolv.conf and/or other files to<br />
+- # restore themselves.<br />
+- sleep 2<br />
+-fi<br />
+-<br />
+-# Shut down PCMCIA devices:<br />
+-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
+- . /etc/rc.d/rc.pcmcia stop<br />
+- # The cards might need a little extra time here to deactivate:<br />
+- /bin/sleep 5<br />
+-fi<br />
+-<br />
+ # Turn off process accounting:<br />
+ if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
+ /sbin/accton off<br />
+ fi<br />
+ <br />
+-# Terminate acpid before syslog:<br />
+-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
+- . /etc/rc.d/rc.acpid stop<br />
+-fi<br />
+-<br />
+-# Stop udev:<br />
+-if [ -x /etc/rc.d/rc.udev ]; then<br />
+- sh /etc/rc.d/rc.udev force-stop<br />
+-fi<br />
+-<br />
+ # Kill all remaining processes.<br />
+ if [ ! "$1" = "fast" ]; then<br />
+ echo "Sending all processes the SIGTERM signal."<br />
+@@ -187,16 +119,6 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Carry a random seed between reboots.<br />
+-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
+-# Use the pool size from /proc, or 4096 bits:<br />
+-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
+-else<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
+-fi<br />
+-/bin/chmod 600 /etc/random-seed<br />
+-<br />
+ # Before unmounting file systems write a reboot or halt record to wtmp.<br />
+ $command -w<br />
+ <br />
+@@ -205,80 +127,5 @@<br />
+ rm -f /var/lock/subsys/*<br />
+ fi<br />
+ <br />
+-# Turn off swap:<br />
+-echo "Turning off swap."<br />
+-/sbin/swapoff -a<br />
+-/bin/sync<br />
+-<br />
+-echo "Unmounting local file systems."<br />
+-/bin/umount -v -a -t no,proc,sysfs<br />
+-<br />
+-echo "Remounting root filesystem read-only."<br />
+-/bin/mount -v -n -o remount,ro /<br />
+-<br />
+ # This never hurts:<br />
+ /bin/sync<br />
+-<br />
+-# Close any volumes opened by cryptsetup:<br />
+-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
+- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
+- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
+- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
+- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
+- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
+- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
+- echo "Locking LUKS crypt volume '${LUKS}':"<br />
+- /sbin/cryptsetup luksClose ${LUKS}<br />
+- elif echo $OPTS | grep -wq swap ; then<br />
+- # If any of the volumes was used as encrypted swap,<br />
+- # then run mkswap on the underlying device -<br />
+- # in case other Linux installations on this computer should use it:<br />
+- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
+- /sbin/cryptsetup remove ${LUKS}<br />
+- mkswap $DEV<br />
+- fi<br />
+- done<br />
+-fi<br />
+-<br />
+-# Deactivate LVM volume groups:<br />
+-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
+- echo "Deactivating LVM volume groups:"<br />
+- /sbin/vgchange -an --ignorelockingfailure<br />
+-fi<br />
+-<br />
+-# This never hurts again (especially since root-on-LVM always fails<br />
+-# to deactivate the / logical volume... but at least it was<br />
+-# remounted as read-only first)<br />
+-/bin/sync<br />
+-<br />
+-# sleep 3 fixes problems with some hard drives that don't<br />
+-# otherwise finish syncing before reboot or poweroff<br />
+-/bin/sleep 3<br />
+-<br />
+-# This is to ensure all processes have completed on SMP machines:<br />
+-wait<br />
+-<br />
+-if [ -x /sbin/genpowerd ]; then<br />
+- # See if this is a powerfail situation:<br />
+- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
+- # Signal UPS to shut off the inverter:<br />
+- /sbin/genpowerd -k<br />
+- if [ ! $? = 0 ]; then<br />
+- echo<br />
+- echo "There was an error signaling the UPS."<br />
+- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
+- echo "the serial line and UPS type."<br />
+- # Wasting 15 seconds of precious power:<br />
+- /bin/sleep 15<br />
+- fi<br />
+- fi<br />
+-fi<br />
+-<br />
+-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
+-if [ "$command" = "reboot" ]; then<br />
+- echo "Rebooting."<br />
+- /sbin/reboot<br />
+-else<br />
+- /sbin/poweroff<br />
+-fi<br />
+-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2014-01-05T18:22:15Z
<p>Roberto.puzzanghera: </p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.0.rej rc.d/rc.0.rej<br />
--- rc.d-original/rc.0.rej 1970-01-01 01:00:00.000000000 +0100<br />
+++ rc.d/rc.0.rej 2013-12-29 12:13:33.000000000 +0100<br />
@@ -0,0 +1,194 @@<br />
+--- rc.0 2013-09-23 01:43:20.000000000 +0200<br />
++++ rc.0 2013-11-08 22:15:10.000000000 +0100<br />
+@@ -37,22 +37,6 @@<br />
+ ;;<br />
+ esac<br />
+ <br />
+-# Save the system time to the hardware clock using hwclock --systohc.<br />
+-if [ -x /sbin/hwclock ]; then<br />
+- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
+- # unknown) to prevent hwclock causing a hang:<br />
+- if ! grep -q -w rtc /proc/ioports ; then<br />
+- CLOCK_OPT="--directisa"<br />
+- fi<br />
+- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
+- echo "Saving system time to the hardware clock (UTC)."<br />
+- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
+- else<br />
+- echo "Saving system time to the hardware clock (localtime)."<br />
+- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
+- fi<br />
+-fi<br />
+-<br />
+ # Run any local shutdown scripts:<br />
+ if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
+ /etc/rc.d/rc.local_shutdown stop<br />
+@@ -98,24 +82,6 @@<br />
+ sh /etc/rc.d/rc.messagebus stop<br />
+ fi<br />
+ <br />
+-# Kill any processes (typically gam) that would otherwise prevent<br />
+-# unmounting NFS volumes:<br />
+-unset FUSER_DELAY<br />
+-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
+- echo "Killing processes holding NFS mount $dir open..."<br />
+- # Background this to prevent fuser from also blocking shutdown:<br />
+- /usr/bin/fuser -k -m $dir &<br />
+- FUSER_DELAY=5<br />
+-done<br />
+-# If fuser was run, let it have some delay:<br />
+-if [ ! -z "$FUSER_DELAY" ]; then<br />
+- sleep $FUSER_DELAY<br />
+-fi<br />
+-<br />
+-# Unmount any NFS, SMB, or CIFS filesystems:<br />
+-echo "Unmounting remote filesystems."<br />
+-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
+-<br />
+ # Try to shut down pppd:<br />
+ PS="$(ps ax)"<br />
+ if echo "$PS" | /bin/grep -q -w pppd ; then<br />
+@@ -131,45 +97,11 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Bring down the networking system, but first make sure that this<br />
+-# isn't a diskless client with the / partition mounted via NFS:<br />
+-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
+- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
+- . /etc/rc.d/rc.inet1 stop<br />
+- fi<br />
+-fi<br />
+-<br />
+-# In case dhcpcd might have been manually started on the command line,<br />
+-# look for the .pid file, and shut dhcpcd down if it's found:<br />
+-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
+- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
+- # A little time for /etc/resolv.conf and/or other files to<br />
+- # restore themselves.<br />
+- sleep 2<br />
+-fi<br />
+-<br />
+-# Shut down PCMCIA devices:<br />
+-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
+- . /etc/rc.d/rc.pcmcia stop<br />
+- # The cards might need a little extra time here to deactivate:<br />
+- /bin/sleep 5<br />
+-fi<br />
+-<br />
+ # Turn off process accounting:<br />
+ if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
+ /sbin/accton off<br />
+ fi<br />
+ <br />
+-# Terminate acpid before syslog:<br />
+-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
+- . /etc/rc.d/rc.acpid stop<br />
+-fi<br />
+-<br />
+-# Stop udev:<br />
+-if [ -x /etc/rc.d/rc.udev ]; then<br />
+- sh /etc/rc.d/rc.udev force-stop<br />
+-fi<br />
+-<br />
+ # Kill all remaining processes.<br />
+ if [ ! "$1" = "fast" ]; then<br />
+ echo "Sending all processes the SIGTERM signal."<br />
+@@ -187,16 +119,6 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Carry a random seed between reboots.<br />
+-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
+-# Use the pool size from /proc, or 4096 bits:<br />
+-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
+-else<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
+-fi<br />
+-/bin/chmod 600 /etc/random-seed<br />
+-<br />
+ # Before unmounting file systems write a reboot or halt record to wtmp.<br />
+ $command -w<br />
+ <br />
+@@ -205,80 +127,5 @@<br />
+ rm -f /var/lock/subsys/*<br />
+ fi<br />
+ <br />
+-# Turn off swap:<br />
+-echo "Turning off swap."<br />
+-/sbin/swapoff -a<br />
+-/bin/sync<br />
+-<br />
+-echo "Unmounting local file systems."<br />
+-/bin/umount -v -a -t no,proc,sysfs<br />
+-<br />
+-echo "Remounting root filesystem read-only."<br />
+-/bin/mount -v -n -o remount,ro /<br />
+-<br />
+ # This never hurts:<br />
+ /bin/sync<br />
+-<br />
+-# Close any volumes opened by cryptsetup:<br />
+-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
+- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
+- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
+- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
+- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
+- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
+- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
+- echo "Locking LUKS crypt volume '${LUKS}':"<br />
+- /sbin/cryptsetup luksClose ${LUKS}<br />
+- elif echo $OPTS | grep -wq swap ; then<br />
+- # If any of the volumes was used as encrypted swap,<br />
+- # then run mkswap on the underlying device -<br />
+- # in case other Linux installations on this computer should use it:<br />
+- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
+- /sbin/cryptsetup remove ${LUKS}<br />
+- mkswap $DEV<br />
+- fi<br />
+- done<br />
+-fi<br />
+-<br />
+-# Deactivate LVM volume groups:<br />
+-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
+- echo "Deactivating LVM volume groups:"<br />
+- /sbin/vgchange -an --ignorelockingfailure<br />
+-fi<br />
+-<br />
+-# This never hurts again (especially since root-on-LVM always fails<br />
+-# to deactivate the / logical volume... but at least it was<br />
+-# remounted as read-only first)<br />
+-/bin/sync<br />
+-<br />
+-# sleep 3 fixes problems with some hard drives that don't<br />
+-# otherwise finish syncing before reboot or poweroff<br />
+-/bin/sleep 3<br />
+-<br />
+-# This is to ensure all processes have completed on SMP machines:<br />
+-wait<br />
+-<br />
+-if [ -x /sbin/genpowerd ]; then<br />
+- # See if this is a powerfail situation:<br />
+- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
+- # Signal UPS to shut off the inverter:<br />
+- /sbin/genpowerd -k<br />
+- if [ ! $? = 0 ]; then<br />
+- echo<br />
+- echo "There was an error signaling the UPS."<br />
+- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
+- echo "the serial line and UPS type."<br />
+- # Wasting 15 seconds of precious power:<br />
+- /bin/sleep 15<br />
+- fi<br />
+- fi<br />
+-fi<br />
+-<br />
+-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
+-if [ "$command" = "reboot" ]; then<br />
+- echo "Rebooting."<br />
+- /sbin/reboot<br />
+-else<br />
+- /sbin/poweroff<br />
+-fi<br />
+-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-12-29T13:34:02Z
<p>Roberto.puzzanghera: /* Patch applayed */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.12.29<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.0.rej rc.d/rc.0.rej<br />
--- rc.d-original/rc.0.rej 1970-01-01 01:00:00.000000000 +0100<br />
+++ rc.d/rc.0.rej 2013-12-29 12:13:33.000000000 +0100<br />
@@ -0,0 +1,194 @@<br />
+--- rc.0 2013-09-23 01:43:20.000000000 +0200<br />
++++ rc.0 2013-11-08 22:15:10.000000000 +0100<br />
+@@ -37,22 +37,6 @@<br />
+ ;;<br />
+ esac<br />
+ <br />
+-# Save the system time to the hardware clock using hwclock --systohc.<br />
+-if [ -x /sbin/hwclock ]; then<br />
+- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
+- # unknown) to prevent hwclock causing a hang:<br />
+- if ! grep -q -w rtc /proc/ioports ; then<br />
+- CLOCK_OPT="--directisa"<br />
+- fi<br />
+- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
+- echo "Saving system time to the hardware clock (UTC)."<br />
+- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
+- else<br />
+- echo "Saving system time to the hardware clock (localtime)."<br />
+- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
+- fi<br />
+-fi<br />
+-<br />
+ # Run any local shutdown scripts:<br />
+ if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
+ /etc/rc.d/rc.local_shutdown stop<br />
+@@ -98,24 +82,6 @@<br />
+ sh /etc/rc.d/rc.messagebus stop<br />
+ fi<br />
+ <br />
+-# Kill any processes (typically gam) that would otherwise prevent<br />
+-# unmounting NFS volumes:<br />
+-unset FUSER_DELAY<br />
+-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
+- echo "Killing processes holding NFS mount $dir open..."<br />
+- # Background this to prevent fuser from also blocking shutdown:<br />
+- /usr/bin/fuser -k -m $dir &<br />
+- FUSER_DELAY=5<br />
+-done<br />
+-# If fuser was run, let it have some delay:<br />
+-if [ ! -z "$FUSER_DELAY" ]; then<br />
+- sleep $FUSER_DELAY<br />
+-fi<br />
+-<br />
+-# Unmount any NFS, SMB, or CIFS filesystems:<br />
+-echo "Unmounting remote filesystems."<br />
+-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
+-<br />
+ # Try to shut down pppd:<br />
+ PS="$(ps ax)"<br />
+ if echo "$PS" | /bin/grep -q -w pppd ; then<br />
+@@ -131,45 +97,11 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Bring down the networking system, but first make sure that this<br />
+-# isn't a diskless client with the / partition mounted via NFS:<br />
+-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
+- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
+- . /etc/rc.d/rc.inet1 stop<br />
+- fi<br />
+-fi<br />
+-<br />
+-# In case dhcpcd might have been manually started on the command line,<br />
+-# look for the .pid file, and shut dhcpcd down if it's found:<br />
+-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
+- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
+- # A little time for /etc/resolv.conf and/or other files to<br />
+- # restore themselves.<br />
+- sleep 2<br />
+-fi<br />
+-<br />
+-# Shut down PCMCIA devices:<br />
+-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
+- . /etc/rc.d/rc.pcmcia stop<br />
+- # The cards might need a little extra time here to deactivate:<br />
+- /bin/sleep 5<br />
+-fi<br />
+-<br />
+ # Turn off process accounting:<br />
+ if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
+ /sbin/accton off<br />
+ fi<br />
+ <br />
+-# Terminate acpid before syslog:<br />
+-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
+- . /etc/rc.d/rc.acpid stop<br />
+-fi<br />
+-<br />
+-# Stop udev:<br />
+-if [ -x /etc/rc.d/rc.udev ]; then<br />
+- sh /etc/rc.d/rc.udev force-stop<br />
+-fi<br />
+-<br />
+ # Kill all remaining processes.<br />
+ if [ ! "$1" = "fast" ]; then<br />
+ echo "Sending all processes the SIGTERM signal."<br />
+@@ -187,16 +119,6 @@<br />
+ fi<br />
+ fi<br />
+ <br />
+-# Carry a random seed between reboots.<br />
+-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
+-# Use the pool size from /proc, or 4096 bits:<br />
+-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
+-else<br />
+- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
+-fi<br />
+-/bin/chmod 600 /etc/random-seed<br />
+-<br />
+ # Before unmounting file systems write a reboot or halt record to wtmp.<br />
+ $command -w<br />
+ <br />
+@@ -205,80 +127,5 @@<br />
+ rm -f /var/lock/subsys/*<br />
+ fi<br />
+ <br />
+-# Turn off swap:<br />
+-echo "Turning off swap."<br />
+-/sbin/swapoff -a<br />
+-/bin/sync<br />
+-<br />
+-echo "Unmounting local file systems."<br />
+-/bin/umount -v -a -t no,proc,sysfs<br />
+-<br />
+-echo "Remounting root filesystem read-only."<br />
+-/bin/mount -v -n -o remount,ro /<br />
+-<br />
+ # This never hurts:<br />
+ /bin/sync<br />
+-<br />
+-# Close any volumes opened by cryptsetup:<br />
+-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
+- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
+- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
+- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
+- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
+- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
+- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
+- echo "Locking LUKS crypt volume '${LUKS}':"<br />
+- /sbin/cryptsetup luksClose ${LUKS}<br />
+- elif echo $OPTS | grep -wq swap ; then<br />
+- # If any of the volumes was used as encrypted swap,<br />
+- # then run mkswap on the underlying device -<br />
+- # in case other Linux installations on this computer should use it:<br />
+- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
+- /sbin/cryptsetup remove ${LUKS}<br />
+- mkswap $DEV<br />
+- fi<br />
+- done<br />
+-fi<br />
+-<br />
+-# Deactivate LVM volume groups:<br />
+-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
+- echo "Deactivating LVM volume groups:"<br />
+- /sbin/vgchange -an --ignorelockingfailure<br />
+-fi<br />
+-<br />
+-# This never hurts again (especially since root-on-LVM always fails<br />
+-# to deactivate the / logical volume... but at least it was<br />
+-# remounted as read-only first)<br />
+-/bin/sync<br />
+-<br />
+-# sleep 3 fixes problems with some hard drives that don't<br />
+-# otherwise finish syncing before reboot or poweroff<br />
+-/bin/sleep 3<br />
+-<br />
+-# This is to ensure all processes have completed on SMP machines:<br />
+-wait<br />
+-<br />
+-if [ -x /sbin/genpowerd ]; then<br />
+- # See if this is a powerfail situation:<br />
+- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
+- # Signal UPS to shut off the inverter:<br />
+- /sbin/genpowerd -k<br />
+- if [ ! $? = 0 ]; then<br />
+- echo<br />
+- echo "There was an error signaling the UPS."<br />
+- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
+- echo "the serial line and UPS type."<br />
+- # Wasting 15 seconds of precious power:<br />
+- /bin/sleep 15<br />
+- fi<br />
+- fi<br />
+-fi<br />
+-<br />
+-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
+-if [ "$command" = "reboot" ]; then<br />
+- echo "Rebooting."<br />
+- /sbin/reboot<br />
+-else<br />
+- /sbin/poweroff<br />
+-fi<br />
+-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-12-29 12:13:33.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-12-29 12:13:33.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2013-10-28 06:07:17.000000000 +0100<br />
+++ rc.d/rc.M 2013-12-29 12:14:08.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-12-29 12:13:33.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-12-29 12:13:33.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-12-29T13:33:00Z
<p>Roberto.puzzanghera: /* Make the guest */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Author: Roberto Puzzanghera<br />
# Thanks to Mark Colclough for corrections<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.YOURDOMAIN.XY<br />
IP=10.0.0.182<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=5182<br />
VERSION=14.1 # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..."<br />
cd $PACKAGES<br />
installpkg --root $VDIR/$NAME *.t?z;<br />
ROOT=$VDIR/$NAME upgradepkg patches/*.t?z;<br />
echo "...done"<br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab<br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.11.08<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-11-08 22:22:26.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-11-08 22:19:49.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-11-08 22:29:16.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-12-29T13:31:26Z
<p>Roberto.puzzanghera: /* Download the packages */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2013.12.29<br />
# Now the script parses comments in the package list (thanks to Mark Colclough)<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you want to download the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do<br />
[ "$LINE" ] || continue<br />
[ "${LINE#\#}" = "$LINE" ] || continue<br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
[ "${PKG#\#}" = "${PKG}" ] || continue<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.1 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.11.08<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-11-08 22:22:26.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-11-08 22:19:49.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-11-08 22:29:16.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-11-10T14:04:03Z
<p>Roberto.puzzanghera: </p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.1 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.11.08<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-11-08 22:22:26.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-11-08 22:19:49.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-11-08 22:29:16.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-11-08T22:17:11Z
<p>Roberto.puzzanghera: /* Download the packages */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.1 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.11.08<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-11-08 22:22:26.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-11-08 22:19:49.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-11-08 22:29:16.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-11-08T22:16:49Z
<p>Roberto.puzzanghera: /* Download */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.1 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.11.08<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-11-08 22:22:26.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-11-08 22:19:49.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-11-08 22:29:16.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-11-08T21:51:17Z
<p>Roberto.puzzanghera: /* Patch applayed */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.1 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.1 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2013.11.08<br />
========================================================<br />
<br />
diff -ruN rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.0 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2013-09-23 01:43:20.000000000 +0200<br />
+++ rc.d/rc.6 2013-11-08 22:15:10.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,24 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
# Try to shut down pppd:<br />
PS="$(ps ax)"<br />
if echo "$PS" | /bin/grep -q -w pppd ; then<br />
@@ -131,45 +97,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +119,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 4096 bits:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(expr $(cat /proc/sys/kernel/random/poolsize) / 8) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,80 +127,5 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
-<br />
-# Close any volumes opened by cryptsetup:<br />
-if [ -f /etc/crypttab -a -x /sbin/cryptsetup ]; then<br />
- cat /etc/crypttab | grep -v "^#" | grep -v "^$" | while read line; do<br />
- # NOTE: we only support LUKS formatted volumes (except for swap)!<br />
- LUKS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f1 -d' ')<br />
- DEV=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f2 -d' ')<br />
- OPTS=$(echo $line | tr '\t' ' ' | tr -s ' ' | cut -f4 -d' ')<br />
- if /sbin/cryptsetup isLuks $DEV 2>/dev/null ; then<br />
- echo "Locking LUKS crypt volume '${LUKS}':"<br />
- /sbin/cryptsetup luksClose ${LUKS}<br />
- elif echo $OPTS | grep -wq swap ; then<br />
- # If any of the volumes was used as encrypted swap,<br />
- # then run mkswap on the underlying device -<br />
- # in case other Linux installations on this computer should use it:<br />
- echo "Erasing encrypted swap '${LUKS}' and restoring normal swap on ${DEV}:"<br />
- /sbin/cryptsetup remove ${LUKS}<br />
- mkswap $DEV<br />
- fi<br />
- done<br />
-fi<br />
-<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
-# This is to ensure all processes have completed on SMP machines:<br />
-wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -ruN rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2013-11-08 22:22:26.000000000 +0100<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -ruN rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2013-10-28 06:06:39.000000000 +0100<br />
+++ rc.d/rc.S 2013-11-08 22:19:49.000000000 +0100<br />
@@ -48,31 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- # See linux-*/Documentation/cgroups/cgroups.txt (section 1.6)<br />
- # Check if we have some tools to autodetect the available cgroup controllers<br />
- if [ -x /usr/bin/lssubsys -a -x /usr/bin/tr -a -x /usr/bin/sed ]; then<br />
- # Mount a tmpfs as the cgroup filesystem root<br />
- mount -t tmpfs -o mode=0755 cgroup_root /sys/fs/cgroup<br />
- # Autodetect available controllers and mount them in subfolders<br />
- controllers="$(lssubsys -a 2>/dev/null | tr '\n' ' ' | sed s/.$//)"<br />
- for i in $controllers; do<br />
- mkdir /sys/fs/cgroup/$i<br />
- mount -t cgroup -o $i $i /sys/fs/cgroup/$i<br />
- done<br />
- unset i controllers<br />
- else<br />
- # We can't use autodetection so fall back mounting them all together<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- fi<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -ruN rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2013-06-22 22:49:03.000000000 +0200<br />
+++ rc.d/rc.syslog 2013-11-08 22:29:16.000000000 +0100<br />
@@ -5,7 +5,7 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
+# echo -n "Starting sysklogd daemons: "<br />
echo -n "/usr/sbin/syslogd "<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
@@ -16,10 +16,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-11-08T21:49:37Z
<p>Roberto.puzzanghera: /* Make the guest */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.1 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2013-11-08T21:48:59Z
<p>Roberto.puzzanghera: /* Download the packages */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.1" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-10-19T20:29:14Z
<p>Roberto.puzzanghera: /* Download the packages */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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''.<br />
<br />
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.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-10-19T20:26:46Z
<p>Roberto.puzzanghera: /* Make the guest */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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 and blank otherwise, while ''$VERSION'' is the Slackware version, so it's something like "14.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-10-19T20:26:22Z
<p>Roberto.puzzanghera: /* Make the guest */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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 and blank otherwise, while ''$VERSION'' is the Slackware version, so it's something like "14.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that ''/etc/resolv.conf /etc/localtime /etc/profile'' are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-10-19T20:25:13Z
<p>Roberto.puzzanghera: /* Download the packages */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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 and blank otherwise, while ''$VERSION'' is the Slackware version, so it's something like "14.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package ''PKG_LIST'', enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the ''/slackware'' folder with the updates belonging to the ''/patches'' dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script make_slack_vserver.sh:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-10-01T17:05:00Z
<p>Roberto.puzzanghera: /* Download */</p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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.<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script make_slack_vserver.sh:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-10-01T17:03:17Z
<p>Roberto.puzzanghera: </p>
<hr />
<div>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.<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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. Comments would be welcome about this :-).<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script make_slack_vserver.sh:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-09-29T14:39:48Z
<p>Roberto.puzzanghera: /* Contact */</p>
<hr />
<div>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).<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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. Comments would be welcome about this :-).<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script make_slack_vserver.sh:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments and criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-09-29T14:39:21Z
<p>Roberto.puzzanghera: /* Patch applayed */</p>
<hr />
<div>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).<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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. Comments would be welcome about this :-).<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script make_slack_vserver.sh:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Contact ==<br />
Comments, criticism can be addressed to roberto dot puzzanghera at sagredo dot eu (http://sagredo.eu)</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-09-29T14:35:39Z
<p>Roberto.puzzanghera: /* Download */</p>
<hr />
<div>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).<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* <em>PKG_LIST</em> is the package list to be installed in the guest<br />
* <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.<br />
* <em>make_slack_vserver.sh</em> is the shell script that you have to adjust. It installs the guest.<br />
* <em>rc</em> is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* <em>slackware-14.0.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. Comments would be welcome about this :-).<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script make_slack_vserver.sh:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-09-29T14:34:41Z
<p>Roberto.puzzanghera: /* Download the packages */</p>
<hr />
<div>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).<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* PKG_LIST is the package list to be installed in the guest<br />
* 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.<br />
* make_slack_vserver.sh is the shell script that you have to adjust. It installs the guest.<br />
* rc is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* 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 :-).<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script make_slack_vserver.sh:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_14
Installation on Slackware 14
2012-09-29T14:33:12Z
<p>Roberto.puzzanghera: Created page with '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…'</p>
<hr />
<div>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).<br />
<br />
== Download ==<br />
<pre><br />
wget http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz<br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver<br />
ls<br />
</pre><br />
<br />
You have downloaded the following files:<br />
<br />
* PKG_LIST is the package list to be installed in the guest<br />
* 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.<br />
* make_slack_vserver.sh is the shell script that you have to adjust. It installs the guest.<br />
* rc is the startup script for the virtual server. It will be automatically copied in /etc/rc.d* /init.d/rc<br />
* 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 :-).<br />
<br />
== Download the packages ==<br />
<br />
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.<br />
<br />
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.<br />
<br />
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 and null otherwise, while $VERSION is the Slackware version, so it's something like "14.0".<br />
<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
<br />
VERSION="14.0" # Slackware version<br />
ARCH="64" # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# Put here your favourite Slackware repository<br />
SRC="ftp://ftp.slackware.no/slackware/slackware${ARCH}-${VERSION}/"<br />
<br />
# put here your pkg list<br />
LIST="${PWD}/PKG_LIST"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# create the folder where the pkg will be downloaded<br />
if [ ! -d "$PACKAGES" ]; then<br />
mkdir -p $PACKAGES<br />
fi<br />
<br />
# create the "patches" sub-folder<br />
if [ ! -d "${PACKAGES}/patches" ]; then<br />
mkdir -p "${PACKAGES}/patches"<br />
fi<br />
<br />
# download<br />
cd $PACKAGES<br />
<br />
if [ -f $LIST ]; then<br />
while read LINE<br />
do <br />
wget "${SRC}slackware${ARCH}/${LINE}*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
<br />
# download packages from the patches folder<br />
cd ${PACKAGES}/patches<br />
<br />
if [ -f ${LIST} ]; then<br />
while read LINE<br />
do<br />
IFS='/' read -ra PKG <<< "$LINE"<br />
PKG_LEN=${#PKG[@]}<br />
if [ $PKG_LEN == 2 ]; then<br />
wget "${SRC}patches/packages/${PKG[1]}*.t?z"<br />
fi<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package PKG_LIST, enter your favorite ftp server and run from the command line<br />
<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
NB: this script tries also to overwrite the packages downloaded from the /slackware folder with the updates belonging to the /patches dir.<br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done adjusting and running the script make_slack_vserver.sh:<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2012.09.29<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
# adjust this to where your things live<br />
NAME=test<br />
HOSTNAME=$NAME.domain.com<br />
IP=10.0.0.34<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=34000<br />
VERSION=14.0 # Slackware version<br />
ARCH=64 # you can put 64 for 64b cpu just to separate 64/32 download folders<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/usr/local/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="${SETUP}/slackware${ARCH}-${VERSION}_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="${SETUP}/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z;<br />
upgradepkg patches/*.t?z;<br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
<br />
if [ ! -f "${SETUP}/linux-vserver_slackware-${VERSION}.patch" ]; then<br />
echo<br />
echo "Can't find any PATCH here: ${SETUP}/linux-vserver_slackware-${VERSION}.patch"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
cd ${VDIR}/${NAME}/etc/rc.d<br />
patch -p1 < ${SETUP}/linux-vserver_slackware-${VERSION}.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host.<br />
<br />
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.<br />
<pre><br />
./make_slack_vserver.sh<br />
</pre><br />
<br />
== Apply the patch ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-14.0.patch<br />
</pre><br />
<br />
Inside the tarball you can find the old patch for Slackware 13.1 and 13.37, if you like.<br />
<br />
== Post installation tasks ==<br />
<br />
Put this inside your rc.local:<br />
<pre><br />
/usr/local/etc/rc.d/init.d/vprocunhide start<br />
</pre><br />
<br />
== Start the new server ==<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Patch applayed ==<br />
<pre><br />
Patch for Slackware 14.0 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2012.09.29<br />
========================================================<br />
<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.0 2012-09-29 15:23:23.347807225 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2012-08-15 01:03:12.000000000 +0200<br />
+++ rc.d/rc.6 2012-09-29 15:23:23.363807355 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,32 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Shut down YP services:<br />
if [ -x /etc/rc.d/rc.yp ]; then<br />
if grep -wq stop /etc/rc.d/rc.yp ; then<br />
@@ -131,45 +89,11 @@<br />
fi<br />
fi<br />
<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
-# Stop udev:<br />
-if [ -x /etc/rc.d/rc.udev ]; then<br />
- sh /etc/rc.d/rc.udev force-stop<br />
-fi<br />
-<br />
# Kill all remaining processes.<br />
if [ ! "$1" = "fast" ]; then<br />
echo "Sending all processes the SIGTERM signal."<br />
@@ -187,16 +111,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -205,17 +119,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -240,45 +143,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2012-09-25 19:47:07.000000000 +0200<br />
+++ rc.d/rc.M 2012-09-29 15:33:01.756524040 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,40 +54,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# Run rc.udev again. This will start udev if it is not already running<br />
-# (for example, upon return from runlevel 1), otherwise it will trigger it<br />
-# to look for device changes and to generate persistent rules if needed.<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
-# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
-<br />
-# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
-<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
sh /etc/rc.d/rc.ntpd start<br />
@@ -135,17 +77,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -183,18 +114,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd or networkmanager:<br />
-if [ -x /etc/rc.d/rc.wicd -a -x /usr/sbin/wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-elif [ -x /etc/rc.d/rc.networkmanager ]; then<br />
- sh /etc/rc.d/rc.networkmanager start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -207,60 +126,11 @@<br />
/usr/bin/update-pango-querymodules --verbose<br />
fi<br />
<br />
-# Start dnsmasq, a simple DHCP/DNS server:<br />
-if [ -x /etc/rc.d/rc.dnsmasq ]; then<br />
- /etc/rc.d/rc.dnsmasq start<br />
-fi<br />
-<br />
# Start snmpd:<br />
if [ -x /etc/rc.d/rc.snmpd ]; then<br />
/etc/rc.d/rc.snmpd start<br />
fi<br />
<br />
-# Start the print spooling system. This will usually be LPRng (lpd) or CUPS.<br />
-if [ -x /etc/rc.d/rc.cups ]; then<br />
- # Start CUPS:<br />
- /etc/rc.d/rc.cups start<br />
-elif [ -x /etc/rc.d/rc.lprng ]; then<br />
- # Start LPRng (lpd):<br />
- . /etc/rc.d/rc.lprng start<br />
-fi<br />
-<br />
-# Start netatalk. (a file/print server for Macs using Appletalk)<br />
-if [ -x /etc/rc.d/rc.atalk ]; then<br />
- /etc/rc.d/rc.atalk start<br />
-fi<br />
-<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -325,11 +195,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -361,11 +226,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.S rc.d/rc.S<br />
--- rc.d-original/rc.S 2012-09-13 21:38:34.000000000 +0200<br />
+++ rc.d/rc.S 2012-09-29 15:23:23.391807582 +0200<br />
@@ -48,16 +48,6 @@<br />
fi<br />
fi<br />
<br />
-# Mount Control Groups filesystem interface:<br />
-if grep -wq cgroup /proc/filesystems ; then<br />
- if [ -d /sys/fs/cgroup ]; then<br />
- mount -t cgroup cgroup /sys/fs/cgroup<br />
- else<br />
- mkdir -p /dev/cgroup<br />
- mount -t cgroup cgroup /dev/cgroup<br />
- fi<br />
-fi<br />
-<br />
# Initialize the Logical Volume Manager.<br />
# This won't start unless we find /etc/lvmtab (LVM1) or<br />
# /etc/lvm/backup/ (LVM2). This is created by /sbin/vgscan, so to<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2012-08-15 00:53:35.000000000 +0200<br />
+++ rc.d/rc.inet2 2012-09-29 15:23:23.403807679 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2012-09-29 15:23:23.419807809 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Documentation
Documentation
2012-09-29T14:23:46Z
<p>Roberto.puzzanghera: /* Installation */</p>
<hr />
<div><div style="margin: 2em auto 2em auto; padding: 10px; background-color: #F9ECCD; border: 1px solid #004433; text-align: center;"><br />
[[Image:Icon-Caution.png|left]]<br />
We are currently migrating to MediaWiki from our old system, but not all content has been migrated yet. Take a look at the [[Wiki Team]] page for instructions how to help or look at the [http://oldwiki.linux-vserver.org old wiki] to find the information not migrated yet.<br />
<br />
'''To ease migration we created a [[List of old Documentation pages]].'''<br />
</div><br />
<br />
== Introduction ==<br />
<br />
* [[Overview|Virtualization Overview]]<br />
* [[Usage Scenarios]]<br />
* [[Feature Matrix]]<br />
<br />
== Installation ==<br />
<br />
* [[Installation Considerations]]<br />
* [[Installation on Linux 2.6]]: from source, both the kernel and util-vserver<br />
* [[Installation on ArchLinux]]<br />
* [[Installation on CentOS]]<br />
* [[Installation on Debian]]<br />
* [[Installation on Fedora]]<br />
* [[Installation on Gentoo]]<br />
* [[Installation on Mandrake]]<br />
* [http://www.pld-linux.org/Docs/Vserver Installation on PLD-Linux]<br />
* [[Installation on Redhat]]<br />
* [[Installation on Slackware]]<br />
** [[Installation on Slackware 14]]<br />
* [[Installation on SuSE/OpenSUSE]]<br />
* [[Installation on Ubuntu]]<br />
<br />
== Configuration ==<br />
<br />
* [[Util-vserver:Documentation|util-vserver Documentation]]<br />
* [[vcd:Documentation|VServer Control Daemon Documentation]]<br />
* [[Share a directory among multiple guests]]<br />
* [[Standard_non-shared_quota]]<br />
<br />
== Guides and Howtos ==<br />
<br />
* [[Building Guest Systems]]<br />
* [[util-vserver:Howto virtualize an exisiting Linux server|Howto virtualize an existing Linux server]]<br />
* [[VCMD HowTo]]<br />
* [[Howto make bsd-style init sysv-compatible|Howto make Bsd-style init sysv-compatible (archlinux guest system)]]<br />
* [[Installing 32-bit Fedora on 64-bit Debian]]<br />
* [[Installing Ubuntu on Debian]]<br />
* [[Installing an openSUSE vserver guest]]<br />
* [[Networking vserver guests]]<br />
* [[Howto HostAuth]]<br />
* [[Fuse_GlusterFS| Fuse and GlusterFS]]<br />
* [[yum-patch|How to patch vyum]]<br />
* [[yum-upgrade-3.2.4|Upgrading existing installations to yum-3.2.4]]<br />
* [[Migrating from OpenVZ to Linux-Vserver]]<br />
* [[Getting_high_with_lenny]]<br />
* [[Installing_Ubuntu_8.04_Hardy_as_guest]]<br />
* [[Applying CPU Limits]]<br />
* [[Upgrading from Etch to Lenny]]<br />
* [[Upstart issues]]<br />
* [[Limit Networking on Multihomed hosts]]<br />
* [[Read-only_RootFS]]<br />
<br />
== Lists &amp; Theory ==<br />
<br />
* Basic configuration<br />
** [[Capabilities and Flags]]<br />
** [[CPU Scheduler]]<br />
** [[Disk Limits and Quota]]<br />
** [[Resource Limits]]<br />
*** [[Memory Limits]]<br />
*** [[Network Bandwidth Management]]<br />
** [[Virtual System Information]]<br />
** [[Unification]]<br />
<br />
* Security Considerations<br />
** [[Secure Capabilities]]<br />
** [[Secure chroot Barrier]]<br />
** [[Secure Device Nodes]]<br />
** [[Secure ProcFS Entries]]<br />
<br />
* Performance and Stability<br />
** [[Virtualization Overhead]]<br />
<br />
* Implementation Details<br />
** [[Context Accounting]]<br />
** [[Filesystem Attributes]]<br />
** [[Filesystem Tagging]]<br />
** [[Filesystem Namespaces]]<br />
** [[Kernel Userspace Helper]]<br />
** [[Mainline Kernel Virtualization]]<br />
** [[ProcFS]]<br />
** [[Syscall Command Switch]]<br />
<br />
== External Resources ==<br />
<br />
* [http://vserver.13thfloor.at/Remote-Reset/ Simple Remote reset] (remote reset/power your vserver box)<br />
* [http://vserver.13thfloor.at/Null-Modem/ NullModem cables] [http://www.loop-back.com/null-mod.html II] [http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/serial-pc-terminal.html III] (cable required for serial console)<br />
* [http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/index.html Serial Console HOWTO]<br />
<br />
[[Category:Documentation| ]]<br />
[[Category:Community]]</div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-07-28T20:59:12Z
<p>Roberto.puzzanghera: /* Download the slack packages */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M'' 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.37/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.37/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:41:03Z
<p>Roberto.puzzanghera: /* Apply the patch and start the guest */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M'' 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:39:26Z
<p>Roberto.puzzanghera: /* Download the slack packages */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M'' 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:37:06Z
<p>Roberto.puzzanghera: /* Download the slack packages */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M'' 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [[PKG_LIST Slackware_package_list]], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:35:54Z
<p>Roberto.puzzanghera: /* Download the slack packages */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M'' 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [[Slackware_package_list PKG_LIST]], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:35:29Z
<p>Roberto.puzzanghera: /* Download the slack packages */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M'' 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [#Slackware_package_list PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:33:42Z
<p>Roberto.puzzanghera: /* Download the slack packages */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M'' 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:31:41Z
<p>Roberto.puzzanghera: /* Download the patch and the installer script */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M'' 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:31:06Z
<p>Roberto.puzzanghera: /* Download the patch and the installer script */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.37.patch] is the patch which modify ''rc.6'' ''rc.M 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:29:06Z
<p>Roberto.puzzanghera: /* Slackware package list */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.1.patch] is the patch which modify ''rc.6'' ''rc.M 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:27:57Z
<p>Roberto.puzzanghera: /* Patch used */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.1.patch] is the patch which modify ''rc.6'' ''rc.M 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.37 guest on a Linux-Vserver host<br />
========================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2011.04.28<br />
<br />
========================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d/rc.0<br />
--- rc.d-original/rc.0 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.0 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d/rc.6<br />
--- rc.d-original/rc.6 2011-04-16 23:14:14.000000000 +0200<br />
+++ rc.d/rc.6 2011-04-28 15:01:59.000000000 +0200<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,66 +82,11 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Kill any processes (typically gam) that would otherwise prevent<br />
-# unmounting NFS volumes:<br />
-unset FUSER_DELAY<br />
-for dir in $(/bin/mount | grep 'type nfs' | cut -d ' ' -f 3 ) ; do<br />
- echo "Killing processes holding NFS mount $dir open..."<br />
- # Background this to prevent fuser from also blocking shutdown:<br />
- /usr/bin/fuser -k -m $dir &<br />
- FUSER_DELAY=5<br />
-done<br />
-# If fuser was run, let it have some delay:<br />
-if [ ! -z "$FUSER_DELAY" ]; then<br />
- sleep $FUSER_DELAY<br />
-fi<br />
-<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -l -f -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
-# Bring down the networking system, but first make sure that this<br />
-# isn't a diskless client with the / partition mounted via NFS:<br />
-if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
- if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1 stop<br />
- fi<br />
-fi<br />
-<br />
-# In case dhcpcd might have been manually started on the command line,<br />
-# look for the .pid file, and shut dhcpcd down if it's found:<br />
-if /bin/ls /etc/dhcpc/*.pid 1> /dev/null 2> /dev/null ; then<br />
- /sbin/dhcpcd -k 1> /dev/null 2> /dev/null<br />
- # A little time for /etc/resolv.conf and/or other files to<br />
- # restore themselves.<br />
- sleep 2<br />
-fi<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
fi<br />
<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
# INIT is supposed to handle this entirely now, but this didn't always<br />
# work correctly without this second pass at killing off the processes.<br />
@@ -177,16 +106,6 @@<br />
fi<br />
fi<br />
<br />
-# Carry a random seed between reboots.<br />
-echo "Saving random seed from /dev/urandom in /etc/random-seed."<br />
-# Use the pool size from /proc, or 512 bytes:<br />
-if [ -r /proc/sys/kernel/random/poolsize ]; then<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=$(cat /proc/sys/kernel/random/poolsize) 2> /dev/null<br />
-else<br />
- /bin/dd if=/dev/urandom of=/etc/random-seed count=1 bs=512 2> /dev/null<br />
-fi<br />
-/bin/chmod 600 /etc/random-seed<br />
-<br />
# Before unmounting file systems write a reboot or halt record to wtmp.<br />
$command -w<br />
<br />
@@ -195,17 +114,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -230,45 +138,10 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
# This never hurts again (especially since root-on-LVM always fails<br />
# to deactivate the / logical volume... but at least it was<br />
# remounted as read-only first)<br />
/bin/sync<br />
<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.M rc.d/rc.M<br />
--- rc.d-original/rc.M 2011-03-22 07:15:15.000000000 +0100<br />
+++ rc.d/rc.M 2011-04-28 19:07:47.000000000 +0200<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -47,31 +43,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -83,38 +54,18 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Initialize the networking hardware.<br />
-if [ -x /etc/rc.d/rc.inet1 ]; then<br />
- . /etc/rc.d/rc.inet1<br />
-fi<br />
-<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
fi<br />
<br />
# Mount any additional filesystem types that haven't already been mounted:<br />
-mount -a -v 2> /dev/null | grep -v "already mounted"<br />
+#mount -a -v 2> /dev/null | grep -v "already mounted"<br />
<br />
# Start the Control Script for automounter:<br />
-if [ -x /etc/rc.d/rc.autofs ]; then<br />
- sh /etc/rc.d/rc.autofs start<br />
-fi<br />
+#if [ -x /etc/rc.d/rc.autofs ]; then<br />
+# sh /etc/rc.d/rc.autofs start<br />
+#fi<br />
<br />
# Start the Network Time Protocol daemon:<br />
if [ -x /etc/rc.d/rc.ntpd ]; then<br />
@@ -134,17 +85,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -177,21 +117,6 @@<br />
sh /etc/rc.d/rc.consolekit start<br />
fi<br />
<br />
-# Start HAL:<br />
-if [ -x /etc/rc.d/rc.hald ]; then<br />
- sh /etc/rc.d/rc.hald start<br />
-fi<br />
-<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
-# Start wicd:<br />
-if [ -x /etc/rc.d/rc.wicd ]; then<br />
- sh /etc/rc.d/rc.wicd start<br />
-fi<br />
-<br />
# These GTK+/pango files need to be kept up to date for<br />
# proper input method, pixbuf loaders, and font support.<br />
if [ -x /usr/bin/update-gtk-immodules ]; then<br />
@@ -228,36 +153,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -322,11 +217,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -358,11 +248,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d/rc.inet2 2011-04-28 19:09:27.000000000 +0200<br />
@@ -16,26 +16,6 @@<br />
# At this point, we are ready to talk to The World...<br />
<br />
<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
@@ -44,23 +24,6 @@<br />
sh /etc/rc.d/rc.rpc start<br />
fi<br />
<br />
-# Mount remote CIFS filesystems. Note that where possible, using CIFS is<br />
-# preferred over SMBFS. SMBFS is no longer actively maintained.<br />
-if cat /etc/fstab | grep -v '^#' | grep -w cifs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote CIFS file systems: /sbin/mount -a -t cifs"<br />
- /sbin/mount -a -t cifs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t cifs<br />
-fi<br />
-<br />
-# Mount remote SMB filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w smbfs 1> /dev/null 2> /dev/null ; then<br />
- echo "Mounting remote SMBFS file systems: /sbin/mount -a -t smbfs"<br />
- /sbin/mount -a -t smbfs<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t smbfs<br />
-fi<br />
-<br />
# Start the system logger if it is not already running (maybe because /usr<br />
# is on a network partition).<br />
if [ -x /etc/rc.d/rc.syslog -a -d /var/log -a ! -r /var/run/syslogd.pid ]; then<br />
diff -urNB rc.d-original/rc.syslog rc.d/rc.syslog<br />
--- rc.d-original/rc.syslog 2010-10-21 01:03:54.000000000 +0200<br />
+++ rc.d/rc.syslog 2011-04-28 20:20:26.000000000 +0200<br />
@@ -5,8 +5,9 @@<br />
<br />
syslogd_start() {<br />
if [ -x /usr/sbin/syslogd -a -x /usr/sbin/klogd ]; then<br />
- echo -n "Starting sysklogd daemons: "<br />
- echo -n "/usr/sbin/syslogd "<br />
+# echo -n "Starting sysklogd daemons: "<br />
+ echo -n "Starting /usr/sbin/syslogd "<br />
+ echo<br />
/usr/sbin/syslogd<br />
# prevent syslogd/klogd race condition on SMP kernels<br />
if ps acx | grep -q udevd ; then<br />
@@ -16,10 +17,10 @@<br />
else<br />
sleep 1<br />
fi<br />
- echo "/usr/sbin/klogd -c 3 -x"<br />
+# echo "/usr/sbin/klogd -c 3 -x"<br />
# '-c 3' = display level 'error' or higher messages on console<br />
# '-x' = turn off broken EIP translation<br />
- /usr/sbin/klogd -c 3 -x<br />
+# /usr/sbin/klogd -c 3 -x<br />
fi<br />
}<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera
http://svn.linux-vserver.org/Installation_on_Slackware_13
Installation on Slackware 13
2011-04-28T22:26:58Z
<p>Roberto.puzzanghera: /* Hints */</p>
<hr />
<div>What follows was tested on a Slackware 13.37 and 13.1 guest. I assume you have a Linux-Vserver host working.<br />
<br />
== Download the patch and the installer script ==<br />
* [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/slack_vserver.tar.gz slack_vserver.tar.gz]<br />
<br />
<pre><br />
tar xzf slack_vserver.tar.gz<br />
cd slack_vserver <br />
<br />
ls <br />
</pre><br />
<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Slackware_package_list PKG_LIST] is the package list to be installed in the guest<br />
* slackware_pkg/ is the folder were the packages (txz) to be installed are stored.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Download_the_slack_packages 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.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Make_the_guest make_slack_vserver.sh] is the shell script that you have to adjust. It installs the guest.<br />
* [http://www.linux-vserver.org/Installation_on_Slackware_13#Patch_used slackware-13.1.patch] is the patch which modify ''rc.6'' ''rc.M 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.<br />
* ''rc'' is the startup script for the virtual server. It will be automatically copied in ''/etc/rc.d/init.d/rc''<br />
<pre><br />
# more rc<br />
<br />
#!/bin/bash<br />
<br />
if [ "$1" == "3" ]; then<br />
/etc/rc.d/rc.M<br />
elif [ "$1" == "6" ]; then<br />
/etc/rc.d/rc.6<br />
else<br />
echo "Invalid level."<br />
exit 1<br />
fi<br />
</pre><br />
<br />
== Download the slack packages ==<br />
<br />
First of all select a minimal set of packages to be installed on the virtual server. [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST This list] of '''109 packages''' is based on the Minimal System reported at [http://slackwiki.org/Minimal_System http://slackwiki.org/Minimal_System] without all hardware, kernel and multimedia related packages. The install leads to '''a guest of about 448M of size'''.<br />
<br />
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.<br />
<br />
You can download my minimal set of packages running the shell script download_slack_pkg.sh<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.01.07 <br />
# Put here your favourite Slackware repository<br />
<br />
SRC="ftp://ftp.slackware.no/slackware/slackware-13.1/slackware/" # 32-bit<br />
#SRC="ftp://ftp.slackware.no/slackware/slackware64-13.1/slackware64/" # 64-bit<br />
<br />
LIST="../PKG_LIST"<br />
<br />
cd slackware_pkg<br />
<br />
if [ -f $LIST ]; then<br />
while read line <br />
do <br />
wget "$SRC$line*.t?z"<br />
done < $LIST<br />
else<br />
echo "Can't find $LIST file."<br />
exit 1<br />
fi<br />
<br />
rm index.html*<br />
</pre><br />
<br />
Adjust the package [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST PKG_LIST], enter your favorite ftp server and run from the command line<br />
<pre><br />
./download_slack_pkg.sh<br />
</pre><br />
<br />
== Make the guest ==<br />
<br />
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.<br />
<br />
This is done running the script ''make_slack_vserver.sh'':<br />
<pre><br />
#!/bin/bash<br />
#<br />
# v. 2011.04.28<br />
# Author: Roberto Puzzanghera<br />
#<br />
# This script installs a Slackware guest into a linux-vserver host (http://linux-vserver.org)<br />
#<br />
# Comments are welcome :-)<br />
# More info here: http://notes.sagredo.eu/node/7<br />
<br />
if [ $# != 1 ]; then<br />
echo "usage: $0 <server-name>"<br />
exit 1<br />
fi<br />
<br />
# adjust this to where your things live<br />
NAME=$1<br />
HOSTNAME=$NAME.myserver.net<br />
IP=10.0.0.149<br />
INTERFACE=eth0:$IP/24<br />
CONTEXT=1011<br />
VERSION=13.37 # Slackware version<br />
<br />
# where is the vservers dir? default is /vservers<br />
VDIR="/vservers"<br />
<br />
# the directory where you unpacked slack_vserver.tar.gz<br />
# $PWD should work, otherwise put /path/to/slack_vserver<br />
SETUP=$PWD<br />
<br />
# the directory where you downloaded the slackware packages<br />
PACKAGES="$SETUP/slackware_pkg"<br />
<br />
# the path to rc script file (leave as is)<br />
RC="$SETUP/rc"<br />
<br />
################### end configuration<br />
<br />
# sanity check<br />
<br />
if [ ! -d "$VDIR" ]; then<br />
echo<br />
echo "Can't find VDIR dir: $VDIR"<br />
echo "Exiting"<br />
echo<br />
exit 1 <br />
fi<br />
if [ ! -d "$SETUP" ]; then<br />
echo <br />
echo "Can't find SETUP dir: $SETUP"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -d "$PACKAGES" ]; then<br />
echo<br />
echo "Can't find PACKAGES dir: $PACKAGES"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
if [ ! -f "$RC" ]; then<br />
echo<br />
echo "Can't find RC path: $RC"<br />
echo "Exiting"<br />
echo<br />
exit 1<br />
fi<br />
<br />
# if everything is ok start the install<br />
<br />
echo<br />
read -p "press any key to make skeleton..."<br />
vserver ${NAME} build -m skeleton \<br />
--hostname ${HOSTNAME} \<br />
--interface ${INTERFACE} \<br />
--context $CONTEXT \<br />
--flags lock,virt_mem,virt_uptime,virt_cpu,virt_load,sched_hard,hide_netif \<br />
--initstyle sysv<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to move the /dev folder to a temp dir the /dev folder..."<br />
mv $VDIR/$NAME/dev $VDIR/$NAME/dev2<br />
<br />
echo<br />
read -p "press any key to install packages..." <br />
cd $PACKAGES<br />
installpkg -root $VDIR/$NAME *.t?z; <br />
echo "...done" <br />
echo<br />
<br />
echo<br />
read -p "press any key to copy the rc script to /etc/rc.d/init.d..."<br />
echo<br />
echo "copying rc to /etc/rc.d/init.d/rc"<br />
cp -p $RC $VDIR/$NAME/etc/rc.d/init.d/<br />
echo "...done"<br />
<br />
echo<br />
echo "removing x flag to rc.inet1 rc.loop and rc.sshd"<br />
chmod -x $VDIR/$NAME/etc/rc.d/rc.inet1 $VDIR/$NAME/etc/rc.d/rc.loop $VDIR/$NAME/etc/rc.d/rc.sshd<br />
echo "...done"<br />
echo<br />
<br />
echo "trying to adjust HOSTNAME, hosts, resolv.conf, profile. Check later..."<br />
cp /etc/resolv.conf $VDIR/$NAME/etc/<br />
cp /etc/localtime $VDIR/$NAME/etc/<br />
rm $VDIR/$NAME/etc/profile<br />
cp /etc/profile $VDIR/$NAME/etc/<br />
echo $HOSTNAME > $VDIR/$NAME/etc/HOSTNAME<br />
echo "127.0.0.1 localhost" > $VDIR/$NAME/etc/hosts<br />
echo "$IP $HOSTNAME $NAME" >> $VDIR/$NAME/etc/hosts<br />
touch $VDIR/$NAME/etc/mtab <br />
touch $VDIR/$NAME/etc/fstab<br />
echo "...done"<br />
echo<br />
<br />
read -p "press any key to restore /dev2 to /dev"<br />
rm -r $VDIR/$NAME/dev<br />
mv $VDIR/$NAME/dev2 $VDIR/$NAME/dev<br />
<br />
echo<br />
echo -n "Do you want that I apply the patch for you y/n? [y] "<br />
read VAR_PATCH<br />
<br />
if [ "$VAR_PATCH" = 'y' ] || [ "$VAR_PATCH" = '' ]; then<br />
cd $VDIR/$NAME/etc/rc.d<br />
patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch<br />
echo "patch applyed."<br />
echo<br />
echo "You can start and enter the virtual server typing: "<br />
echo<br />
echo "vserver $NAME start"<br />
echo "vserver $NAME enter"<br />
else<br />
echo<br />
echo "DON'T FORGET to patch /etc/rc.d as follows: "<br />
echo<br />
echo "cd $VDIR/$NAME/etc/rc.d"<br />
echo "patch -p1 < $SETUP/linux-vserver_slackware-$VERSION.patch"<br />
fi<br />
<br />
echo<br />
echo "More info on http://notes.sagredo.eu/node/7"<br />
echo<br />
</pre><br />
<br />
== Apply the patch and start the guest ==<br />
<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:<br />
<pre><br />
cd /vservers/vserver_name/etc/rc.d<br />
The script itsself can install the patch for you. Anyway this is how to apply the patch by yourself:patch -p1 < /path/to/slack_vserver/slackware-13.37.patch<br />
</pre><br />
<br />
Now you can start the newly created virtual server:<br />
<pre><br />
vserver <vserver_name> start<br />
vserver <vserver_name> enter<br />
</pre><br />
<br />
== Contact ==<br />
Any comments/suggestions/questions to ''roberto dot puzzanghera at sagredo dot eu'', [http://notes.sagredo.eu]<br />
<br />
== Patch used ==<br />
<pre><br />
Patch for Slackware 13.1 guest on a Linux-Vserver host<br />
======================================================<br />
by Roberto Puzzanghera - http://notes.sagredo.eu<br />
version: 2010.12.28<br />
<br />
======================================================<br />
<br />
diff -urNB rc.d-original/rc.0 rc.d-patched/rc.0<br />
--- rc.d-original/rc.0 2010-03-20 01:14:07.000000000 +0100<br />
+++ rc.d-patched/rc.0 2010-12-28 17:37:41.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,18 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Bring down the networking system, but first make sure that this<br />
# isn't a diskless client with the / partition mounted via NFS:<br />
if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
@@ -127,13 +99,6 @@<br />
sleep 2<br />
fi<br />
<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
@@ -181,23 +146,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-# Umount any LVM volumes:<br />
-if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then<br />
- echo "Unmounting LVM volumes."<br />
- /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)<br />
-fi<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -222,45 +170,5 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.6 rc.d-patched/rc.6<br />
--- rc.d-original/rc.6 2010-03-20 01:14:07.000000000 +0100<br />
+++ rc.d-patched/rc.6 2010-12-28 17:37:41.000000000 +0100<br />
@@ -37,22 +37,6 @@<br />
;;<br />
esac<br />
<br />
-# Save the system time to the hardware clock using hwclock --systohc.<br />
-if [ -x /sbin/hwclock ]; then<br />
- # Check for a broken motherboard RTC clock (where ioports for rtc are<br />
- # unknown) to prevent hwclock causing a hang:<br />
- if ! grep -q -w rtc /proc/ioports ; then<br />
- CLOCK_OPT="--directisa"<br />
- fi<br />
- if grep -q "^UTC" /etc/hardwareclock 2> /dev/null ; then<br />
- echo "Saving system time to the hardware clock (UTC)."<br />
- /sbin/hwclock $CLOCK_OPT --utc --systohc<br />
- else<br />
- echo "Saving system time to the hardware clock (localtime)."<br />
- /sbin/hwclock $CLOCK_OPT --localtime --systohc<br />
- fi<br />
-fi<br />
-<br />
# Run any local shutdown scripts:<br />
if [ -x /etc/rc.d/rc.local_shutdown ]; then<br />
/etc/rc.d/rc.local_shutdown stop<br />
@@ -98,18 +82,6 @@<br />
sh /etc/rc.d/rc.messagebus stop<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-/bin/umount -v -a -r -t nfs,smbfs,cifs<br />
-<br />
-# Try to shut down pppd:<br />
-PS="$(ps ax)"<br />
-if echo "$PS" | /bin/grep -q -w pppd ; then<br />
- if [ -x /usr/sbin/ppp-off ]; then<br />
- /usr/sbin/ppp-off<br />
- fi<br />
-fi<br />
-<br />
# Bring down the networking system, but first make sure that this<br />
# isn't a diskless client with the / partition mounted via NFS:<br />
if ! /bin/mount | /bin/grep -q 'on / type nfs' ; then<br />
@@ -127,13 +99,6 @@<br />
sleep 2<br />
fi<br />
<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- /bin/sleep 5<br />
-fi<br />
-<br />
# Turn off process accounting:<br />
if [ -x /sbin/accton -a -r /var/log/pacct ]; then<br />
/sbin/accton off<br />
@@ -181,23 +146,6 @@<br />
rm -f /var/lock/subsys/*<br />
fi<br />
<br />
-# Turn off swap:<br />
-echo "Turning off swap."<br />
-/sbin/swapoff -a<br />
-/bin/sync<br />
-<br />
-# Umount any LVM volumes:<br />
-if /bin/mount | /bin/grep -q '^/dev/mapper/' ; then<br />
- echo "Unmounting LVM volumes."<br />
- /bin/umount -v $(/bin/mount | /bin/grep '^/dev/mapper/' | /bin/cut -d ' ' -f 3 | /bin/tac)<br />
-fi<br />
-<br />
-echo "Unmounting local file systems."<br />
-/bin/umount -v -a -t no,proc,sysfs<br />
-<br />
-echo "Remounting root filesystem read-only."<br />
-/bin/mount -v -n -o remount,ro /<br />
-<br />
# This never hurts:<br />
/bin/sync<br />
<br />
@@ -222,45 +170,5 @@<br />
done<br />
fi<br />
<br />
-# Deactivate LVM volume groups:<br />
-if [ -r /etc/lvmtab -o -d /etc/lvm/backup ]; then<br />
- echo "Deactivating LVM volume groups:"<br />
- /sbin/vgchange -an --ignorelockingfailure<br />
-fi<br />
-<br />
-# This never hurts again (especially since root-on-LVM always fails<br />
-# to deactivate the / logical volume... but at least it was<br />
-# remounted as read-only first)<br />
-/bin/sync<br />
-<br />
-# sleep 3 fixes problems with some hard drives that don't<br />
-# otherwise finish syncing before reboot or poweroff<br />
-/bin/sleep 3<br />
-<br />
# This is to ensure all processes have completed on SMP machines:<br />
wait<br />
-<br />
-if [ -x /sbin/genpowerd ]; then<br />
- # See if this is a powerfail situation:<br />
- if /bin/egrep -q "FAIL|SCRAM" /etc/upsstatus 2> /dev/null ; then<br />
- # Signal UPS to shut off the inverter:<br />
- /sbin/genpowerd -k<br />
- if [ ! $? = 0 ]; then<br />
- echo<br />
- echo "There was an error signaling the UPS."<br />
- echo "Perhaps you need to edit /etc/genpowerd.conf to configure"<br />
- echo "the serial line and UPS type."<br />
- # Wasting 15 seconds of precious power:<br />
- /bin/sleep 15<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Now halt (poweroff with APM or ACPI enabled kernels) or reboot.<br />
-if [ "$command" = "reboot" ]; then<br />
- echo "Rebooting."<br />
- /sbin/reboot<br />
-else<br />
- /sbin/poweroff<br />
-fi<br />
-<br />
diff -urNB rc.d-original/rc.K rc.d-patched/rc.K<br />
--- rc.d-original/rc.K 2008-12-02 21:31:48.000000000 +0100<br />
+++ rc.d-patched/rc.K 2010-12-28 17:37:41.000000000 +0100<br />
@@ -57,22 +57,6 @@<br />
/etc/rc.d/rc.nfsd stop<br />
fi<br />
<br />
-# Unmount any NFS, SMB, or CIFS filesystems:<br />
-echo "Unmounting remote filesystems."<br />
-umount -a -r -t nfs,smbfs,cifs<br />
-<br />
-# Shut down PCMCIA devices:<br />
-if [ -x /etc/rc.d/rc.pcmcia ] ; then<br />
- . /etc/rc.d/rc.pcmcia stop<br />
- # The cards might need a little extra time here to deactivate:<br />
- sleep 5<br />
-fi<br />
-<br />
-# Terminate acpid before syslog:<br />
-if [ -x /etc/rc.d/rc.acpid -a -r /var/run/acpid.pid ]; then # quit<br />
- . /etc/rc.d/rc.acpid stop<br />
-fi<br />
-<br />
# Kill all processes.<br />
echo<br />
echo "Sending all processes the SIGHUP signal."<br />
diff -urNB rc.d-original/rc.M rc.d-patched/rc.M<br />
--- rc.d-original/rc.M 2010-02-07 04:01:28.000000000 +0100<br />
+++ rc.d-patched/rc.M 2010-12-28 17:37:41.000000000 +0100<br />
@@ -20,10 +20,6 @@<br />
/sbin/ldconfig &<br />
fi<br />
<br />
-# Screen blanks after 15 minutes idle time, and powers down in one hour<br />
-# if the kernel supports APM or ACPI power management:<br />
-/bin/setterm -blank 15 -powersave powerdown -powerdown 60<br />
-<br />
# Set the hostname.<br />
if [ -r /etc/HOSTNAME ]; then<br />
/bin/hostname $(cat /etc/HOSTNAME | cut -f1 -d .)<br />
@@ -36,31 +32,6 @@<br />
# Save the contents of 'dmesg':<br />
/bin/dmesg -s 65536 > /var/log/dmesg<br />
<br />
-# Initialize PCMCIA devices:<br />
-#<br />
-# NOTE: This used to be started near the top of rc.S so that PCMCIA devices<br />
-# could be fsck'ed along with the other drives. This had some unfortunate<br />
-# side effects, however, since root isn't yet read-write, and /var might not<br />
-# even be mounted the .pid files can't be correctly written in /var/run and<br />
-# the pcmcia system can't be correctly shut down. If you want some PCMCIA<br />
-# partition to be mounted at boot (or when the card is inserted) then add<br />
-# the appropriate lines to /etc/pcmcia/scsi.opts.<br />
-#<br />
-# Note that the stuff in /etc/pcmcia/ is only for 2.4.x kernels using<br />
-# 16-bit PCMCIA cards (not 32-bit Cardbus cards!). For example, with a<br />
-# wireless card you might need to set options in /etc/pcmcia OR in<br />
-# /etc/rc.d/rc.wireless.conf, or even in /etc/rc.d/rc.inet1.conf (with<br />
-# extra options if needed for the encryption key, ESSID, etc.)<br />
-#<br />
-# Hopefully this situation will be unified in the future, but for now<br />
-# that's how it is...<br />
-#<br />
-if [ -x /etc/rc.d/rc.pcmcia ]; then<br />
- . /etc/rc.d/rc.pcmcia start<br />
- # The cards might need a little extra time here to initialize.<br />
- sleep 5<br />
-fi<br />
-<br />
# Start the system logger.<br />
if [ -x /etc/rc.d/rc.syslog -a -x /usr/sbin/syslogd -a -d /var/log ]; then<br />
. /etc/rc.d/rc.syslog start<br />
@@ -72,26 +43,11 @@<br />
/usr/bin/fc-cache -f &<br />
fi<br />
<br />
-# If we are returning from single-user mode we will need to restart<br />
-# udevd on systems that use udev:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems ; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /etc/rc.d/rc.udev start<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
# Initialize the networking hardware.<br />
if [ -x /etc/rc.d/rc.inet1 ]; then<br />
. /etc/rc.d/rc.inet1<br />
fi<br />
<br />
-# Look for additional USB/SCSI/IEEE1394/etc devices on multiple LUNs:<br />
-if [ -x /etc/rc.d/rc.scanluns ]; then<br />
- . /etc/rc.d/rc.scanluns<br />
-fi<br />
-<br />
# Start networking daemons:<br />
if [ -x /etc/rc.d/rc.inet2 ]; then<br />
. /etc/rc.d/rc.inet2<br />
@@ -118,17 +74,6 @@<br />
chmod 755 / 2> /dev/null<br />
chmod 1777 /tmp /var/tmp<br />
<br />
-# Start APM or ACPI daemon.<br />
-# If APM is enabled in the kernel, start apmd:<br />
-if [ -e /proc/apm ]; then<br />
- if [ -x /usr/sbin/apmd ]; then<br />
- echo "Starting APM daemon: /usr/sbin/apmd"<br />
- /usr/sbin/apmd<br />
- fi<br />
-elif [ -x /etc/rc.d/rc.acpid ]; then # otherwise, start acpid:<br />
- . /etc/rc.d/rc.acpid start<br />
-fi<br />
-<br />
# Update any existing icon cache files:<br />
if find /usr/share/icons 2> /dev/null | grep -q icon-theme.cache ; then<br />
for theme_dir in /usr/share/icons/* ; do<br />
@@ -161,11 +106,6 @@<br />
sh /etc/rc.d/rc.hald start<br />
fi<br />
<br />
-# Start Bluetooth:<br />
-if [ -x /etc/rc.d/rc.bluetooth ]; then<br />
- sh /etc/rc.d/rc.bluetooth start<br />
-fi<br />
-<br />
# Start wicd:<br />
if [ -x /etc/rc.d/rc.wicd ]; then<br />
sh /etc/rc.d/rc.wicd start<br />
@@ -207,36 +147,6 @@<br />
/etc/rc.d/rc.atalk<br />
fi<br />
<br />
-# Start smartd, which monitors the status of S.M.A.R.T. compatible<br />
-# hard drives and reports any problems. Note some devices (which aren't<br />
-# smart, I guess ;) will hang if probed by smartd, so it's commented out<br />
-# by default.<br />
-#if [ -x /usr/sbin/smartd ]; then<br />
-# /usr/sbin/smartd<br />
-#fi<br />
-<br />
-# If we're using udev, make /dev/cdrom and any other optical drive symlinks<br />
-# if some udev rule hasn't made them already:<br />
-if grep -wq sysfs /proc/mounts && grep -q tmpfs /proc/filesystems; then<br />
- if ! grep -wq nohotplug /proc/cmdline ; then<br />
- if [ -x /lib/udev/rc.optical-symlinks -a -x /etc/rc.d/rc.udev ]; then<br />
- /bin/sh /lib/udev/rc.optical-symlinks<br />
- fi<br />
- fi<br />
-fi<br />
-<br />
-# Monitor the UPS with genpowerd.<br />
-# To use this, uncomment this section and edit your settings in<br />
-# /etc/genpowerd.conf (serial device, UPS type, etc). For more information,<br />
-# see "man genpowerd" or the extensive documentation in the<br />
-# /usr/doc/genpower-*/ directory.<br />
-# You'll also need to configure a similar block in /etc/rc.d/rc.6 if you want<br />
-# support for stopping the UPS's inverter after the machine halts.<br />
-#if [ -x /sbin/genpowerd ]; then<br />
-# echo "Starting genpowerd daemon..."<br />
-# /sbin/genpowerd<br />
-#fi<br />
-<br />
# Turn on process accounting. To enable process accounting, make sure the<br />
# option for BSD process accounting is enabled in your kernel, and then<br />
# create the file /var/log/pacct (touch /var/log/pacct). By default, process<br />
@@ -301,11 +211,6 @@<br />
. /etc/rc.d/rc.sendmail start<br />
fi<br />
<br />
-# Load ALSA (sound) defaults:<br />
-if [ -x /etc/rc.d/rc.alsa ]; then<br />
- . /etc/rc.d/rc.alsa<br />
-fi<br />
-<br />
# Load a custom screen font if the user has an rc.font script.<br />
if [ -x /etc/rc.d/rc.font ]; then<br />
. /etc/rc.d/rc.font<br />
@@ -337,11 +242,6 @@<br />
. /etc/rc.d/rc.samba start<br />
fi<br />
<br />
-# Start the GPM mouse server:<br />
-if [ -x /etc/rc.d/rc.gpm ]; then<br />
- . /etc/rc.d/rc.gpm start<br />
-fi<br />
-<br />
# If there are SystemV init scripts for this runlevel, run them.<br />
if [ -x /etc/rc.d/rc.sysvinit ]; then<br />
. /etc/rc.d/rc.sysvinit<br />
diff -urNB rc.d-original/rc.inet2 rc.d-patched/rc.inet2<br />
--- rc.d-original/rc.inet2 2007-09-18 00:07:32.000000000 +0200<br />
+++ rc.d-patched/rc.inet2 2010-12-28 17:37:41.000000000 +0100<br />
@@ -15,27 +15,6 @@<br />
<br />
# At this point, we are ready to talk to The World...<br />
<br />
-<br />
-# Mount remote (NFS) filesystems:<br />
-if cat /etc/fstab | grep -v '^#' | grep -w nfs 1> /dev/null 2> /dev/null ; then<br />
- # Start rpc.portmap, /sbin/rpc.lockd, and /sbin/rpc.statd if we find NFS<br />
- # volumes defined in /etc/fstab since these will need to be running in order<br />
- # to mount them. If they are not running, attempting to mount an NFS<br />
- # partition will cause mount to hang, or at least result in unreliable<br />
- # operation. Keep this in mind if you plan to mount unlisted NFS<br />
- # partitions... <br />
- # If you have uncommented NFS partitions in your /etc/fstab, rc.rpc is run<br />
- # whether it is set as executable or not. If you don't want to run it,<br />
- # comment the NFS partitions out in /etc/fstab or erase/rename rc.rpc.<br />
- if [ -r /etc/rc.d/rc.rpc ]; then<br />
- sh /etc/rc.d/rc.rpc start<br />
- fi<br />
- echo "Mounting remote (NFS) file systems: /sbin/mount -a -t nfs"<br />
- /sbin/mount -a -t nfs # This may be our /usr runtime!<br />
- # Show the mounted volumes:<br />
- /sbin/mount -v -t nfs<br />
-fi<br />
-<br />
# If /etc/rc.d/rc.rpc is executable, run it to load rpc.portmap, rpc.lockd,<br />
# and rpc.statd. This might be needed to mount NFS partitions that are not<br />
# listed in /etc/fstab. Starting this twice won't hurt as the script will<br />
</pre><br />
<br />
== Slackware package list ==<br />
Here is the content of the file [http://notes.sagredo.eu/sites/notes.sagredo.eu/files/linux-vserver/PKG_LIST PKG_LIST]<br />
<pre><br />
# v. 2011.01.07<br />
# some commented pkg to avoid duplicates (man will download both man and man-pages)<br />
<br />
#[A]<br />
a/aaa_base<br />
a/aaa_elflibs<br />
a/aaa_terminfo<br />
a/acl<br />
a/attr<br />
a/bash<br />
a/bin<br />
a/bzip2<br />
a/coreutils<br />
a/cpio<br />
a/cxxlibs<br />
a/dcron<br />
a/dialog<br />
a/etc<br />
a/file<br />
a/findutils<br />
a/gawk<br />
a/gettext<br />
a/glibc-solibs<br />
a/glibc-zoneinfo<br />
a/grep<br />
a/gzip<br />
a/infozip<br />
a/kbd<br />
a/less<br />
a/logrotate<br />
a/openssl-solibs<br />
a/patch<br />
a/pkgtools<br />
a/procps<br />
a/quota<br />
a/sed<br />
a/shadow<br />
a/slocate<br />
a/sysklogd<br />
a/sysvinit<br />
# a/sysvinit-functions<br />
# a/sysvinit-scripts<br />
a/tar<br />
a/time<br />
a/tree<br />
a/utempter<br />
a/util-linux<br />
a/xz<br />
a/which<br />
<br />
#[AP]<br />
ap/at<br />
ap/diffutils<br />
ap/groff<br />
ap/lsof<br />
ap/man<br />
# ap/man-pages<br />
ap/most<br />
ap/nano<br />
ap/sudo<br />
ap/vim<br />
<br />
#[D]<br />
d/autoconf<br />
d/automake<br />
d/binutils<br />
d/bison<br />
d/flex<br />
d/gcc-4<br />
d/gcc-g++<br />
d/gettext-tools<br />
d/kernel-headers<br />
d/libtool<br />
d/m4<br />
d/make<br />
d/perl<br />
d/pkg-config<br />
<br />
#[L]<br />
l/apr<br />
l/db42<br />
l/db44<br />
l/freetype<br />
l/gd-<br />
l/gdbm<br />
l/glibc<br />
# l/glibc-i18n<br />
l/libjpeg<br />
l/libmcrypt<br />
l/libpng<br />
l/lzo<br />
l/mpfr<br />
l/ncurses<br />
l/pcre<br />
l/popt<br />
l/readline<br />
l/v4l-utils<br />
l/libxslt<br />
l/t1lib<br />
l/zlib<br />
<br />
#[N]<br />
n/cyrus-sasl<br />
n/inetd<br />
n/iproute2<br />
n/iputils<br />
n/libgcrypt<br />
n/mtr<br />
n/net-tools<br />
n/netwatch<br />
n/network-scripts<br />
n/ntp<br />
n/openssh<br />
n/openssl<br />
n/tcp_wrappers<br />
n/telnet<br />
n/traceroute<br />
n/wget<br />
</pre></div>
Roberto.puzzanghera