bhyve - Running Centos7 on FreeBSD

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
Code:
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
Code:
    /vmlinuz-3.10.0-229.el7.x86_64
    /initramfs-3.10.0-229.el7.x86_64.img
11. sudo vm -f start centos7
Code:
[  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

Code:
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...
 
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:
Code:
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:
Code:
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"
 
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.
 
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.
 
On the Centos side I fixed this by reinstalling 1511 and choosing the LVM instead of Legacy Partitions.
 
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.
 
You guys there is a way to install CentOS / Rocky Linux / Alma Linux. Create a kickstart file and configure it to use boot partition of type ext2 and install Linux from that kickstart file. Problem solved, and it is not that hard. You only need
grub2-bhyve
package.

The part of the kickstart file that deals with partition creation is something like this (that I use):

Bash:
zerombr
clearpart --all --initlabel --drives=vda --disklabel=gpt
part biosboot --size=1 --ondisk=vda --fstype=biosboot
part /boot --fstype="ext2" --size=1024 --ondisk=vda
part / --fstype="xfs" --size=4096 --ondisk=vda
part swap --fstype="swap" --size=2048 --ondisk=vda

Note that I also configured to use gpt partition table. By default the installer uses gpt only if you have a hard drive bigger than 2TB. If you do not use gpt you will have to deal with primary/secondary partition style (old thing).
 
Back
Top