Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jan 2014 19:46:56 -0800
From:      Craig Rodrigues <rodrigc@FreeBSD.org>
To:        Peter Grehan <grehan@freebsd.org>
Cc:        Peter Wemm <peter@wemm.org>, "freebsd-virtualization@freebsd.org" <freebsd-virtualization@freebsd.org>
Subject:   Re: Remote serial console for BHyve VM?
Message-ID:  <CAG=rPVf%2BWswX9uPQd4qh9u-QQ5vUwsKqiS2EZM_ptNjBL8_=rQ@mail.gmail.com>
In-Reply-To: <52CB384A.7050405@freebsd.org>
References:  <CAG=rPVf-2ZoyUWP7q_S7voUn54nGKbtuWNtQX-KL3sJNMtb6MA@mail.gmail.com> <52CB384A.7050405@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 6, 2014 at 3:12 PM, Peter Grehan <grehan@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAG=rPVf%2BWswX9uPQd4qh9u-QQ5vUwsKqiS2EZM_ptNjBL8_=rQ>