Exactly, I expect to get the shell after I connect with socat, something similar to docker exec -it.
On Fri, Feb 14, 2025, 18:10 Michael Gmelin <gre...@freebsd.org> wrote: > > > > On 14. Feb 2025, at 23:46, Petru Garstea <peter.garsh...@ambient-md.com> > wrote: > > > > 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, > > > > You can connect to the device inside the vm like I wrote and pass data to > the socat connected socket on the outside (this is what I tested, please > see my previous email). > > Are you trying to get some sort of shell over this connection? > > -m > > > >> 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.garsh...@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 > >> > > > >