# bhyve - Running Centos7 on FreeBSD



## henninb (Aug 21, 2017)

I am very close to getting Centos7 (version 1503) running on FreeBSD 11.1 with bhyve, but I am stuck. I have used the following instructions for installation. Please let me know if you can advice how to address the /dev/mapper/centos-root issue or an alternative way to get Centos7 running in bhyve.

01. `sudo pkg install vm-bhyve grub2-bhyve`

02. `sudo vi /etc/rc.conf`

```
vm_enable="YES"
vm_dir="/vm"
```
03. `sudo vm init`
04. `sudo cp /usr/local/share/examples/vm-bhyve/* /vm/.templates/`
05. `sudo vm switch create public`
06. `sudo vm switch add public alc0`
07. `vm iso CentOS-7-x86_64-Minimal-1503-01.iso`
08. `sudo vm create centos7`
09. `sudo vm -f install centos7 CentOS-7-x86_64-Minimal-1503-01.iso`

10. `sudo vi /vm/centos/centos7.conf   # updated kernel version`

```
/vmlinuz-3.10.0-229.el7.x86_64
    /initramfs-3.10.0-229.el7.x86_64.img
```
11. `sudo vm -f start centos7`

```
[  OK  ] Reached target Basic System.
[    0.812167]  vda: vda1 vda2 vda3
[    1.260077] input: PS/2 Generic Mouse as /devices/platform/i8042/serio1/input/input2
[    1.472683] tsc: Refined TSC clocksource calibration: 3196.809 MHz
[    1.473214] Switching to clocksource tsc
```


```
Aug 20 15:36:01 centos7 kernel: Switching to clocksource tsc
Aug 20 15:39:08 centos7 dracut-initqueue[209]: Warning: Could not boot.
Aug 20 15:39:08 centos7 dracut-initqueue[209]: Warning: /dev/mapper/centos-root
Aug 20 15:39:08 centos7 systemd[1]: Starting Dracut Emergency Shell...
```


----------



## Jov (Aug 21, 2017)

Not sure what's wrong, but I can share my config for reference. I use CentOS-7-x86_64-Minimal-1511.iso to install CentOS 7 and this is my vm-bhyve config:

```
loader="grub"
cpu=2
memory=2048M
#passthru0="1/0/0"
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="linux /isolinux/vmlinuz LANG=en_US.UTF-8 KEYTABLE=us SYSFONT=latarcyrheb-sun16 console=ttyS0"
grub_install1="initrd /isolinux/initrd.img"
grub_run0="linux /vmlinuz-3.10.0-327.el7.x86_64 root=/dev/mapper/centos-root LANG=en_US.UTF-8 KEYTABLE=us SYSFONT=latarcyrheb-sun16 console=ttyS0"
grub_run1="initrd /initramfs-3.10.0-327.el7.x86_64.img"
network0_mac="58:9c:fc:00:7f:9b"
```
This is my updated kernel version using to test BBR:

```
loader="grub"
cpu=2
memory=2048M
#passthru0="1/0/0"
network0_type="virtio-net"
network0_switch="public"
disk0_type="virtio-blk"
disk0_name="disk0.img"
grub_install0="linux /isolinux/vmlinuz LANG=en_US.UTF-8 KEYTABLE=us SYSFONT=latarcyrheb-sun16 console=ttyS0"
grub_install1="initrd /isolinux/initrd.img"
grub_run0="linux /vmlinuz-4.10.5-1.el7.elrepo.x86_64 root=/dev/mapper/centos-root LANG=en_US.UTF-8 KEYTABLE=us SYSFONT=latarcyrheb-sun16 console=ttyS0"
grub_run1="initrd /initramfs-4.10.5-1.el7.elrepo.x86_64.img"
network0_mac="58:9c:fc:00:7f:9b"
```


----------



## henninb (Aug 21, 2017)

Jov thanks for sharing your centos.conf I will check it for discrepancies between yours and see if I can find anything to help my centos7 boot correctly. The reason I am not running Centos7 (1511) is because after I install I noticed that bhyve-grub2 could not read my xfs boot partition. How did you get around that issue? I assume I am doing something incorrectly.


----------



## henninb (Aug 21, 2017)

henninb said:


> Jov thanks for sharing your centos.conf I will check it for discrepancies between yours and see if I can find anything to help my centos7 boot correctly. The reason I am not running Centos7 (1511) is because after I install I noticed that bhyve-grub2 could not read my xfs boot partition. How did you get around that issue? I assume I am doing something incorrectly.



Correction I was attempting to run *1611 *and not *1511*, I will try and install 1511 and see if I have better results. Based on your results Jov, I assume the latest version of Centos7 that does not utilize xfs as the default for /boot is 1511. At the end of the day it would be nice if the Centos 7 console install allowed this setting to be configurable.


----------



## henninb (Aug 22, 2017)

On the Centos side I fixed this by reinstalling 1511 and choosing the LVM instead of Legacy Partitions.


----------



## diego (Jul 12, 2020)

Updated 2020
Trying to install the latest version available CentOS-7.8.2003, and I got the same problem.This post saves me a lot of headaches.
Thanks


----------



## Eric A. Borisch (Jun 4, 2021)

Update 2021:

Use UEFI and modify the installer boot line to use the com port.

Works great with vm-bhyve, the key steps (from the above link, here for convenience) during booting of the install CD:

Go to the line Install CentOS Linux 8
Press e to edit the command line
Modify the vmlinuz line to replace quiet by console=ttyS0,115200n8
Hit CTRL-X to boot.
This also gets away from having to deal with the GRUB boot loader which is a little less clean inside Bhyve than just letting UEFI take care of it. You also don't have to do a two-step of use an old installer to get up-and-running.


----------

