# run Freebsd as a host server for KVM, problem with starting QEMU



## pezza (Mar 26, 2020)

Good day,
Please help with starting QEMU on FreeBSD server


```
root@bsd1:~ # qemu-img create -f qcow2 image.img 10G
root@bsd1:~ # qemu-system-x86_64 -m 1024 -cdrom FreeBSD-12.0-RELEASE-amd64.qcow2 -hda image.img -boot d -net nic -net user -nographic -vnc :0
SeaBIOS (version rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org)
iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+3FF91410+3FEF1410 C980
Booting from DVD/CD...
Boot failed: Could not read from CDROM (code 0004)
Booting from Floppy...
Boot failed: could not read the boot disk

Booting from Hard Disk...
Boot failed: not a bootable disk

Booting from ROM...
iPXE (PCI 00:03.0) starting execution...ok
iPXE initialising devices...ok

iPXE 1.0.0+ (de45) -- Open Source Network Boot Firmware -- http://ipxe.org
Features: DNS HTTP iSCSI TFTP AoE ELF MBOOT PXE bzImage Menu PXEXT

net0: 52:54:00:12:34:56 using 82540em on 0000:00:03.0 (open)
  [Link:up, TX:0 TXE:0 RX:0 RXE:0]
Configuring (net0 52:54:00:12:34:56)...... ok
net0: 10.0.2.15/255.255.255.0 gw 10.0.2.2
Nothing to boot: No such file or directory ([URL]http://ipxe.org/2d03e13b[/URL])
No more network devices

No bootable device.
```

Also tried with CTRL+B option


```
iPXE> help

Available commands:

  config          cpuid           dhcp            pxebs           ifopen
  ifclose         ifstat          ifconf          imgfetch        module
  initrd          kernel          chain           imgselect       imgload
  imgargs         imgexec         boot            imgstat         imgfree
  login           menu            item            choose          show
  set             clear           read            inc             reboot
  route           sanhook         sanboot         sanunhook       prompt
  goto            shell           help            sync            autoboot
  sleep           iseq            isset           exit            echo


Type "<command> --help" for further information

iPXE> boot /root/FreeBSD-12.0-RE
/root/FreeBSD-12.0-RE... Permission denied (http://ipxe.org/0212603c)
iPXE>
```


Next step I tried with an ISO image:


```
root@bsd1:~ # qemu-system-x86_64 -m 1024 -cdrom CentOS-7-x86_64-DVD-1908.iso -hda image.img -boot d  -net nic -net user -nographic -vnc :0
SeaBIOS (version rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org)


iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+3FF91410+3FEF1410 C980



Booting from DVD/CD...

ISOLINUX 4.05 0x5bd8f633 ETCD Copyright (C) 1994-2011 H. Peter Anvin et al


 -  Press the <ENTER> key to begin the installation process.
```


and nothing happens... 

Could you please help with that issue
Thanks


----------



## SirDice (Mar 26, 2020)

```
-cdrom FreeBSD-12.0-RELEASE-amd64.qcow2
```

You're trying to load a Qcow disk image as a CD-ROM.


----------



## pezza (Mar 26, 2020)

SirDice said:


> ```
> -cdrom FreeBSD-12.0-RELEASE-amd64.qcow2
> ```
> 
> You're trying to load a Qcow disk image as a CD-ROM.



yes
the source from here: https://wiki.qemu.org/Hosts/BSD

also tried
root@bsd1:~ # qemu-system-x86_64 -m 1024 -cdrom CentOS-7-x86_64-DVD-1908.iso -hda image.img -boot d  -net nic -net user -nographic -vnc :0
SeaBIOS (version rel-1.12.1-0-ga5cab58e9a3f-prebuilt.qemu.org)


iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+3FF91410+3FEF1410 C980



Booting from DVD/CD...

ISOLINUX 4.05 0x5bd8f633 ETCD Copyright (C) 1994-2011 H. Peter Anvin et al


-  Press the <ENTER> key to begin the installation process.

and nothing happen


----------



## SirDice (Mar 26, 2020)

Read the instructions again, you're not following them. Qcow is a _disk_ image, not a _CD_ image. You're supposed to load it as the hard disk. It's not an installer, it's an already installed disk image.


----------



## pezza (Mar 26, 2020)

SirDice said:


> Read the instructions again, you're not following them. Qcow is a _disk_ image, not a _CD_ image. You're supposed to load it as the hard disk. It's not an installer, it's an already installed disk image.



tried ... it comes with erros:
root@bsd1:~ # qemu-system-x86_64 -m 2048 \
?  -hda FreeBSD-12.0-RELEASE-amd64.qcow2 -enable-kvm \
?  -netdev user,id=mynet0,hostfwd=tcp:127.0.0.1:7722-:22 \
?  -device e1000,netdev=mynet0
Unable to init server: Could not connect to 127.0.0.1: Connection refused
qemu-system-x86_64: -machine accel=kvm: No accelerator found


could you please help to understand why this formula is not working ?
qemu-system-x86_64 -m 1024 -cdrom CentOS-7-x86_64-DVD-1908.iso -hda image.img -boot d  -net nic -net user -nographic -vnc :0
...
-  Press the <ENTER> key to begin the installation process. 

and it stay halted


----------



## rootbert (May 12, 2020)

just to make something clear in case you did not know it: qemu does not use your cpus feature for hardware virtualization under FreeBSD. If you want hardware virtualization, use bhyve or virtualbox. and btw: kvm is Linux technology for virtualization


----------

