Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Feb 2025 17:46:04 -0500
From:      Petru Garstea <peter.garshtja@ambient-md.com>
To:        Paul Vixie <paul@redbarn.org>, Michael Gmelin <grembo@freebsd.org>, virtualization@freebsd.org
Cc:        freebsd-virtualization@freebsd.org
Subject:   Re: bhyve vm and virtio-console
Message-ID:  <9865e8dd-7af9-4cc6-97c7-2e3197c62e62@ambient-md.com>
In-Reply-To: <3802339.MHq7AAxBmi@localhost>
References:  <2a0e1b92-4d63-4061-bc37-c5e72b8ef0ed@ambient-md.com> <20250214205752.6a12dbb4.grembo@freebsd.org> <5e1c08ca-4175-4a85-bc07-3ca73406454a@ambient-md.com> <3802339.MHq7AAxBmi@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help

Spinning up the vm with /dev/nmdm* and connecting with cu -l is not an 
issue on my end.
I am trying to create a vm using freebsd cloud image and connect to 
guest OS terminal with virtio-console and socat(no X11).
When spawning the vm the unix socket indeed is created, however when I 
connect to it with socat nothing is being shown(not actions on any 
terminal commands as well).
Also, I noticed there is a kernel module(virtio_console.ko) and 
apparently I believe it has to be loaded it, not sure here.

Please advise,

On 2/14/25 17:23, Paul Vixie wrote:
> if you want to use cu, you have to use -l to map guest com1 to some host nmdm
> device. if you want to use virtio-console, it will create unix domain sockets
> not pseudo tty endpoints. from bhyve(8) we see:
>
>>                   Virtio console device backends:
>>                   
>>                   •
>>                   port1=/path/to/port1.sock[,portN=/path/to/port2.sock ...]
>>                   
>>                   A maximum of 16 ports per device can be created.  Every
>>                   port
>>                   is named and corresponds to a Unix domain socket created by
>>                   bhyve.  bhyve accepts at most one connection per port at a
>>                   time.
>>                   
>>                   Limitations:
>>                   
>>                   •   Due to lack of destructors in bhyve, sockets on the
>>                       filesystem must be cleaned up manually after bhyve
>>                       exits.
>>                   
>>                   •   There is no way to use the “console port” feature, nor
>>                       the console port resize at present.
>>                   
>>                   •   Emergency write is advertised, but no-op at present.
> i know of no host-side client which will connect to these unix domain sockets
> and offer a cu-like user interface. "unidirectional" may be the experience
> you'll get from "socat".
>
> if what you're trying to accomplish is a graphical console, virtio-console is
> not the way to do it. rather, you'll want "fbuf" to create a guest VGA/similar
> that gateways to a host VNC.
>
> re:
>
> On Friday, February 14, 2025 9:55:23 PM UTC Petru Garstea wrote:
>> I tried with the following command, and got the same result.
>>
>> */usr/sbin/bhyve -H -P -A -c 1 -m 1500M \
>> -s 0,hostbridge \
>> -s 6,virtio-console,0=/tmp/vtcon.0 \
>> -s 31,lpc \
>> -l bootrom,/tmp/BHYVE_UEFI.fd \
>> -s 1,virtio-blk,/tmp/fbsd.img \
>> -s 2,virtio-net,tap0 \
>> tmp*
>>
>>
>> I also able to connect but the bidirectional connection is not happening
>>
>> *socat - UNIX-CONNECT:/tmp/vtcon.0
>> ls
>> *
>> PS: if I use null modem emulation instead virtio-console, then
>> connecting with cu is not an issue.
>>
>> any ideas ?
>>
>> Thanks
>>
>> On 2/14/25 14:57, Michael Gmelin wrote:
>>> On Fri, 14 Feb 2025 14:21:07 -0500
>>>
>>> Petru Garstea<peter.garshtja@ambient-md.com> wrote:
>>>> Hi,
>>>> I am trying to configure bhyve vm with support of virtio-console, the
>>>> following option is added to bhyve command line
>>>>
>>>> *-s 3,virtio-console,port1=/test/console.sock
>>>>
>>>> *However when trying to connect to socket with socat trere are no
>>>> input/ouptut is observed.
>>>>
>>>> Has virtio-console ever worked ?
>>> Yes it works, I just tried it using sysutils/vm-bhyve (just add
>>> virt_console0="Yes" to the configuration file).
>>>
>>> Based on the logs, these device settings are used by it:
>>>       bhyve devices:
>>>         -s 0,hostbridge \
>>>         -s 31,lpc \
>>>         -s 4:0,virtio-blk,/dev/zvol/zroot/vms/freebsd14-test/disk0 \
>>>         -s 5:0,virtio-net,tap0,mac=58:9c:fc:aa:aa:aa \
>>>         -s 6:0,virtio-console,0=/vms/freebsd14-test/vtcon.0
>>>
>>> I could connect to /vms/freebsd14-test/vtcon.0 using socat:
>>>       socat - UNIX-CONNECT:/vms/freebsd14-test/vtcon.0
>>>
>>> Inside the vm it's /dev/vtcon/0.
>>>
>>> -m
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?9865e8dd-7af9-4cc6-97c7-2e3197c62e62>