bhyve mit OpenBSD-Gast

h^2

hat ne Keule +1
Hallo Leute,

ich möchte gerne eine OpenBSD-Gast auf meinem FreeBSD haben. Ich brauch kein PCIe-Passthrough, kein Video oder sonst etwas. Eigentlich noch nichtmal "serial"-Zugang, ssh reicht nach der Installation.
Ich habe schon ein wenig danach gesucht, aber sehr viele unterschiedliche Dinge gelesen, entweder wesentlich kompliziertere Setups oder relativ alte Quellen bei denen es hieß, dass sich das noch ändern würde. Es hieß an anderen Stellen auch, dass man OpenBSD noch garnicht installieren kann mit bhyve und es stattdessen mit Qemu installieren muss und dann das Image laden kann...
Im Handbuch steht leider nur was zu FreeBSD- und Linux-Gästen, und da die command-line für Linux schon lang und obskur genug ist (im Vergleich zu QEmu), ist das bestimmt nicht so ohne weiteres übertragbar.

Kurz: gibt es dazu irgendwo schon gute Doku? Oder habt ihr das in letzter Zeit mal ausprobiert?

Danke und Gruß,
h^2
 
Ich habe es vor einigen Monaten mal probiert, da im IRC danach gefragt wurde. Die einzige Herausforderung war den Kernel mit Grub zu laden. Inzwischen sollte auch das dank EFI / BIOS Boot gar nicht mehr notwendig sein. Ich kann gerne mal schauen und die Kommandos aufschreiben. Aber ich kann nicht versprechen, dass ich es heute schaffe.
 
Okay, das ging nun schneller als erwartet. Per BIOS zu booten ginge so:
Code:
% truncate -s 20G openbsd.img
% fetch http://artfiles.org/openbsd/5.9/amd64/cd59.iso
% fetch "https://people.freebsd.org/~grehan/bhyve_uefi/BHYVE_UEFI_CSM_20151002.fd"
% bhyve -A -H -P -c 1 -s 0,hostbridge -s 3,ahci-hd,openbsd.img -s 4,ahci-cd,cd59.iso -s 31,lpc -l com1,stdio -l bootrom,BHYVE_UEFI_CSM_20151002.fd -m 2G obsd59
Allerdings bleibt die VM direkt nach dem Einsprung in den Bootloader, noch bevor ein einziges Zeichen ausgegeben wurde, hängen. Alternativ passiert etwas, OpenBD gibt nur nicht auf meine virtuelle serielle Konsole aus. Also per sysutils/grub2-bhyve:

Code:
% truncate -s 20G openbsd.img
% fetch http://artfiles.org/openbsd/5.9/amd64/cd59.iso
% pkg install grub2-bhyve
% echo "(hd0) /usr/vm/bhyve/config/openbsd/openbsd.img" > system.map
% echo "(cd0) /usr/vm/bhyve/config/openbsd/cd59.iso" >> system.map
% grub-bhyve -m system.map -M 2048 openbsd
grub> kopenbsd -h com0 (cd0)/5.9/amd64/bsd.rd
grub> boot
% bhyve -A -H -P -c 1 -s 0,hostbridge -s 1,ahci-hd,openbsd.img -s 2,ahci-cd,cd59.iso -s 3:0,lpc -l com1,stdio -m 2048M obsd59
Copyright (c) 1982, 1986, 1989, 1991, 1993
        The Regents of the University of California.  All rights reserved.
Copyright (c) 1995-2016 OpenBSD. All rights reserved.  http://www.OpenBSD.org
                                                                            
OpenBSD 5.9 (RAMDISK_CD) #1720: Fri Feb 26 01:25:23 MST 2016
    deraadt@amd64.openbsd.org:/usr/src/sys/arch/amd64/compile/RAMDISK_CD
real mem = 2130706432 (2032MB)                                         
avail mem = 2064474112 (1968MB)
mainbus0 at root             
bios0 at mainbus0: SMBIOS rev. 2.6 @ 0xf101f (9 entries)
bios0: vendor BHYVE version "1.00" date 03/14/2014     
acpi0 at bios0: rev 2                           
acpi0: tables DSDT APIC FACP HPET MCFG
acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
cpu0 at mainbus0: apid 0 (boot processor)     
cpu0: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 4008.31 MHz
cpu0: FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,MMX,FXSR,SSE,SSE2,SS,HTT,PBE,SSE3,PCLMUL,DTES64,DS-CPL,SSSE3,FMA3,CX16,xTPR,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AES,XSAVE,AVX,F16C,RDRAND,HV,NXE,PAGE1GB,LONG,LAHF,ABM,3DNOWP,ITSC,FSGSBASE,BMI1,HLE,AVX2,BMI2,ERMS,INVPCID,RTM,ARAT
cpu0: 256KB 64b/line 8-way L2 cache                                                               
cpu0: apic clock running at 134MHz
ioapic0 at mainbus0: apid 0 pa 0xfec00000, version 11, 24 pins
acpiprt0 at acpi0: bus 0 (PC00)                             
pvbus0 at mainbus0: bhyve     
pci0 at mainbus0 bus 0 
pchb0 at pci0 dev 0 function 0 unknown vendor 0x1275 product 0x1275 rev 0x00
ahci0 at pci0 dev 1 function 0 "Intel 82801H AHCI" rev 0x00: apic 0 int 16, AHCI 1.3
ahci0: port 0: 6.0Gb/s                                                             
scsibus0 at ahci0: 32 targets
sd0 at scsibus0 targ 0 lun 0: <ATA, BHYVE SATA DISK, 001> SCSI3 0/direct fixed t10.ATA_BHYVE_SATA_DISK_BHYVE-BFDA-F420-40D5
sd0: 20480MB, 512 bytes/sector, 41943040 sectors
ahci1 at pci0 dev 2 function 0 "Intel 82801H AHCI" rev 0x00: apic 0 int 17, AHCI 1.3
ahci1: port 0: 6.0Gb/s                                                             
scsibus1 at ahci1: 32 targets
cd0 at scsibus1 targ 0 lun 0: <BHYVE, BHYVE DVD-ROM, 001> ATAPI 5/cdrom removable
"Intel 82371SB ISA" rev 0x00 at pci0 dev 3 function 0 not configured           
isa0 at mainbus0                                                   
com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
com0: console                                         
com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
kbc selftest: ffffffff                               
softraid0 at root   
scsibus2 at softraid0: 256 targets
root on rd0a swap on rd0b dump on rd0b
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/amd64 5.9 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?
 
Danke für die Kommentare!
Das kannst du mit sysutils/iohyve machen:
Das sieht richtig gut aus. Muss ich dann manuell noch NAT und DHCPD auf dem Host machen? Das OpenBSD setup bekommt nämlich keine DHCP-lease...

EDIT: zumindest Geräte hat iohyve richtig angelegt auf dem host:
Code:
bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: iohyve-bridge
        ether 02:2d:e3:85:6c:00
        nd6 options=1<PERFORMNUD>
        id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
        maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
        root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
        member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 4 priority 128 path cost 2000000
        member: em0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
                ifmaxaddr 0 port 1 priority 128 path cost 20000
tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 1500
        description: iohyve-obsdguest
        options=80000<LINKSTATE>
        ether 00:bd:3e:2e:bd:00
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect
        status: active
        Opened by PID 4049
 
OK, ein paar rough edges hat es noch, aber es scheint erstmal alles zu klappen. Ich dokumentier das in den nächsten Tagen mal hier.
 
Zurück
Oben