kvm | dedibox | memstick | xen
we cannot use LILO here as it would require the /dev/vda device to be available within the chroot.
so instead, we go for SYSLINUX.
assuming the kvm hypervisor is up and running already
– also ssuming you got kvmbr0 bridge
# not necessarily using virsh #virsh net-start default #virsh net-list brctl show
we need pkgtools so we’re able to brutally install slackware from a debian/ubuntu kvm host
– however it overrides the sbin -> usr/sbin symlink so we’re extracting the package elsewhere
#mirror=http://ftp.tu-chemnitz.de/pub/linux/slackware/slackware64-current mirror=http://mirror.rol.ru/slackware/slackware64-current lftp -c "open $mirror/slackware64/a/; mget pkgtools-*.txz" mkdir /var/tmp/pkgtools/ tar xaf pkgtools-*.txz -C /var/tmp/pkgtools/ mv -fv /var/tmp/pkgtools/sbin/* /usr/local/sbin/ rm -rf /var/tmp/pkgtools/ grep :21: /etc/group groupdel fax groupadd -g 21 slocate
which installpkg mirror=`grep -vE '^#|^$' /etc/slackpkg/mirrors`
KVM requires a boot-loader hence a full virtual disk – also we need QCOW2 not a self-made sparse file for GNS3 guest template not to copy the entire thing…
as root
guest=slack150 mkdir -p /data/guests/$guest/lala/ cd /data/guests/$guest/ qemu-img create -f qcow2 $guest.qcow2 25G modprobe nbd max_part=8 device=/dev/nbd0 qemu-nbd --connect=$device $guest.qcow2
manual partitioning
cfdisk $device
(dos)
${device}p1 bootable Linux 24G
${device}p2 Linux swap 1G
formatting
ls -lhF ll $device*
mkfs.ext4 ${device}p1
mkswap ${device}p2
in case you’re using a recent system (here ubuntu 25), you might need to downgrade the target filesystem, as e2fsck version is older on slackware
# memstick - /dev/sdbX
tune2fs -l ${device}1
tune2fs -O ^orphan_file ${device}1
# kvm - /dev/nbd0pX
tune2fs -l ${device}p1
tune2fs -O ^orphan_file ${device}p1
you might also want to hardcode a precise disk identifier in view to define PARTUUID
e.g. for node 99
fdisk $device
x
i
0xf9a43099
r
w
blkid ${device}1
blkid ${device}p1
==> check PARTUUID
and finally mount the thing
mount ${device}p1 lala/
grab the scripts and sample conf file
wget https://pub.nethence.com/bin/slackstart/slackdisk.bash wget https://pub.nethence.com/bin/slackstart/slacknet.bash wget https://pub.nethence.com/bin/slackstart/slackprep.bash wget https://pub.nethence.com/bin/slackstart/slackstart.conf.sample wget https://pub.nethence.com/bin/slackstart/slackstrap.bash chmod +x slack*bash
vi slackstart.conf mirror=http://mirror.rol.ru/slackware/slackware64-15.0/
and proceed
# https://pub.nethence.com/bin/slackstart/slackstrap.bash time ./slackstrap.bash lala
if this is a REISER4 file-system, let the guest eventually fsck itself at boot time
wget https://lab.nethence.com/slackpkgs/libaal-1.0.7-x86_64-2_SBo.tgz
wget https://lab.nethence.com/slackpkgs/reiser4progs-1.2.2-x86_64-2_SBo.tgz
ls -lF /root/slackpkgs/libaal-*_SBo.tgz
ls -lF /root/slackpkgs/reiser4progs-*_SBo.tgz
installpkg --terse --root lala/ /root/slackpkgs/libaal-*_SBo.tgz
installpkg --terse --root lala/ /root/slackpkgs/reiser4progs-*_SBo.tgz
since this is either bare-metal or a kvm guest, make sure you include a kernel in the disk image
# https://pub.nethence.com/bin/slackstart/slackstrap.bash time ./slackstrap.bash lala kernel
you need a custom kernel in there and not necessarily the stock one
# todo - tweak that script to avoid installing the stock kernel time ./slackstrap.bash lala kernel
here’s a few custom ones:
cd lala/ # https://lab.nethence.com/nunux/hbamode-and-mass-storage/ cp -f /tftpboot/vmlinuz.hbamode ./ cp -f /tftpboot/vmlinuz.hbamode.config ./ ln -s vmlinuz.hbamode vmlinuz
mkdir -p lib/modules/ cd lib/modules/ cp -f /tftpboot/vmlinuz.hbamode.5.18.19.tar.gz ./ tar xzf vmlinuz.hbamode.5.18.19.tar.gz
cd lala/ wget https://lab.nethence.com/nunux/dom0/5.18.19.xen-ufs-usb.config wget https://lab.nethence.com/nunux/dom0/5.18.19.xen-ufs-usb.vmlinuz ln -s 5.18.19.xen-ufs-usb.vmlinuz vmlinuz
mkdir -p lib/modules/ cd lib/modules/ wget https://lab.nethence.com/nunux/dom0/5.18.19.xen-ufs-usb.modules.tar.gz tar xzf 5.18.19.xen-ufs-usb.modules.tar.gz
cd ../../../
timezone, mount points and console
slackstrap is not enough for syslinux to be happy (probably fstab is required) – so the syslinux part comes within that script
vi slackstart.conf tz=Europe/Moscow fs=ext4 # kvm (don't worry it will find /dev/nbd0 by itself) boot_partition=/dev/vda1 swap_partition=/dev/vda2 boot_uuid=f9a43099-01 swap_uuid=f9a43099-02 serial=ttyS0 swap=1 boot=syslinux
proceed
# https://pub.nethence.com/bin/slackstart/slackprep.bash ./slackprep.bash lala
eventually update the package repository cache
mv -i lala/etc/slackpkg/mirrors lala/etc/slackpkg/mirrors.dist source slackstart.conf echo $mirror echo $mirror > lala/etc/slackpkg/mirrors mount -o bind /dev lala/dev mount -o bind /dev/pts lala/dev/pts mount -o bind /proc lala/proc mount -o bind /sys lala/sys chroot lala/ bash ping -c1 1.1.1.1 vi lala/etc/resolv.conf ... ping -c1 opendns.com slackpkg update gpg slackpkg update history -c ^D rm -f lala/root/.bash_history
eventually proceed with a brutal network setup
vi slackstart.conf host=slack150 cidr=192.168.122.99/24 gw=192.168.122.1 dns=192.168.122.1 # https://pub.nethence.com/bin/slackstart/slacknet.bash ./slacknet.bash lala
du -sh lala/ sync umount -R lala/ rmdir lala/ qemu-nbd --disconnect $device ls -lhF $guest.qcow2 du -sh $guest.qcow2
choose a decent machine type (q35 is newer and supposedly better/simplier)
qemu-system-x86_64 -machine help | grep PC pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-6.2) q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-6.2)
new UUID and MAC address will be generated on the fly
cat > $guest.xml <<EOF
<domain type='kvm'>
<name>$guest</name>
<memory unit='GiB'>1</memory>
<vcpu placement='static'>1</vcpu>
<os>
<type arch='x86_64' machine='q35'>hvm</type>
<boot dev='hd'/>
</os>
<devices>
<emulator>/usr/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/data/guests/$guest/$guest.qcow2'/>
<target dev='vda' bus='virtio'/>
</disk>
<interface type='bridge'>
<source bridge='kvmbr0'/>
<model type='virtio'/>
</interface>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
</devices>
</domain>
EOF
virsh create $guest.xml --console TAB --> to get the chance to see the syslinux prompt (login) ping -c1 opendns.com ^]
"Error: AppArmor parser not found" ERROR: Can't find apparmor_parser at /sbin/apparmor_parser
==> /sbin is a symlink since focal, did you mess it up by installing pkgtools?…
while attempting to boot the guest
(nothing shows up on console output)
==> make sure you’ve deployed the syslinux boot-blocks on the right disk (nbd0 not ndb0…)
QemuKVMMigration https://wiki.ubuntu.com/QemuKVMMigration
QEMU Unsupported Machine Type ‘pc-q35-3.1’ https://forum.level1techs.com/t/qemu-unsupported-machine-type-pc-q35-3-1/140084
How can I change Qemu KVM machine architecture from 440fx to q35 with virsh edit or virt-manager https://serverfault.com/questions/637917/how-can-i-change-qemu-kvm-machine-architecture-from-440fx-to-q35-with-virsh-edit