Installation on Slackware 13

From Linux-VServer

Revision as of 21:49, 28 October 2010 by Roberto.puzzanghera (Talk | contribs)

Jump to: navigation, search

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


Download the patch and the installer script

cd /usr/local/src
tar xzf slack_vserver.tar.gz
chown -R root.root slack_vserver

  • slackware-13.1.patch is the patch which modify rc.0 rc.6 rc.M rc.K and rc.inet2. It must be applyed after the creation of the guest. In the patch I switched off all the executable that are related to the hardware, including the rc.inet1, and rc.6. Inside rc./d/init.d/ you can find the rc script that starts the vserver. Comments would be welcome about this :-).
  • is the shell script that you have to adjust. It installs the guest.
  • rc is the startup script for the virtual server. It will be automatically copied in /etc/rc.d/init.d/rc
  • PKG_LIST is my Slackware package list
  • is a script that you can use to download all the PKG_LIST

Download the slack packages

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

Create a folder where to store the Slackware packages to install in the new server.

mkdir slackware 
cd slackware

If you decide to download the packages via ftp, create here a file PKG_LIST with the packages' list inside.

To download the packages you can use a script like this:

if [ -f $LIST ]; then
        while read line  
            wget "$SRC$line*.t?z"
        done < $LIST

Adjust the packages' list, enter your favorite ftp server and run from the command line.

Make the guest

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

This is done running the script that you downloaded before. Edit the file and adjust it to your needs.

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

Note that /etc/resolv.conf /etc/localtime /etc/profile are copied form the host. Run it to install the server and all the packages you downloaded.

Apply the patch and start the guest

Once you have installed the server apply the patch:

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

vserver <vserver_name> start
vserver <vserver_name> enter


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

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


Any comment/suggestion/question to roberto.puzzanghera at sagredo dot eu, [1]

Personal tools