Installing on FreeBSD's Bhyve

I’m trying to install this on Bhyve and I seem to just get stuck in the grub bootloader. How do you get this thing booted on *hyve?

Hello,
might be late but i’ve successfuly installed rancheros on freenas 9.10 following coreos instruction here : https://imil.net/blog/2016/06/21/CoreOS_on_bhyve/

replace grub-cd0.cfg content with:
linux (cd0)/boot/vmlinuz rancher.password=rancher rancher.state.autoformat=[/dev/sda,/dev/vda]
initrd (cd0)/boot/initrd
boot

replace grub-hd0.cfg content with:
linux (hd0,msdos1)/boot/vmlinuz-v0.5.0-rancheros console=tty0
initrd (hd0,msdos1)/boot/initrd-v0.5.0-rancheros
boot

And replace OS install instruction with RancherOS ones (sudo ros install …)

Hope it helps :slight_smile:

Running FreeBSD 12.0-RELEASE-p10 GENERIC amd64

I installed iohyve and put this to /etc/rc.conf

iohyve_enable="YES"
iohyve_flags="kmod=1 net=em0"

This will autoload required modules. Acording to iohyve setup you need to specify start command where you define network card and pool you want your hivez to live:

# iohyve setup pool=tank kmod=1 net=em0

Next you pull in latest CD:

# iohyve fetch https://releases.rancher.com/os/latest/rancheros.iso

Install bhyves grub loader:

# pkg install grub2-bhyve

For next steps you will neet two consoles open, one will start vm, second will attach to session to complete install:

iohyve create rancher 100G
iohyve set rancher loader=grub-bhyve ram=8G cpu=4 con=nmdm0 os=debian
iohyve install rancher rancheros.iso

Now switch to second terminal and type:

iohyve console rancher

Just press Enter if there is no input cursor, You should then see:

Starting console on rancher…
~~. to escape console [uses cu(1) for console]
Connected

Now when you are in grub issue this commands:

grub> set root=(cd0,msdos1)
grub> linux /boot/vmlinuz-4.14.138-rancher ro rancher.password=MySecretPassword
grub> initrd /boot/initrd-v1.5.4 
grub> boot

You will start boot process of RancherOS, then login with user rancher and password from above command:

ros-sysinit:info: RancherOS v1.5.4 started
Linux 4.14.138-rancher
RancherOS #1 SMP Sat Aug 10 11:25:46 UTC 2019 rancher ttyS0
docker-sys: 172.18.42.1 lo: 127.0.0.1
rancher login: rancher
Password:

Next you create cloud-config.yml:

[rancher@rancher ~]$ vi cloud-config.yml

and insert something that fits your network, mine ssh key is at .ssh/id_rsa.pub:

#cloud-config
ssh_authorized_keys:
  - ssh-rsa ThiSloNgStringFromSSHKEY

#/var/lib/rancher/conf/cloud-config.d/netconfig-config.yml
rancher:
  network:
    interfaces:
      eth0:
        addresses:
          - 192.168.0.10/24
        gateway: 192.168.0.1
        dhcp: false
    dns:
      nameservers:
        - 192.168.0.1
        - 8.8.8.8
        - 8.8.4.4

Next step is to check config yaml and start installation:

[rancher@rancher ~]$ sudo ros config validate -i cloud-config.yml
[rancher@rancher ~]$ sudo ros install -c cloud-config.yml -d /dev/sda

You should see something like this:

INFO[0000] No install type specified…defaulting to generic
Installing from rancher/os:v1.5.4
Continue [y/N]: y
INFO[0025] start !isoinstallerloaded
INFO[0026] trying to load /bootiso/rancheros/installer.tar.gz
Loaded image: rancher/os-installer:latest
INFO[0026] Loaded images from /bootiso/rancheros/installer.tar.gz
INFO[0026] starting installer container for rancher/os-installer:latest (new)
Installing from rancher/os-installer:latest
mke2fs 1.45.2 (27-May-2019)
64-bit filesystem support is not enabled. The larger fields afforded by this feature enable full-strength checksumming. Pass -O 64bit to rectify.
Discarding device blocks: done
Creating filesystem with 26213888 4k blocks and 26214400 inodes
Filesystem UUID: edbfaaa2-900c-4758-a8ec-941b8db9ff64
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872

Allocating group tables: done
Writing inode tables: done
Creating journal (131072 blocks): done
Writing superblocks and filesystem accounting information: done

Continue with reboot [y/N]: y
INFO[0035] Rebooting
INFO[0035] Setting reboot timeout to 60 (rancher.shutdown_timeout set to 60)
…^[ ] reboot:info: Setting reboot timeout to 60 (rancher.shutdown_timeout set to 60)
.=.[ ] reboot:info: Stopping /docker : d0dc40e8c38e
…C…[ ] reboot:info: Stopping /ntp : 6a9f3c8a269c
.>.[ ] reboot:info: Stopping /network : 06583eef61c9
…<…[ ] reboot:info: Stopping /udev : 2022f2d3cc6a
.B.[ ] reboot:info: Stopping /system-cron : 34c0f89e323c
…>…[ ] reboot:info: Stopping /syslog : f4947287051c
.<.[ ] reboot:info: Stopping /acpid : 6a4b0deacf01
.acpid: exiting
.I…[ ] reboot:info: Console Stopping [/console] : 26be4e958484
…[ 787.439005] reboot: Restarting system

But wait, it is not over yet :slight_smile: You have to go back to console one where you started iohyve (just press enter to exit some notifications), and create grub.cfg (next to device.map file). Just cd in /iohyve/rancher

set root=(hd0,1) 
linux /boot/vmlinuz* printk.devkmsg=on rancher.state.dev=LABEL=RANCHER_STATE rancher.state.wait console=tty0 ro rancher.password=aZAFxJ2C2wzS6nEq
initrd /boot/initrd*
boot

Just last tweak before you start vm:

iohyve set rancher os=custom
iohyve start rancher

If you did not close two opened terminals, one should present you with rancher login.