KVM guest // NetBSD

assuming the host is up and running already

serial port right away

use the boot-com.iso to start from serial console right away! (83M instead of 374M for the full one)

    osinfo-query os | grep netbsd | tail

rel=10.0_RC5
shortrel=100
    variant=netbsd9.0

echo $rel
echo $shortrel
echo $variant

mkdir -p /data/ISO-IMAGES/netbsd$shortrel/
cd /data/ISO-IMAGES/netbsd$shortrel/
rm -f boot-com.iso
wget http://ftp.fr.netbsd.org/pub/NetBSD/NetBSD-$rel/amd64/installation/cdrom/boot-com.iso

mkdir -p /data/guests/netbsd$shortrel/
cd /data/guests/netbsd$shortrel/

start clean

virsh list --all
losetup --all
rm -f netbsd100.img

create the guest – start the installer

grep ^proc /proc/cpuinfo
export TERM=vt100
virt-install \
    --name netbsd$shortrel \
    --vcpus 2 \
    --ram 256 \
    --disk path=/data/guests/netbsd$shortrel/netbsd$shortrel.img,format=raw,size=10,bus=virtio \
    --cdrom /data/ISO-IMAGES/netbsd$shortrel/boot-com.iso \
    --network bridge=virbr0,model=virtio \
    --os-variant $variant \
        --graphics none \
        --console pty,target_type=serial


    #   --graphics vnc,port=5900 \

    #--disk path=/data/guests/netbsd$shortrel/netbsd$shortrel.qcow2,format=qcow2,size=10,bus=virtio \

    # --virt-type kvm \
            # --accelerate \
            # --arch x86_64 \
            # --cpu host-passthrough \
            # --cpu host \

            # --machine pc \ # not q35
    # --os-type generic \
    # --os-variant generic \

you should already get the console right away

Terminal type (just hit ENTER for 'vt220'): vt100

ld0 (10G)
MBR
use entire disk
default partition sizes

serial port com0
baud rate: 115200 vs. BIOS?
installation without x11

the only drawback with this method is that you will have to provide another source than CDROM as for the installation sets e.g. through network

HTTP
(NO DHCP HERE UNLESS YOU HAVE THE DEFAULT VIRT-NETWORK SETUP! avoid the 169.254 subnet non-sense!)

delete after install: yes

keep network setup? no

(no password)

timezone: MSK
shell: ksh
enable sshd
disable raidframe

reboot

guest tuning

see guest-netbsd-tuning and you’re good for a template

ls -lhF *qcow2
ls -lhF *img

for some reason the sparse was not taken into account

#time qemu-img convert -f qcow2 -O qcow2 -S 1024 netbsd100.qcow2 netbsd100fix.qcow2
#mv -f netbsd100fix.qcow2 netbsd100.qcow2

convert the file-system sparse to qcow2 for easy upload

time qemu-img convert -f raw -O qcow2 -S 1024 netbsd100ext2fs.img netbsd100ext2fsfix.qcow2
mv -f netbsd100ext2fsfix.qcow2 netbsd100ext2fs.qcow2
# 0m33,237s on alpha15

yandex cloud

object storage -- buckets -- YOUR-BUCKET -- Upload (top-right corner)

then create a VM image based on that S3 object

yc --profile PROFILE \
    compute image create \
        --name netbsd100 \
        --source-uri https://storage.yandexcloud.net/YOUR-BUCKET/netbsd100.qcow2

troubleshooting

when choosing type Linux Ext2

No bootcode for specified FS type of root partition

==> proceed manually instead

resources

https://raymii.org/s/articles/virt-install_introduction_and_copy_paste_distro_install_commands.html#Generic_ISO

https://imil.net/blog/2016/01/29/netbsdamd64-7-0-kvm/

http://mikhailian.mova.org/node/81

https://wiki.qemu.org/Hosts/BSD

https://www.qemu.org/docs/master/tools/qemu-img.html

https://superuser.com/questions/1448820/set-qcow2-image-size-at-install-time

yandex cloud

https://cloud.yandex.com/en/docs/compute/operations/image-create/custom-image

https://cloud.yandex.com/en/docs/compute/operations/image-create/upload

https://cloud.yandex.com/en/docs/storage/operations/objects/upload

https://cloud.yandex.com/en/docs/compute/concepts/image#images-optimized-for-deployment


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun