how to use the tigervnc as a service

Hello,

I need some help to get tigervnc started.

I have a PI and a laptop. I want to connect to the PI from my laptop. This is what i do:

From the laptop:
> ssh -l userPI 192.168.1.2 -L 5901:192.168.1.2:5901

At the laptop:
> vncviewer localhost:5901

Error at the laptop:
Authorization required, but no authorization protocol specified

Sun Mar 6 09:04:07 2022
DecodeManager: Detected 4 CPU core(s)
DecodeManager: Creating 4 decoder thread(s)
CConn: Connected to host localhost port 5901
CConn: End of stream
CConn: The connection was dropped by the server before the session could be established.

Error at the PI:
> channel 3: open failed: connect failed: Connection refused

At the PI, a few commands to show the settings:
> cat .vnc/config
geometry=1440x960
depth=32
localhost
alwaysshared

> cat /etc/tigervnc/vncserver.users
:1=userPI

(the service is started and runnung:)

> sudo systemctl status vncserver@\:1.service
[sudo] password for root:
vncserver@:1.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/vncserver@.service; disabled; vend>
Active: active (running) since Sat 2022-03-05 07:32:19 CET; 1 day 1h ago
Process: 30791 ExecStart=/usr/libexec/vncsession-start :1 (code=exited, sta>
Main PID: 30800 (vncsession)
Tasks: 0 (limit: 4465)
CPU: 36ms
CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
‣ 30800 /usr/sbin/vncsession admin :1

Mar 05 07:32:19 Fileserver systemd[1]: Starting Remote desktop service (VNC)…
Mar 05 07:32:19 Fileserver systemd[1]: Started Remote desktop service (VNC).

I have already set up passwords with vncpasswd

At the following site:
https://github.com/TigerVNC/tigervnc/blob/master/unix/vncserver/HOWTO.md
the option ‘securitytypes=vncauth,tlsvnc’ is shown.

Trying this:
At the PI:
> cat .vnc/config
geometry=1440x960
securitytypes=vncauth,tlsvnc
depth=32
localhost
alwaysshared

> sudo systemctl restart vncserver@\:1.service

At the Laptop:
> vncviewer localhost:5901

TigerVNC Viewer 64-bit v1.12.0
Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Authorization required, but no authorization protocol specified

Sun Mar 6 09:15:40 2022
DecodeManager: Detected 4 CPU core(s)
DecodeManager: Creating 4 decoder thread(s)
CConn: Connected to host localhost port 5901
CConn: End of stream
CConn: The connection was dropped by the server before the session could
be established.

Same error. This gave no solution.

I am using a different user using VNC_USERNAME=“userLAPTOP” does not help. Same errors.

I am stuck. Help is appriciated.

Hi
I think this recent thread may help: https://forums.opensuse.org/showthread.php/566884-vncserver-changes-with-last-snapshot

Thanks for the response.

The difference i see is a / after the @.
i used previous (note the “/” ):

> sudo systemctl restart vncserver@\:1.service

In the thread it was:

> start vncserver@:1.service

I never used root as a login to VNC, so this error i didn’t make.

I did the same without the “/”. The output is the same, unfortunately.
Maybe you meant something else?
Am i missing something in the tread?

[HR][/HR]Below what i did just now:

On the PI:

> sudo systemctl start vncserver@:1.service
> sudo systemctl status vncserver@:1.service 
● vncserver@:1.service - Remote desktop service (VNC)
     Loaded: loaded (/usr/lib/systemd/system/vncserver@.service; disabled; vend>
     Active: active (running) since Sun 2022-03-06 16:10:24 CET; 29s ago
    Process: 337 ExecStart=/usr/libexec/vncsession-start :1 (code=exited, statu>
   Main PID: 347 (vncsession)
      Tasks: 0 (limit: 4465)
        CPU: 38ms
     CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service
             ‣ 347 /usr/sbin/vncsession admin :1

Mar 06 16:10:24 Fileserver systemd[1]: Starting Remote desktop service (VNC)...
Mar 06 16:10:24 Fileserver systemd[1]: Started Remote desktop service (VNC).

On the Laptop:

> vncviewer localhost:5901

TigerVNC Viewer 64-bit v1.12.0
Copyright (C) 1999-2021 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Authorization required, but no authorization protocol specified

Sun Mar  6 16:10:31 2022
 DecodeManager: Detected 4 CPU core(s)
 DecodeManager: Creating 4 decoder thread(s)
 CConn:       Connected to host localhost port 5901
 CConn:       End of stream
 CConn:       The connection was dropped by the server before the session could
              be established.

Error on the PI:

> channel 3: open failed: connect failed: Connection refused

Information about the settings on the PI:

> cat .vnc/config
geometry=1440x960
securitytypes=vncauth,tlsvnc
depth=32
localhost
alwaysshared
> cat /etc/tigervnc/vncserver.users 
:1=userPI

I got it.

The journal on the PI gives a:

Mar 06 16:10:31 Fileserver sshd[32739]: error: connect_to 192.168.1.2 port 5901: failed.

So the error is on ssh and not VNC.

Logging in with the following works:

> ssh -l  userPI L 5901:localhost:5901 192.168.1.2

What i did previous worked a long time, until now.

> ssh -l admin 192.168.1.2 -L 5901:192.168.1.2:5901

Note that the line of code above does not work!

Looking at this, the error found on the laptop is:

CConn:       The connection was dropped by the server before the session could
              be established

There never was a connection, so it was not dropped by the VNC server. SSH dropped this. I don’t know if these IP messages differ (i did not track this with tcpdump or something). If the IP messages differ, this is something to improve VNC, so that a better error is given. It would have helped me.