[PetiteCloud] Fwd: [HOW-TO] CentOS on bhyve

Michael Thoreson m.thoreson at c4labs.ca
Sat Mar 8 08:04:51 PST 2014


What if you chainloaded the boot loaders? Closest example I have is I 
use grub4dos to load floppy\iso images off a flash drive that basically 
is my rescue tool box. I will post the grub menu.lst. The map command 
can map images to cdx, hdx or fdx devices, the 0xff is just a fail safe 
for mounting isos. Some older systems won't allow mapping to cdx. Of 
course x being the number of the device.

Basically you could use grub-bhyve to load an iso image plus your raw 
disk image and have grubb-hyve chainload grub in the CentOS iso which as 
you can see is eventually achieved by rooting to the cdx and then 
calling chainload() which just triggers the boot sector of the device no 
differently than if the host bios had.

This is the only way I know to boot the CentOS install without messing 
with the internals of the instance. Once grub chainload() it passes off 
control to the bootloader in the image so there should be no way 
grub-bhyve would still be active.

title Local BootMGR
find --set-root /bootmgr
chainloader /bootmgr

title Local NTLDR
find --set-root /ntldr
chainloader /ntldr

title Acronis True Image 2013
find --set-root /acronis.iso
map /acronis.iso (0xff)
map --hook
root (0xff)
chainloader ()

title ERD 5.0 Tools
find --set-root /erd50.ldr
chainloader /erd50.ldr

title ERD 6.x Tools
find --set-root /tools.ldr
chainloader /tools.ldr

title SeaTools
find --set-root /st.iso
map /st.iso (0xff)
map --hook
root (0xff)
chainloader ()

title Western Digital
find --set-root /wd.iso
map /wd.iso (0xff)
map --hook
root (0xff)
chainloader ()

title Hitachi
find --set-root /ht.iso
map /ht.iso (0xff)
map --hook
root (0xff)
chainloader ()

title H8DG6 BIOS Update
find --set-root /Windows98_SE.img
map /Windows98_SE.img (fd0)
map /h8dg6.img (fd1)
map --hook
rootnoverify (fd0)
chainloader (fd0)+1
map --floppies=2

title MemTest 5.1
find --set-root /memtest.img
map /memtest.img (fd0)
map --hook
rootnoverify (fd0)
chainloader (fd0)+1
map --floppies=1


On 08/03/2014 1:36 AM, Aryeh Friedman wrote:
>
>
> ---------- Forwarded message ----------
> From: *Rudy (bulk)* <crapsh at monkeybrains.net 
> <mailto:crapsh at monkeybrains.net>>
> Date: Sat, Mar 8, 2014 at 1:46 AM
> Subject: [HOW-TO] CentOS on bhyve
> To: freebsd-virtualization at freebsd.org 
> <mailto:freebsd-virtualization at freebsd.org>
>
>
>
> 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
>
>
> _______________________________________________
> freebsd-virtualization at freebsd.org 
> <mailto:freebsd-virtualization at freebsd.org> mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to 
> "freebsd-virtualization-unsubscribe at freebsd.org 
> <mailto:freebsd-virtualization-unsubscribe at freebsd.org>"
>
>
>
> -- 
> Aryeh M. Friedman, Lead Developer, http://www.PetiteCloud.org
>
>
> _______________________________________________
> petitecloud-general mailing list
> petitecloud-general at lists.petitecloud.nyclocal.net
> http://lists.petitecloud.nyclocal.net/listinfo.cgi/petitecloud-general-petitecloud.nyclocal.net




More information about the petitecloud-general mailing list