Remote serial console for BHyve VM?

Peter Grehan grehan at freebsd.org
Mon Jan 6 23:12:22 UTC 2014


Hi Craig,

> I am working with Sean Bruno to set up some BHyve VM's.

  Great !

> If I want to have the VM's start via an rc.d script, and
> have the VM be headless, what is the best way to have
> the VM console still be accessible?
>
> Has anyone done something like use netcat
> to direct the BHyve stdio to a socket?
> That way the serial console could be accessed remotely
> via telnet or ssh.
>
> Is there a better way to do this?

  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,

Peter.


More information about the freebsd-virtualization mailing list