KVM guest // NetBSD

assuming kvm is up and running already

Serial right away

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

rel=9.2
shortrel=92

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

    osinfo-query os | grep netbsd | tail -2
    variant=...

mkdir -p /data/guests/netbsd92/
cd /data/guests/netbsd92/
grep ^proc /proc/cpuinfo
virt-install \
    --name netbsd92 \
    --vcpus 2 \
    --ram 256 \
    --disk path=/data/guests/netbsd92/netbsd92.qcow2,size=2,bus=virtio \
    --cdrom /data/ISO-IMAGES/netbsd92/boot-com.iso \
    --network bridge=virbr0,model=virtio \
    --os-variant $variant \
        --graphics none \
        --console pty,target_type=serial

    # --virt-type kvm \
            # --accelerate \
            # --arch x86_64 \
            # --machine pc \ # not q35
            # --cpu host-passthrough \
            # --cpu host \

you should already get the console right away. stop the installer and reach your LAN.

^C
dhcpcd # vioif0

then start the installer again and proceed with installation

sysinst

xterm
MBR
use entire disk
default partitions
serial port com0
baud rate: 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
delete after install: yes

shell: ksh
enable sshd
disable raidframe

reboot

ready to go

virsh start netbsd92 --console

vi /etc/ifconfig.vioif0

inet 192.168.122.9/24 up

vi /etc/mygate

192.168.122.1

vi /etc/myname

netbsd92

vi /etc/hosts

192.168.122.9   netbsd92

vi /etc/resolv.conf

search example.local
nameserver 208.67.222.222
nameserver 208.67.220.220

disable vga console altogether (wscons)

mv -i /etc/rc.conf /etc/rc.conf.dist
vi /etc/rc.conf

. /etc/defaults/rc.conf
rc_configured=yes
sshd=yes
raidframe=no
wscons=no

shutdown -p now

VNC then serial

launch the installation with graphics to switch to serial thereafter

guest=netbsd91

virt-install \
    --name $guest \
    --vcpus 2 \
    --ram 256 \
    --disk path=/data/kvm/$guest.qcow2,size=2,bus=virtio \
    --cdrom /data/ISO-IMAGES/NetBSD-9.1-amd64.iso \
    --network bridge=virbr0,model=virtio \
        --graphics vnc \
        --console pty,target_type=serial

    # --graphics vnc,port=5999 \
    # --os-type generic \
    # --os-variant generic \

com0/115200 boot blocks

/bin/ksh
no cgd
no raidframe

and in case you need to add some nic

virsh edit $guest

    <interface type='bridge'>
      <source bridge='dummybr0'/>
      <model type='virtio'/>
    </interface>

the MAC address will be defined and XML config will be updated accordingly

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


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