Nethence Newdoc Olddoc Lab Your IP BBDock  

XEN guest // Slackware Linux


The domU kernel has already been prepared.

The dirty way (preferred)

Fetching the necessary sets,

mkdir -p /data/guests/slackware64/
cd /data/guests/slackware64/

lftp $repo #yes even for http

mirror -c -e a
mirror -c -e ap
mirror -c -e n
mirror -c -e d
mirror -c -e f
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 init=/bin/bash"
root = "/dev/xvda1 ro console=hvc0"
name = "slack"
memory = "256"
vcpus = "2"
disk = ['file:/data/guests/slack/slack.img,xvda1,w']
#        'file:/data/guests/slack/slack.swap,xvda2,w']
vif = [ 'bridge=xenbr0, vifname=slack.0' ]

Preparing the filesystem,

cd /data/guests/slack/

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/
chmod +x slackware.install.bash
ls -lhdF slackware64/
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

chmod -x /tmp/slack/etc/rc.d/rc.consolekit 
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,

chmod -x /tmp/slack/etc/rc.d/rc.sshd
echo slacktpl > /tmp/slack/etc/HOSTNAME
#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

diff -bu /tmp/slack/root/rc.S.dist /tmp/slack/etc/rc.d/rc.S

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

diff -bu /tmp/slack/root/rc.M.dist /tmp/slack/etc/rc.d/rc.M

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



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

==> enabled rc.udev

todo. urandom

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/ 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

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


fix (at boot time),

setterm: linux: unknown terminal type


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

Home | GitHub | Docker Hub | Donate | Contact