Remote serial console for BHyve VM?
Craig Rodrigues
rodrigc at FreeBSD.org
Sun Jan 12 03:46:59 UTC 2014
On Mon, Jan 6, 2014 at 3:12 PM, Peter Grehan <grehan at freebsd.org> wrote:
> One way is to use the cloneable null-modem driver, nmdm(4). Others have
> used tmux for this, but I'll give a quick overview of the former.
>
> kldload nmdm.ko before starting VMs, e.g. at boottime or in rc.conf's
> kld_list variable.
>
> Use the '-c' option for bhyveload to point it at one end of an nmdm
> instance, and use it in place of "stdio" in the bhyve commandline.
>
> bhyveload .... -c /dev/nmdm0A ...
> bhyve ... -l com1,/dev/nmdm0A ...
>
> You can then attach to the other end (nmdm*B) with any tool of your
> choice - cu, screen, or socat to relay the device to a network connection.
> Some experimentation may be required :)
>
> later,
>
I did the following:
(1) Put the following in /boot/loader.conf to load the nmdm driver on
bootup:
nmdm_load="YES"
(2) I wrote a script with this:
#!/bin/sh
touch /dev/nmdm0A
/usr/sbin/bhyvectl --vm=vm1 --destroy
/usr/sbin/bhyveload -m 8G -d disk.img -c /dev/nmdm0A vm1
/usr/sbin/bhyve -c 2 -m 8G -A -H -P -g 0 -s 0:0,hostbridge -s 1:0,lpc -s
2:0,virtio-net,tap0 -s 3:0,virtio-blk,disk.img -l com1,/dev/nmdm0A vm1
When I ran the script, there was no output, which was a good sign.
I then ran this command:
cu -l /dev/nmdm0A
and had full access to the console of the VM.
Thanks!!
--
Craig
More information about the freebsd-virtualization
mailing list