[HOW-TO] CentOS on bhyve

Rudy (bulk) crapsh at monkeybrains.net
Sat Mar 8 06:46:31 UTC 2014


A customer wanted CentOS, so I tried doing it like I did my Ubuntu 
install --- no luck with the grub loading up automatically.

Here is basically what I did ... it works, but I get all these odd 
characters in my terminal (if I hit tab, I can guess at the menu items 
and successfully make it through the installation process).  I need to 
clean up this how-to, but here it is...

START INSTALL -----------------------------------------

# cd /data/images/
# truncate -s 200G vm2.img
# cat vm2-device.map
(hd0) /data/images/vm2.img
(cd0) /data/distributions/CentOS-6.5-x86_64-minimal.iso

# bhyvectl --vm=vm2 --destroy
# grub-bhyve -r cd0 -m /data/images/vm2-device.map -M 2048 vm2

grub> linux /isolinux/vmlinuz
grub> initrd /isolinux/initrd.img
grub> boot

# bhyve -c 2 -m 2048M -H -P -A \
     -l com1,stdio \
     -s 0:0,hostbridge \
     -s 1:0,lpc -s 2:0,virtio-net,tap1 \
     -s 3,ahci-cd,/data/distributions/CentOS-6.5-x86_64-minimal.iso \
     -s 4,virtio-blk,/data/images/vm2.img vm2


END  INSTALL -----------------------------------------

Is there something like this that will clean up the output from the 
CentOS install program?

grub> GRUB_TERMINAL=console


The boot part is messy (how to I load up the grub.conf from inside the 
install image?



START BOOT -----------------------------------------
# grub-bhyve -r hd0,msdos1 -m vm2.map -M 2048 vm2
grub> cat /grub/
Possible files are:

  grub.conf splash.xpm.gz menu.lst device.map stage1 stage2 
e2fs_stage1_5 fat_stage1_5 ffs_stage1_5
iso9660_stage1_5 jfs_stage1_5 minix_stage1_5 reiserfs_stage1_5 
ufs2_stage1_5 vstafs_stage1_5 xfs_stage1_5
grub> cat /grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You have a /boot partition.  This means that
#          all kernel and initrd paths are relative to /boot/, eg.
#          root (hd0,0)
#          kernel /vmlinuz-version ro root=/dev/mapper/VolGroup-lv_root
#          initrd /initrd-[generic-]version.img
#boot=/dev/vda
default=0
timeout=5
serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title CentOS (2.6.32-431.el6.x86_64)
         root (hd0,0)
         kernel /vmlinuz-2.6.32-431.el6.x86_64 ro 
root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8
rd_NO_MD  KEYTABLE=us rd_LVM_LV=VolGroup/lv_swap 
SYSFONT=latarcyrheb-sun16 console=ttyS0 crashkernel=auto rd_LV
M_LV=VolGroup/lv_root rd_NO_DM
         initrd /initramfs-2.6.32-431.el6.x86_64.img


grub> linux /vmlinuz-2.6.32-431.el6.x86_64 ro 
root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_
NO_MD  KEYTABLE=us rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 
console=ttyS0 crashkernel=auto rd_LVM_L
V=VolGroup/lv_root rd_NO_DM
grub> OM
error: can't find command `OM'.
grub> linux /vmlinuz-2.6.32-431.el6.x86_64 ro 
root=/dev/mapper/VolGroup-lv_root rd_NO_LUKS LANG=en_US.UTF-8 rd_
NO_MD  KEYTABLE=us rd_LVM_LV=VolGroup/lv_swap SYSFONT=latarcyrheb-sun16 
console=ttyS0 crashkernel=auto rd_LVM_L
V=VolGroup/lv_root rd_NO_DM
grub> initrd /initramfs-2.6.32-431.el6.x86_64.img
grub> boot

# bhyve -c 2 -m 2048M -H -P -A -s 0:0,hostbridge -s 1:0,lpc -s 
2:0,virtio-net,tap1 -s 
3,ahci-cd,/data/distributions/CentOS-6.5-x86_64-minimal.iso -s 
4,virtio-blk,/data/images/vm2.img -l com1,stdio vm2

[snip]
CentOS release 6.5 (Final)
Kernel 2.6.32-431.el6.x86_64 on an x86_64

localhost.localdomain login: root
Password:
[root at localhost ~]#

  END  BOOT -----------------------------------------

Also, this is making me wonder... am I doing this wrong?  I am using 
install CD images, are other people using pre-made CentOS images?
I have noticed grub-bhyve requires a space at the end of the line or I 
get 'OM' on STDOUT and the line fails.  Above, I hit the up-arrow then a 
space (
Rudy




More information about the freebsd-virtualization mailing list