assuming the host is up and running already
tested on focal and hirsute
boostrapping slackware on a vdisk (not a partition image for once)
We will need pkgtools
so we’re brutally installing it on Ubuntu, however it overrides the /sbin
symlink so be careful
mirror=... lftp -c "open $mirror/slackware64/a/; mget pkgtools-*.txz" mkdir /var/tmp/pkgtools/ tar xaf pkgtools-*.txz -C /var/tmp/pkgtools/ mv -f /var/tmp/pkgtools/sbin/* /usr/local/sbin/ grep 21 /etc/group groupdel fax groupadd -g 21 slocate grep ^slocate /etc/group
We use SYSLINUX / EXTLINUX against the guest virtual disk from the host
apt install syslinux
assuming you got dummybr0
bridge up and running
KVM requires a boot-loader hence a full virtual disk
as root
guest=slack150 mkdir -p /data/guests/$guest/lala/ cd /data/guests/$guest/ dd if=/dev/zero of=$guest.img bs=1GB count=0 seek=25 fdisk $guest.img n p ENTER ENTER ENTER a w loop=`losetup --find --partscan --show $guest.img` echo loop is $loop mkfs.ext4 ${loop}p1 #mkfs.xfs ${loop}p1 mount ${loop}p1 lala/
from the KVM host directly
brutal network setup – you can get the script from there
../slackbrutal.bash x.x.x.9/24 x.x.x.254 $guest
setup the kvm guest boot-loader and kernel-time serial console
dd if=/usr/lib/syslinux/mbr/mbr.bin of=$loop mkdir lala/boot/syslinux/ extlinux --install lala/boot/syslinux/ --device ${loop}p1 cp -f /usr/lib/syslinux/modules/bios/mboot.c32 lala/boot/syslinux/ cp -f /usr/lib/syslinux/modules/bios/libcom32.c32 lala/boot/syslinux/ vi lala/boot/syslinux/syslinux.cfg serial 0 115200 console 1 nohalt 1 default Linux prompt 1 timeout 30 label Linux linux /boot/vmlinuz append root=/dev/vda1 ro console=ttyS0,115200n8 mitigations=off
umount lala/ rmdir lala/ #dumpe2fs -i /dev/loop3p1 #dumpe2fs -h /dev/loop3p1 #fsck.ext4 -f /dev/loop3p1 # requires more recent syslinux than v3 on ubuntu #xfs_info /dev/loop3p1 losetup --detach ${loop} du -sh $guest.img
choose a decent machine type
qemu-system-x86_64 -machine help | grep PC pc-i440fx-hirsute Ubuntu 21.04 PC (i440FX + PIIX, 1996) (default) pc Standard PC (i440FX + PIIX, 1996) (alias of pc-i440fx-5.2) q35 Standard PC (Q35 + ICH9, 2009) (alias of pc-q35-5.2)
new UUID and MAC address will be generated on the fly
grep ^proc /proc/cpuinfo
cat > $guest.xml <<EOF <domain type='kvm'> <name>$guest</name> <memory unit='GiB'>1</memory> <vcpu placement='static'>3</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='raw'/> <source file='/data/guests/$guest/$guest.img'/> <target dev='vda' bus='virtio'/> </disk> <interface type='bridge'> <source bridge='virbr0'/> <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
Note you might need more than 1 GiB for a power/building system.
virsh create /data/guests/$guest/$guest.xml --console TAB --> to get the chance to see the syslinux prompt (login) ping -c1 opendns.com ^]
clone the machine already
poweroff cd ../ cp -R --sparse=always slack/ slack-clone/ vi slack-clone/slack.xml <name>slack-clone</name> <source file='/data/guests/slack-clone/slack.img'/> du -sh slack*/
and proceed
virsh create slack-clone/slack.xml virsh console slack-clone vi /etc/HOSTNAME vi /etc/hosts vi /etc/rc.d/rc.inet1 (change static ip) reboot ping -c1 opendns.com ^]
virsh list # should NOT run losetup -a # already mapped? losetup --find --partscan --show $guest.img fsck /dev/loop3p1 mount /dev/loop3p1 lala/
... umount -R lala/ losetup --detach /dev/loop3
"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?…
virsh shutdown
worksQemuKVMMigration 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