From nobody Fri Feb 14 23:10:42 2025 X-Original-To: freebsd-virtualization@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Yvnpg1P7Rz5nnvy; Fri, 14 Feb 2025 23:10:51 +0000 (UTC) (envelope-from grembo@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Yvnpf6RD1z3HFF; Fri, 14 Feb 2025 23:10:50 +0000 (UTC) (envelope-from grembo@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739574650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3wbVJ7mt3DLG5Gsy5WNweVxacoFduJkjY0rH4huyfbA=; b=JFIxAsv44B8n9S/tmLpPHc+zA5BtV6RNhR+3Y6e1J1y3mRi4pKXLFVtJinfFTyAfPC7iJD KIXsXwkLZG52yAkdJpNBG2gliKOYNmTPGhaVE6dXTVcP0q94EI8J2+HbRizl3JkVdwMzMr RfaXSQRCAntD/XeW1P0UfsAPK4jYTLt/8ap/Em9sQTP60C9oTkcbXzh4uFPEREhAfHUVuk qAnFjM5DkVFLPhVvp1BsBlDyvES4butGSI/ibcdL7vp6dZyn+svDdK2YFRnW2NdmetCKIq OGywTrtR++WQZbesbrnUsNN8VhOgRx3nO65/bByOPxcxSPJaq/dcjxPVf+zt9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1739574650; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3wbVJ7mt3DLG5Gsy5WNweVxacoFduJkjY0rH4huyfbA=; b=HGgmZ6lO1PiZ3wSp9tzZ6F1+eQV1WD4m7cWX8x9C4cowS6pqJ8hwXNBkdBTyOIQggKNLbj p3wBnivCeOFBBOgzXJkElJB97vtVvzGyqS9+rbf1v7M4HXd7xEVh85owNepELw6kW6Tqll NpjdwoG+eNJu6Fm2Svar7ObQBXq+8EbYjSIkXl0XRFz+BbPy7IDPKiDBnTqtWfS6Wv1dJk 5EXDyVYGhL4UCzKXvZWSZSocDyldImm001FsCFmGhPS5+cZRva+TE0AQSTEunLtEzlBB/d pocHQYYGvbGMUHpQ/bZ9HB1XQBlSf+HL2zc3MVujoSA9BS3HnYZC6DbDUGnmxQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1739574650; a=rsa-sha256; cv=none; b=AG0/s809ajINmEyAamrYkGWXoF9DnSVpcz11c0rsEztavwxLN5QQLM4C5xiaT20xvivlUg BxdKeK7HGkhIKPSxvOI3o1L2cB1POm2PRvRjedLagZ0/nvVSPGpjLAHiTBuq0hD1PftW9y 3Bbsk5jirh3lDiuHAwrR9q6ahniq/uxm6qDroi0bCjCGoTDi+lqcLaCCT9O45vN9htfgpD LwoQH5OV+5k+Zr7M1D+vuyx9i8p3PmXiuXQR9QHPJ/z3jlIJFBmOe8utWs0/2a0LnZJfo2 PW4c4IuRD+RqleL3aJjrcs2ad8JXBzu56A0CCZNhH/WbkCOWWKePIVH91wb3TQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from mail.evolve.de (mail.evolve.de [213.239.217.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA512) (Client did not present a certificate) (Authenticated sender: grembo/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Yvnpf1N3Dzrnm; Fri, 14 Feb 2025 23:10:45 +0000 (UTC) (envelope-from grembo@freebsd.org) Received: by mail.evolve.de (OpenSMTPD) with ESMTPSA id 0137f700 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 14 Feb 2025 23:10:43 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: Discussion List-Archive: https://lists.freebsd.org/archives/freebsd-virtualization List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: freebsd-virtualization@freebsd.org Sender: owner-freebsd-virtualization@FreeBSD.org Mime-Version: 1.0 (1.0) Subject: Re: bhyve vm and virtio-console From: Michael Gmelin In-Reply-To: <9865e8dd-7af9-4cc6-97c7-2e3197c62e62@ambient-md.com> Date: Sat, 15 Feb 2025 00:10:42 +0100 Cc: Paul Vixie , virtualization@freebsd.org, freebsd-virtualization@freebsd.org Message-Id: <899331A6-1635-4546-ADE6-FE21B52138FF@freebsd.org> References: <9865e8dd-7af9-4cc6-97c7-2e3197c62e62@ambient-md.com> To: Petru Garstea X-Mailer: iPhone Mail (20H350) > On 14. Feb 2025, at 23:46, Petru Garstea w= rote: >=20 > =EF=BB=BFSpinning up the vm with /dev/nmdm* and connecting with cu -l is n= ot an issue on my end. > I am trying to create a vm using freebsd cloud image and connect to guest O= S terminal with virtio-console and socat(no X11). > When spawning the vm the unix socket indeed is created, however when I con= nect to it with socat nothing is being shown(not actions on any terminal com= mands 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. >=20 > Please advise, >=20 You can connect to the device inside the vm like I wrote and pass data to th= e socat connected socket on the outside (this is what I tested, please see m= y 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 n= mdm >> device. if you want to use virtio-console, it will create unix domain soc= kets >> not pseudo tty endpoints. from bhyve(8) we see: >>=20 >>> Virtio console device backends: >>> =E2=80=A2 >>> port1=3D/path/to/port1.sock[,portN=3D/path/to/port2.soc= k ...] >>> A maximum of 16 ports per device can b= e created. Every >>> port >>> is named and corresponds to a Unix domain socket create= d by >>> bhyve. bhyve accepts at most one connection per port a= t a >>> time. >>> Limitations: >>> =E2=80=A2 Due to lack of destructor= s in bhyve, sockets on the >>> filesystem must be cleaned up manually after bhyve >>> exits. >>> =E2=80=A2 There is no way to use th= e =E2=80=9Cconsole port=E2=80=9D feature, nor >>> the console port resize at present. >>> =E2=80=A2 Emergency write is advert= ised, but no-op at present. >> i know of no host-side client which will connect to these unix domain soc= kets >> and offer a cu-like user interface. "unidirectional" may be the experienc= e >> you'll get from "socat". >>=20 >> if what you're trying to accomplish is a graphical console, virtio-consol= e is >> not the way to do it. rather, you'll want "fbuf" to create a guest VGA/si= milar >> that gateways to a host VNC. >>=20 >> re: >>=20 >>> On Friday, February 14, 2025 9:55:23 PM UTC Petru Garstea wrote: >>> I tried with the following command, and got the same result. >>>=20 >>> */usr/sbin/bhyve -H -P -A -c 1 -m 1500M \ >>> -s 0,hostbridge \ >>> -s 6,virtio-console,0=3D/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* >>>=20 >>>=20 >>> I also able to connect but the bidirectional connection is not happening= >>>=20 >>> *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. >>>=20 >>> any ideas ? >>>=20 >>> Thanks >>>=20 >>> On 2/14/25 14:57, Michael Gmelin wrote: >>>> On Fri, 14 Feb 2025 14:21:07 -0500 >>>>=20 >>>> Petru Garstea wrote: >>>>> Hi, >>>>> I am trying to configure bhyve vm with support of virtio-console, the >>>>> following option is added to bhyve command line >>>>>=20 >>>>> *-s 3,virtio-console,port1=3D/test/console.sock >>>>>=20 >>>>> *However when trying to connect to socket with socat trere are no >>>>> input/ouptut is observed. >>>>>=20 >>>>> Has virtio-console ever worked ? >>>> Yes it works, I just tried it using sysutils/vm-bhyve (just add >>>> virt_console0=3D"Yes" to the configuration file). >>>>=20 >>>> 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=3D58:9c:fc:aa:aa:aa \ >>>> -s 6:0,virtio-console,0=3D/vms/freebsd14-test/vtcon.0 >>>>=20 >>>> I could connect to /vms/freebsd14-test/vtcon.0 using socat: >>>> socat - UNIX-CONNECT:/vms/freebsd14-test/vtcon.0 >>>>=20 >>>> Inside the vm it's /dev/vtcon/0. >>>>=20 >>>> -m >>=20 >=20