Overall Requirements

Assuming the domU kernel has already been prepared.

The dirty way (preferred)

Warning: this will only work on a Slackware system (installpkg and removepkg)

Fetching the necessary sets,

mkdir -p /data/media/slackware/142
cd /data/media/slackware/142

lftp $repo #yes even for http

mirror -c -e a
mirror -c -e ap
mirror -c -e d
mirror -c -e f
mirror -c -e k
mirror -c -e l
mirror -c -e n

Preparing the guest configuration,

mkdir -p /data/guests/slack/
cd /data/guests/slack/
vi slack

kernel = "/data/kernels/vmlinuz.4.4.88.domu"
root = "/dev/xvda1 ro console=hvc0"
#extra = "init=/bin/bash"
name = "slack"
memory = "256"
vcpus = "2"
disk = ['file:/data/guests/slack/slack.img,xvda1,w']
vif = [ 'bridge=xenbr0, vifname=slack.0' ]

Preparing the filesystem,

dd if=/dev/zero of=slack.img bs=1024k count=0 seek=10240
mkfs.ext4 slack.img
#dd if=/dev/zero of=slack.swap bs=1024k count=0 seek=2048
#mkswap slack.swap
mkdir -p /tmp/slack/
mount -o loop slack.img /tmp/slack/

cd /data/guests/
wget https://raw.githubusercontent.com/pbraun9/bin/master/slackware.install.bash
chmod +x slackware.install.bash
grep ^repo slackware.install.bash
ls -lhF /data/media/slackware/142/
mount | grep slack

ls -lhFd /tmp/slack/dev/pts/ # exists
ls -lhFd /tmp/slack/dev/shm/ # exists
ls -lhF /tmp/slack/etc/fstab # does not exist yet

cat > /tmp/slack/etc/fstab <<-EOF
/dev/xvda1       /                ext4         defaults         1   1
#/dev/xvda2       swap             swap        defaults         0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
tmpfs            /dev/shm         tmpfs       defaults         0   0
cat /tmp/slack/etc/fstab

#REC chmod -x /tmp/slack/etc/rc.d/rc.consolekit 
#REC chmod -x /tmp/slack/etc/rc.d/rc.inetd
chmod -x /tmp/slack/etc/rc.d/rc.modules
chmod +x /tmp/slack/etc/rc.d/rc.udev

to avoid keys generated for darkstar,

#REC installed with the script
chmod -x /tmp/slack/etc/rc.d/rc.sshd
echo slack > /tmp/slack/etc/HOSTNAME
#ls -lhF /tmp/slack/etc/ssh/ssh_host_*
#rm -fv /tmp/slack/etc/ssh/ssh_host_*

cp -pi /tmp/slack/etc/rc.d/rc.S /tmp/slack/root/rc.S.dist
vi /tmp/slack/etc/rc.d/rc.S

/tick #remove hwclock with it

cp -pi /tmp/slack/etc/rc.d/rc.M /tmp/slack/root/rc.M.dist
vi /tmp/slack/etc/rc.d/rc.M

/powersave #remove
/icon #remove
/GTK #remove

fix the xen guest serial console,

ls -lhF /tmp/slack/sbin/agetty
ls -lhF /tmp/slack/etc/securetty
ls -lhF  /tmp/slack/etc/termcap
cp -pi /tmp/slack/etc/inittab /tmp/slack/etc/inittab.dist
vi /tmp/slack/etc/inittab

#c1:12345:respawn:/sbin/agetty --noclear 38400 tty1 linux
c1:12345:respawn:/sbin/agetty --noclear 115200,38400,9600 hvc0 linux

echo hvc0 >> /tmp/slack/etc/securetty

ready to go,

umount /tmp/slack/
cd /data/guests/slack/
xl create slack -c

what a pleasure, a clean minimal gnu/linux distro,

Going multiuser...
Updating shared library links:  /sbin/ldconfig &
Starting sysklogd daemons:  /usr/sbin/syslogd ; /usr/sbin/klogd -c 3 -x
Triggering udev to write persistent rules to /etc/udev/rules.d/
Updating hardware database index:  /sbin/udevadm hwdb --update
Triggering udev events:  /sbin/udevadm trigger --action=change

The classical way (full disk)

Preparing the vdisk,

mkdir -p /data/guests/slackfull/
cd /data/guests/slackfull/

dd if=/dev/zero of=slackfull.disk bs=1024k count=0 seek=10240

Grabbing the installer initrd,

wget -O - http://x.x.x.x/slackware64/142/isolinux/initrd.img > ../slackware.initrd.img

Setting up the guest,

cat > slackfull <<-EOF
kernel = "/data/guests/vmlinuz.4.4.14.domu"
#root = "/dev/xvda1 ro console=hvc0 init=/bin/bash"
root = "/dev/xvda1 ro console=hvc0"
ramdisk = "/data/guests/slackware.initrd.img"
name = "slackfull"
memory = "256"
vcpus = "2"
disk = ['file:/data/guests/slackfull/slackfull.disk,xvda,w']
vif = [ 'bridge=xenbr0, vifname=slackfull.0' ]
#extra = "load_ramdisk=1 prompt_ramdisk=0 rw"

Launching the guest and installer,

xl create slackfull -c

dhcpcd eth0
ping x.x.x.x

cfdisk /dev/xvda

Note. also see the section about setting up the xen serial console above, you might want to do that against /mnt/ on a secondary console during the installation.

troubleshooting the guest (both flavors)

vi slackfull // vi slack

root = "/dev/xvda1 ro console=hvc0 init=/bin/bash"

mount -o remount,rw /
export TERM=xterm
dmesg | grep hvc


mount -n -o remount,ro /
halt -p


mount: mount point /dev/pts does not exist
mount: mount point /dev/shm does not exist

==> enabled rc.udev

interesting shit happens when you install the l and n sets before a and ap, for the record,

installpkg --root /tmp/slack slackware64/l/glibc-2.23-x86_64-1.txz...sbin/ldconfig: Warning: ignoring configuration file that cannot be opened: /etc/ld.so.conf: No such file or directory

installpkg --root /tmp/slack slackware64/l/polkit-0.113-x86_64-2.txz...grep: etc/passwd: No such file or directory
grep: etc/group: No such file or directory

installpkg --root /tmp/slack slackware64/n/openssh-7.2p2-x86_64-1.txz...grep: etc/shadow: No such file or directory


fix (at boot time),

setterm: linux: unknown terminal type

Ref. http://www.unixguide.net/linux/faq/09.02.shtml




no need for modules

#tar tvzf vmlinuz.4.4.14.domu.modules.tar.gz
#tar xzf vmlinuz.4.4.14.domu.modules.tar.gz -C /tmp/slack/