cockpit-machines icon indicating copy to clipboard operation
cockpit-machines copied to clipboard

Cannot connect to VNC console using cockpit host in WSL2

Open ccy opened this issue 1 year ago • 0 comments

Explain what happens

I try to manage a remote RockyLinux via cockpit service in WSL2.

My first attempt is launch a podman container in WSL2:

podman run --rm -e COCKPIT_SSH_KEY_PATH=/root/.ssh/id_ed25519 -v ~/.ssh:/root/.ssh -v ~/.ssh/known_hosts:/etc/ssh/ssh_known_hosts -p 9090:9090 quay.io/cockpit/ws

Using browser to navigate to localhost:9090 launch the cockpit UI, after enter the remote host name and credential, I can manage the remote host. I can also manage the KVM machine in remote host via the VNC console too.

Next, I stop the podman container and install cockpit in my WSL2. These are the packages installed:

dnf list cockpit* --installed
Installed Packages
cockpit.x86_64                  286.1-1.el9       @baseos
cockpit-bridge.x86_64           286.1-1.el9       @baseos
cockpit-machines.noarch         284.1-1.el9       @appstream
cockpit-packagekit.noarch       286.1-1.el9       @appstream
cockpit-pcp.x86_64              286.1-1.el9       @appstream
cockpit-system.noarch           286.1-1.el9       @baseos
cockpit-ws.x86_64               286.1-1.el9       @baseos

I start the cockpit with systemctl start cockpit.socket. The cockpit is listen to 9090/TCP

Again, I can use browser access to localhost:9090 and manage the remote host without issue. The only problem I face is I can't launch the VNC console in this cockpit setup.

The browser console show this error and I click the VNC console's Connect button:

Failed when connecting: Connection closed (code: 1001, reason: not-found) index.js:2:2843141
    _fail https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    _socketClose https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    onclose https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    (Async: EventHandlerNonNull)
    attach https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    open https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    _connect https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    _updateConnectionState https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    gA https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    R https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    Ne https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    He https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    jn https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    jn https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    Bn https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    Xn https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    cu https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    Ae https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    Xn https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    Gt https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
    Kt https://localhost:9090/cockpit/$667d6fc0cad95883b1c62de447d620f201f503a6059e5629f3fcd01af259c860/machines/index.js:2
Connection lost:  
disconnect { target: null, isTrusted: false, detail: {…}, eventPhase: 0, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, timeStamp: 8502449, … }
index.js:2:2893973

Version of Cockpit

286.1

Where is the problem in Cockpit?

Applications

Server operating system

other

Server operating system version

5.15.90.1-microsoft-standard-WSL2

What browsers are you using?

Edge

System log

No response

ccy avatar Jul 16 '23 02:07 ccy