Welcome to the Linux Foundation Forum!

vncserver & vncviewer

Hi guys,
In chapter 30 Remote Graphical Login, it's suggested we try running vncserver, followed by vncviewer:1.

Each time I try vncviewer:1 (I have also tried 2, 3, 4, 5, 6, etc), I get a GUI popup "Unable connect to socket: Connection refused (111)". I looked around online and didn't find a ton of useful info. Is there some configuration file out there that I need to update for this to work?

vncserver output:

ronnie@mint-laptop:~$ vncserver

New 'mint-laptop:1 (ronnie)' desktop at :1 on machine mint-laptop

Starting applications specified in /etc/X11/Xvnc-session
Log file is /home/ronnie/.vnc/mint-laptop:1.log

Use xtigervncviewer -SecurityTypes VncAuth -passwd /home/ronnie/.vnc/passwd :1 to connect to the VNC server.

vncviewer:1 console output:

ronnie@mint-laptop:~$ vncviewer localhost:1

TigerVNC Viewer 64-bit v1.10.1
Built on: 2020-04-09 06:49
Copyright (C) 1999-2019 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.

Tue Feb  2 16:40:43 2021
 DecodeManager: Detected 4 CPU core(s)
 DecodeManager: Creating 4 decoder thread(s)
 CConn:       unable connect to socket: Connection refused (111)

GUI popup output:

unable connect to socket: Connection refused (111)

Comments

  • lee42x
    lee42x Posts: 380
    edited February 2021

    Hi rroberts,

    The output you shared from the vncviewer is indicating there is no vnc-server listening on the port. That is expected output when the vncviewer cannot find the server.

    Now the vncserver, did you set a password for the vncserver with the vncpasswd command? The password should be set before attempting to start the vncserver. Once the server is confirmed running , use another terminal session to run the vncviewer.

    Regards Lee

  • Thanks for helping. I did set the password with the vncpasswd command. When I check my ~/.vnc/mint-laptop:1.log file, I get the following, which does indicate it's running. I'm not quite Linux savvy to know how to check if a port is being blocked. (I don't have a firewall running on my pc)

    Wed Feb  3 14:28:59 2021
     vncext:      VNC extension running!
     vncext:      Listening for VNC connections on local interface(s), port 5901
     vncext:      created VNC server for screen 0
    X connection to :1 broken (explicit kill or server shutdown).
    
    Wed Feb  3 14:29:00 2021
     ComparingUpdateTracker: 0 pixels in / 0 pixels out
     ComparingUpdateTracker: (1:-nan ratio)
    Killing Xtigervnc process ID 30828... which seems to be deadlocked. Using SIGKILL!
    
  • Hi @rroberts ,

    I did a test on Ubuntu 18.04, the server started and I can get to the VNC GUI using vncviewer. BTW, what distro and version you are using?

    Let's see if the ports are open:

    Before starting vncserver:

    luis@ubuntu18server:~$ ss -tln
    State Recv-Q Send-Q Local Address:Port Peer Address:Port
    LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:*
    LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
    LISTEN 0 511 :80 *:
    LISTEN 0 128 [::]:22 [::]:*

    After started the vncserver:

    luis@ubuntu18server:~$ ss -tln
    State Recv-Q Send-Q Local Address:Port Peer Address:Port
    LISTEN 0 5 127.0.0.1:5901 0.0.0.0:*
    LISTEN 0 128 127.0.0.53%lo:53 0.0.0.0:*
    LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
    LISTEN 0 5 [::1]:5901 [::]:*
    LISTEN 0 511 :80 *:
    LISTEN 0 128 [::]:22 [::]:*

    Regards,
    Luis.

  • Ahh. Thank you. I was trying to find a command that would show the ports that were open. It appears my 5901 port is not listening for some reason.

    My distro is Linux Mint. I understand that some distros handle things better, but I'm trying to get better at addressing my issues, as that's something I'll need to do in the future.

    State   Recv-Q   Send-Q     Local Address:Port      Peer Address:Port  Process  
    LISTEN  0        4096           127.0.0.1:42631          0.0.0.0:*              
    LISTEN  0        10               0.0.0.0:3689           0.0.0.0:*              
    LISTEN  0        32         192.168.122.1:53             0.0.0.0:*              
    LISTEN  0        4096       127.0.0.53%lo:53             0.0.0.0:*              
    LISTEN  0        128              0.0.0.0:22             0.0.0.0:*              
    LISTEN  0        5              127.0.0.1:631            0.0.0.0:*              
    LISTEN  0        10                  [::]:3689              [::]:*              
    LISTEN  0        128                 [::]:22                [::]:*              
    LISTEN  0        5                  [::1]:631               [::]:*              
    
  • Hi @rroberts ,

    If I'm not wrong, Linux Mint comes with ufw by default (firewall). So let's check if it's enabled:

    sudo ufw status

    Regards,
    Luis.

  • Firewall is inactive.

  • Hi @rroberts ,

    I suggest to do a test on Ubuntu 18/20 or CentOS 8, so I can try to reproduce the issue, if any. Perhaps it's just your distro that's failing, but I don't have Linux Mint here to do a test case.

    Regards,
    Luis.

  • pluser
    pluser Posts: 1
    edited February 2021

    Hi there!
    I've same issue in my manjaro linux. Service does not start, listen to port

    Feb 13 11:01:54 manjaropluser sudo[3063]:   pluser : TTY=pts/1 ; PWD=/home/pluser ; USER=root ; COMMAND=/usr/bin/systemctl start vncserver@:1
    Feb 13 11:01:54 manjaropluser sudo[3063]: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1101 audit(1613203314.441:374): pid=3063 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="pluser" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1110 audit(1613203314.441:375): pid=3063 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:setcred grantors=pam_env,pam_fprintd acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1105 audit(1613203314.441:376): pid=3063 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
    Feb 13 11:01:54 manjaropluser audit[3063]: USER_START pid=3063 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
    Feb 13 11:01:54 manjaropluser systemd[1]: Starting Remote desktop service (VNC)...
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1006 audit(1613203314.458:377): pid=3072 uid=0 subj==unconfined old-auid=4294967295 auid=1001 tty=(none) old-ses=4294967295 ses=13 res=1
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1105 audit(1613203314.461:378): pid=3072 uid=0 auid=1001 ses=13 subj==unconfined msg='op=PAM:session_open grantors=pam_loginuid,pam_namespace,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="remote" exe="/usr/bin/vncsession" hostname=203.0.113.20 addr=203.0.113.20 terminal=? res=success'
    Feb 13 11:01:54 manjaropluser audit[3072]: USER_START pid=3072 uid=0 auid=1001 ses=13 subj==unconfined msg='op=PAM:session_open grantors=pam_loginuid,pam_namespace,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="remote" exe="/usr/bin/vncsession" hostname=203.0.113.20 addr=203.0.113.20 terminal=? res=success'
    Feb 13 11:01:54 manjaropluser vncsession[3072]: pam_unix(tigervnc:session): session opened for user remote(uid=1001) by (uid=0)
    Feb 13 11:01:54 manjaropluser systemd[1]: Started Remote desktop service (VNC).
    Feb 13 11:01:54 manjaropluser audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=vncserver@:1 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
    Feb 13 11:01:54 manjaropluser vncsession[3072]: vncsession: vncserver exited with status=71
    Feb 13 11:01:54 manjaropluser vncsession[3072]: pam_unix(tigervnc:session): session closed for user remote
    Feb 13 11:01:54 manjaropluser audit[3072]: USER_END pid=3072 uid=0 auid=1001 ses=13 subj==unconfined msg='op=PAM:session_close grantors=pam_loginuid,pam_namespace,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="remote" exe="/usr/bin/vncsession" hostname=203.0.113.20 addr=203.0.113.20 terminal=? res=success'
    Feb 13 11:01:54 manjaropluser sudo[3063]: pam_unix(sudo:session): session closed for user root
    Feb 13 11:01:54 manjaropluser audit[3063]: USER_END pid=3063 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
    Feb 13 11:01:54 manjaropluser audit[3063]: CRED_DISP pid=3063 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:setcred grantors=pam_env,pam_fprintd acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
    Feb 13 11:01:54 manjaropluser systemd[1]: vncserver@:1.service: Succeeded.
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1130 audit(1613203314.461:379): pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=vncserver@:1 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1106 audit(1613203314.461:380): pid=3072 uid=0 auid=1001 ses=13 subj==unconfined msg='op=PAM:session_close grantors=pam_loginuid,pam_namespace,pam_keyinit,pam_limits,pam_systemd,pam_unix acct="remote" exe="/usr/bin/vncsession" hostname=203.0.113.20 addr=203.0.113.20 terminal=? res=success'
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1106 audit(1613203314.461:381): pid=3063 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:session_close grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1104 audit(1613203314.461:382): pid=3063 uid=1000 auid=1000 ses=4 subj==unconfined msg='op=PAM:setcred grantors=pam_env,pam_fprintd acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/1 res=success'
    Feb 13 11:01:54 manjaropluser audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=vncserver@:1 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
    Feb 13 11:01:54 manjaropluser kernel: audit: type=1131 audit(1613203314.464:383): pid=1 uid=0 auid=4294967295 ses=4294967295 subj==unconfined msg='unit=vncserver@:1 comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
    

    Interesting things are "vncsession: vncserver exited with status=71" and "pam_systemd_home(sudo:account): Not a user managed by systemd-homed: No home for user pluser known"

    But somehow "vncserver@:1.service: Succeeded"

  • luisviveropena
    luisviveropena Posts: 1,249

    Hi @pluser ,

    Please check on topic "Target Linux Distributions", of Chapter 1 on LFS201, so you can work on a supported OS and we can provide the support you need.

    Thanks,
    Luis.

  • coop
    coop Posts: 916

    to be specific, we do not support either Mint or Manjaro--we just cannot support minor distros as it requires too much work. we do not disapprove of either distro. however, manjaro is very different as it is based on archlinux which is cutting edge and rolling, mint is a unneccesary clone of ubuntu which is built on debian, so there are two structures built on top of a steady foundation, and would be more likely to work. so good luck -- i am sure this is fixable but we have neither the systems or time to sort out this corner case

Categories

Upcoming Training