Powered by SmartDoc

3.3 NetBSD VM を作ってみよう

  1. まずsysutils/grub2-bhyveを入れる
    # cd /var/ports/bhykx/sysutils/grub2-bhyve
    # make install
    
  2. テンプレート(netbsd7.conf)の作成
    # sed -Ee 's/^(network0_switch=).*$/\1"local"/' \
        /vm/.templates/netbsd.conf > /vm/.templates/netbsd7.conf
    # cat /vm/.templates/netbsd7.conf
    loader="grub"
    cpu=1
    memory=256M
    network0_type="virtio-net"
    network0_switch="local"
    disk0_type="virtio-blk"
    disk0_name="disk0.img"
    grub_install0="knetbsd -h -r cd0a /netbsd"
    grub_run0="knetbsd -h -r ld0a /netbsd"
    root@vm:~ # 
    
  3. ISOイメージをダウンロード
    # vm iso \
        ftp://ftp.netbsd.org/pub/NetBSD/images/7.0.2/NetBSD-7.0.2-amd64.iso \
    #
    
  4. ゲスト(netbsd)の作成
    # vm create -t netbsd7 netbsd
    # ll /vm/netbsd/
    total 1
    -rw-r--r--  1 root  wheel  34359738368 Dec  6 07:33 disk0.img
    -r--r--r--  1 root  wheel          178 Dec  6 07:33 tbedfc.conf
    # cat /vm/netbsd/netbsd.conf 
    loader="grub"
    cpu=1
    memory=256M
    network0_type="virtio-net"
    network0_switch="local"
    disk0_type="virtio-blk"
    disk0_name="disk0.img"
    grub_install0="knetbsd -h -r cd0a /netbsd"
    grub_run0="knetbsd -h -r ld0a /netbsd"
    uuid="d3a5e6af-bc18-11e6-8698-003048dcbe58"
    # mkdir /boot/grub
    # cp \
        /var/ports/usr/ports/sysutils/grub2-bhyve/work/grub2-bhyve-0.40/grub-core/tests/boot/* \
        /boot/grub/
    # vm install netbsd NetBSD-7.0.2-amd64.iso
    Starting netbsd
    * found guest in /vm/netbsd
    ! no unrestricted guest support in cpu. only single vcpu FreeBSD \
        guests supported
    root@vm:~ # 
    % egrep -RnH 'no unrestricted guest support in cpu' \
        /usr/local/lib/vm-bhyve/
    /usr/local/lib/vm-bhyve/vm-core:427: echo " ! no unrestricted \
        guest support in cpu. only single vcpu FreeBSD guests \
        supported"
    /usr/local/lib/vm-bhyve/vm-core.org:425: echo " ! no unrestricted \
        guest support in cpu. only single vcpu FreeBSD guests \
        supported"
    %