Cisco WLC in bhyve

ScaryGary

Cadet
Joined
Aug 18, 2016
Messages
7
I've got a Cisco WLC running in bhyve on FreeNAS-11.2-U2.1.
Every time i reboot I have to manually start the vm by running a script with the following commands:

sysctl net.link.tap.up_on_open=1
ifconfig tap1 create
ifconfig bridge0 addm tap1
grub-bhyve -m device.map -r hd0,msdos1 -M 2048 vwlc

In grub-bhyve I then have to enter legacy_configfile /grub/menu.lst and press enter at the prompt.
grub-bhyve then exits and I run another script that looks like this:

bhyve -A -H -P \
-s 0:0,hostbridge \
-s 1:0,lpc \
-s 2:0,ahci-hd,./vwlc.img \
-s 3:0,virtio-net,tap0 \
-s 4:0,virtio-net,tap1 \
-l com1,/dev/nmdm0A \
-c 1 \
-m 2048M \
vwlc &

My question is if there's any way I can add the VM to the virtual machines in the WebUI and make it start automatically.
 

dir_d

Explorer
Joined
Nov 9, 2013
Messages
55
Thats what i was going to suggest. Strange your issue. All my VMs show up on the new UI of freenas and i can set the to auto boot or not.
 
Joined
Dec 29, 2019
Messages
4
I recently migrated a Cisco vWLC from esxi to TrueNAS, to get around having to interact with GRUB when booting the VM
I mounted the first partition and added /boot/grub/grub.cfg that has the legacy grub menu.lst converted for grub2, tested on
TrueNAS-12.0-U8 and FreeBSD 13, the same thing can be with the install disk.
# # This is the menu.lst file for GRUB # # When GRUB boots the kernel, CONSOLESTRINGCONSOLESTRING will get replaced by # "console=ttyS0,<baudrate> mac=<mac address> boot-ver=<version>" # , where # <baudrate> comes from the switchdrvr config file. # <mac address> is 0:0:0:0:0:0 (but doesn't matter) # <version> is BSN_VERSION in common/include/version.h when GRUB was built # set timeout=8 set default='0'; if [ x"$default" = xsaved ]; then load_env; set default="$saved_entry"; fi set fallback='1' menuentry 'Primary image' { set root='(hd0,4)'; set legacy_hdbias='0' legacy_kernel '/images/linux.pri.img' '/images/linux.pri.img' 'BOOT_IMAGE=primary' 'console=ttyS0,9600' 'mac=0:0:0:0:0:0' 'boot-ver=8.5.1.8' } menuentry 'Secondary image' { set root='(hd0,4)'; set legacy_hdbias='0' legacy_kernel '/images/linux.bak.img' '/images/linux.bak.img' 'BOOT_IMAGE=secondary' 'console=ttyS0,9600' 'mac=0:0:0:0:0:0' 'boot-ver=8.5.1.8' } menuentry 'Change primary image selection (switch primary/secondary images)' { set root='(hd0,1)'; set legacy_hdbias='0' legacy_kernel '/rescue.img' '/rescue.img' 'MODE=switch-images' 'console=ttyS0,9600' 'mac=0:0:0:0:0:0' 'boot-ver=8.5.1.8' } menuentry 'Manually perform system upgrade' { set root='(hd0,1)'; set legacy_hdbias='0' legacy_kernel '/rescue.img' '/rescue.img' 'MODE=system-upgrade' 'console=ttyS0,9600' 'mac=0:0:0:0:0:0' 'boot-ver=8.5.1.8' } menuentry 'Clear Configuration' { set root='(hd0,1)'; set legacy_hdbias='0' legacy_kernel '/rescue.img' '/rescue.img' 'MODE=clear-config' 'console=ttyS0,9600' 'mac=0:0:0:0:0:0' 'boot-ver=8.5.1.8' }
 
Last edited:
Joined
Dec 29, 2019
Messages
4
I modified the Cisco vWLC install disk, and can now install and boot the VM without entering the GRUB command line and
specifying the legacy_configfile, this works on the command line only, the web UI just throws an error about storage.
I think it might be possible to make the install CD UEFI bootable and fiddle with the install script and related files to make the
VM UEFI bootable.

EDIT:

when trying to boot UEFI I get "kernel doesn't support EFI handoff", the workaround is to "just, recompile the kernel with CONFIG_EFI_STUB=y, my dude." attempting to boot with UEFI-CSM results in a crash. for refrence this is the HOW-TO:


github with srtipts for running Cisco Virtual Wireless Controller on FreeBSD bhyve

and my post-init boot script:

# srcipt to assist booting Cisco vWLC # on a bhyve virtual machine, edit the # ZVOL path to point to the zvol that # was created for install # #!/bin/sh # # edit as needed # # virtual machine name VM=99_vWLC # # path to a 8G zvol ZVOL=/dev/zvol/data/vWLC/sda # # netwrok taps, edit as needed TAP0=tap100 TAP1=tap101 # # virtual serial port, can be stdio COM=/dev/nmdm99A # # IFCONFIG=/sbin/ifconfig GREP=/usr/bin/grep BHYVECTL=/usr/sbin/bhyvectl SYSCTL=/sbin/sysctl GRUBBHYVE=/usr/local/sbin/grub-bhyve BHYVE=/usr/sbin/bhyve ROOT=hd0,msdos1 # if [ -e /dev/vmm/$VM ]; then $BHYVECTL --vm=$VM --destroy $IFCONFIG $TAP0 destroy $IFCONFIG $TAP1 destroy fi # sleep 2 # while ! $IFCONFIG -l | $GREP bridge0 >> /dev/null; do sleep 60 done # $IFCONFIG $TAP0 create $IFCONFIG $TAP1 create $SYSCTL net.link.tap.up_on_open=1 $IFCONFIG bridge0 addm $TAP1 # echo \(hd0\)$ZVOL > $PWD/device.map # $GRUBBHYVE -m $PWD/device.map -r $ROOT -M 2048 $VM # $BHYVE -A -H -P \ -s 0:0,hostbridge \ -s 1:0,lpc \ -s 2:0,ahci-hd,$ZVOL \ -s 3:0,virtio-net,$TAP0 \ -s 4:0,virtio-net,$TAP1 \ -l com1,$COM \ -c 1 \ -m 2048M \ $VM & #

my wish list would be:
GUB2-bhyve to fallback to legacy_configfile /boot/grub/menu.lst when grub.cfg isn't found
Fixing GRUB VM creation and booting using the TrunNAS UI.
 
Last edited:
Top