Re: VNC Viewer on Windows: Unable to access VMs GUI

From: Mario Marietto <marietto2008_at_gmail.com>
Date: Tue, 12 Mar 2024 12:00:01 UTC
Try the procedure explained below to have the latest bhyve version well
patched. Lets create these script files :

1) build_branch_releng-140 :

set -e
set -u

readonly script_path="$(cd "$(dirname "${0}")" && pwd)"
readonly branch="${1?Missing <branch>$(usage)}"
shift
echo $branch

cd /usr/corvin-src-releng-140
git fetch --all --prune
git checkout -f "${branch}"

${script_path}/build_releng_140 "$@"


2) build_releng_140 :


#!/bin/sh
usage() {
        cat >&2 << EOF
Usage: ${0} [--no-bhf] [--reboot] [--verbose] [--without-kernel]
        Builds bhyve
EOF
        exit 1
}

build_module() {
        local _path
        _path="${1}"

        # change to module path
        cd "${_path}"

        # clean module
        if test "${clean}" = "true"; then
                make clean > "${cmd_redirect}" 2>&1
        fi

        # build module
        make > "${cmd_redirect}" 2>&1

        # install module
        make install > "${cmd_redirect}"
}

build() {
        build_module "${src_dir}/include"
        build_module "${src_dir}/lib/libvmmapi"
        build_module "${src_dir}/sys/modules/vmm"

        # build kernel
        if test "${with_kernel}" = "true"; then
                cd "${src_dir}"
                local kern_opts
                kern_opts="-j$(sysctl -n hw.ncpu)"
                if test "${with_bhf}" = "true"; then
                        kern_opts="${kern_opts} KERNCONF=BHF"
                fi
                if ! test "${clean}" = "true"; then
                        kern_opts="${kern_opts} NO_CLEAN=YES"
                fi
                make kernel ${kern_opts} > "${cmd_redirect}" 2>&1
        fi

        build_module "${src_dir}/usr.sbin/bhyve"
        build_module "${src_dir}/usr.sbin/bhyvectl"
        build_module "${src_dir}/usr.sbin/bhyveload"

        if test "${with_reboot}" = "true"; then
                reboot
        fi
}

set -e
set -u

while test $# -gt 0; do
        case "${1-}" in
                --clean)
                        clean="true"
                        shift
                        ;;
                --reboot)
                        with_reboot="true"
                        shift
                        ;;
                --src-dir=*)
                        src_dir="${1#*=}"
                        shift
                        ;;
                --verbose)
                        cmd_redirect="/dev/stdout"
                        shift
                        ;;
                --without-bhf)
                        with_bhf="false"
                        shift
                        ;;
                --without-kernel)
                        with_kernel="false"
                        shift
                        ;;
                *)
                        usage
                        ;;
        esac
done

readonly clean="${clean-"false"}"
readonly cmd_redirect="${cmd_redirect-"/dev/null"}"
readonly src_dir="${src_dir-"/usr/corvin-src-releng-140"}"
echo $src_dir
readonly with_bhf="${with_bhf-"true"}"
readonly with_kernel="${with_kernel-"true"}"
readonly with_reboot="${with_reboot-"false"}"
build


3) compile-bhyve-releng-140 :


cd /usr/
mv src src-old
git clone https://github.com/beckhoff/freebsd-src /usr/corvin-src-releng-140
cd /usr/corvin-src-releng-140
/build_branch_releng-140 origin/phab/corvink/14.0/nvidia-wip --without-bhf
--verbose


and run : ./compile-bhyve-releng-140 (on FreeBSD 14.0)

On Tue, Mar 12, 2024 at 12:53 PM Mario Marietto <marietto2008@gmail.com>
wrote:

> Maybe because some patches haven't been upstreamed to 14.0 branch.
>
> On Tue, Mar 12, 2024 at 12:49 PM Odhiambo Washington <odhiambo@gmail.com>
> wrote:
>
>> Actually, I am trying to figure out why they do not work after upgrade
>> from FreeBSD 13 to 14. They used to work before.
>> History:
>> 1. My FreeBSD host lives in a Data Centre several kilometers from me. I
>> only access it via SSH.
>> 2. My FreeBSD host does not have a keyboard, mouse, or screen attached to
>> it.
>> 3. I use VNC Viewer to connect to the VMs like HOST_IP:PORT
>>
>>
>> On Tue, Mar 12, 2024 at 2:36 PM Mario Marietto <marietto2008@gmail.com>
>> wrote:
>>
>>> Hello my friend Odhiambo,
>>>
>>> you can try to pass your keyboard and mouse to a specific USB to pci
>>> adapter,using an USB splitter to attach both the input devices. Actually
>>> I'm using the one integrated on my nvidia gpu,RTX 2080 ti,that's :
>>>
>>> 02:00.0 VGA compatible controller: NVIDIA Corporation TU102 [GeForce RTX
>>> 2080 Ti]
>>> 02:00.1 Audio device: NVIDIA Corporation TU102 High Definition Audio
>>> Controller
>>> *02:00.2 USB controller: NVIDIA Corporation TU102 USB 3.1 Host
>>> Controller*
>>> 02:00.3 Serial bus controller: NVIDIA Corporation TU102 USB Type-C UCSI
>>> Controller
>>>
>>> For sure you will add the PCI address of the board between your bhyve
>>> parameters,for example in my case :
>>>
>>> -s 8:2,passthru,2/0/2 \
>>>
>>> A single hardware solution would be a pcie riser which splits the pcie
>>> port.
>>>
>>>
>>> I've asked for a good USB controller some time ago :
>>>
>>>
>>>
>>> https://forums.freebsd.org/threads/im-looking-for-a-good-usb-controller-3-0-4-ports-self-powered-compatible-with-freebsd.83323/
>>>
>>>
>>> If it’s only mouse and keyboard you could use bhyves virtio-input
>>> emulation.
>>>
>>>
>>> Corvin included virtio-input support in his github.
>>>
>>>
>>> He committed virtio-input to 13.2 and 14.0 upstream.
>>>
>>>
>>> From “man bhyve”
>>>
>>>
>>>
>>> https://www.freebsd.org/cgi/man.cgi?query=bhyve&apropos=0&sektion=8&manpath=FreeBSD+14.0-CURRENT&arch=default&format=html
>>> ):
>>>
>>>
>>>             Virtio      input device backends:
>>>
>>>
>>>
>>>             */dev/input/eventX*
>>>
>>>                        Send input    events of */dev/input/eventX* to
>>> guest
>>>
>>>                        by      VirtIO Input Interface.
>>>
>>> On Tue, Mar 12, 2024 at 11:39 AM Odhiambo Washington <odhiambo@gmail.com>
>>> wrote:
>>>
>>>>
>>>> Even with this, my mouse pointer doesn't work:
>>>>
>>>> # Linux Guest
>>>> bhyve -S -c sockets=2,cores=2,threads=2 -m 4G -w -H -A \
>>>> -s 0,hostbridge \
>>>> -s 3,ahci-cd,/usr/local/bhyve-vms/.iso/debian-12.5.0-amd64-DVD-1.iso \
>>>> -s 4,virtio-blk,/usr/local/bhyve-vms/Debian/debian.img \
>>>> -s 5,virtio-net,tap4 \
>>>> -s 8,hda,play=/dev/dsp,rec=/dev/dsp \
>>>> -s 29,fbuf,tcp=0.0.0.0:5905,w=1024,h=768 \
>>>> -s 30,xhci,tablet \
>>>> -s 31,lpc -l com1,stdio \
>>>> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
>>>> debian
>>>>
>>>>
>>>>
>>>> On Wed, Feb 14, 2024 at 3:47 PM Mario Marietto <marietto2008@gmail.com
>>>> <marietto2008@gmailcom>> wrote:
>>>>
>>>>> -s 3,fbuf,tcp=0.0.0.0:59 <http://0.0.0.0:5915>*15*,w=1600,h=950 \
>>>>> -s 10,virtio-net,tap*15* \
>>>>> *vm15* < /dev/null & sleep 2 && vncviewer *0:15*
>>>>>
>>>>> On Wed, Feb 14, 2024 at 1:19 PM Odhiambo Washington <
>>>>> odhiambo@gmail.com> wrote:
>>>>>
>>>>>> Hellos,
>>>>>>
>>>>>> When I was still on FreeBSD 13.2-RELEASE I was able to access some
>>>>>> Linux VMs GUI using VNC Viewer on my Windows PC.
>>>>>> After I upgraded to 14-RELEASE, this changed: I can connect to the
>>>>>> VMs, but the GUI desktop is frozen. The mouse cursor isn't moving at all
>>>>>> and the Desktop doesn't load like before.
>>>>>> I start all my VMs the same way:
>>>>>>
>>>>>> bhyve -c N -m NG -w -H \
>>>>>> -s 0,hostbridge \
>>>>>> -s 4,virtio-blk,/usr/local/bhyve-vms/DISTRONAME/distroname.img \
>>>>>> -s 5,virtio-net,tapN \
>>>>>> -s 8,hda,play=/dev/dsp,rec=/dev/dsp \
>>>>>> -s 29,fbuf,tcp=0.0.0.0:59XX,w=1680,h=1050 \
>>>>>> -s 30,xhci,tablet \
>>>>>> -s 31,lpc -l com1,stdio \
>>>>>> -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
>>>>>> distroname
>>>>>>
>>>>>> I would then connect to a.b.c.d:59xx using VNC Viewer and I'd get the
>>>>>> Linux/Windows Desktop.
>>>>>> Not anymore!
>>>>>>
>>>>>> Is there something I need to do to fix the issue?
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>> Odhiambo WASHINGTON,
>>>>>> Nairobi,KE
>>>>>> +254 7 3200 0004/+254 7 2274 3223
>>>>>>  In an Internet failure case, the #1 suspect is a constant: DNS.
>>>>>> "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
>>>>>> [How to ask smart questions:
>>>>>> http://www.catb.org/~esr/faqs/smart-questions.html]
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Mario.
>>>>>
>>>>
>>>>
>>>> --
>>>> Best regards,
>>>> Odhiambo WASHINGTON,
>>>> Nairobi,KE
>>>> +254 7 3200 0004/+254 7 2274 3223
>>>>  In an Internet failure case, the #1 suspect is a constant: DNS.
>>>> "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
>>>> [How to ask smart questions:
>>>> http://www.catb.org/~esr/faqs/smart-questions.html]
>>>>
>>>
>>>
>>> --
>>> Mario.
>>>
>>
>>
>> --
>> Best regards,
>> Odhiambo WASHINGTON,
>> Nairobi,KE
>> +254 7 3200 0004/+254 7 2274 3223
>>  In an Internet failure case, the #1 suspect is a constant: DNS.
>> "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-)
>> [How to ask smart questions:
>> http://www.catb.org/~esr/faqs/smart-questions.html]
>>
>
>
> --
> Mario.
>


-- 
Mario.