Score:0

VNC on 21.04 now gives me this error: Unable to init server: Could not connect: Connection refused

cn flag

I have machine with only a Ubuntu 21.04 setup on it. It was at 20.04 before and I used tigerVNC to get VNC to run. All was working when I did an upgrade command and it moved me to 21.04 which I did not expect. Now everything else works but my vncserver command cannot start a vnc session. Instead I get the error:

New Xtigervnc server 'EmilieServer:3 (michel)' on port 5903 for display :3.
Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /home/michel/.vnc/passwd EmilieServer:3 to connect to the VNC server.


=================== tail /home/michel/.vnc/EmilieServer:5903.log ===================
====================================================================================

Session startup via '/home/michel/.vnc/xstartup' cleanly exited too early (< 3 seconds)!

Maybe try something simple first, e.g.,
    tigervncserver -xstartup /usr/bin/xterm
The X session cleanly exited!
Killing Xtigervnc process ID 23027... success!

Looking at the log for this vnc session I get this information.

Xnvc TigerVNC 1.11.0 - built 2021-09-20 18:41
Copyright (C) 1999-2020 TigerVNC Team and many others (see README.rst)
See https://www.tigervnc.org for information on TigerVNC.
Underlying X server release 12011000, The X.Org Foundation


Thu Oct 28 22:03:30 2021
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5903
 vncext:      created VNC server for screen 0
3NI3X0 New Xtigervnc server 'EmilieServer:3 (michel)' on port 5903 for display :3.
3NI3X0 Use xtigervncviewer -SecurityTypes VncAuth,TLSVnc -passwd /home/michel/.vnc/passwd EmilieServer:3 to connect to the VNC server.
 ComparingUpdateTracker: 0 pixels in / 0 pixels out
 ComparingUpdateTracker: (1:-nan ratio)
/usr/bin/startxfce4: X server already running on display :3
xrdb: Connection refused
xrdb: Can't open display ':3'
dbus-update-activation-environment: warning: error sending to systemd: org.freedesktop.DBus.Error.Spawn.ChildExited: Process org.freedesktop.systemd1 
exited with status 1
Unable to init server: Could not connect: Connection refused
xfce4-session: Cannot open display: .
Type 'xfce4-session --help' for usage.

My start file is simple and it worked in 20.04.

#!/bin/sh
set -xv
xrdb $HOME/.Xresources
xsetroot -solid grey
#exec /etc/X11/xinit/xinitrc
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
#export XKL_XMODMAP_DISABLE=1
dbus-launch /usr/bin/startxfce4 

Does anyone have any idea why I encountered this problem after the upgrade? I have spend two days on this can can't find anything that will help. This server was setup so my daughter could do a university research projects and she needs it to continue her work. Any help would be really appreciated.

codlord avatar
ru flag
I don't know for sure but it could well be because from 21.04 the default display server changed to Wayland. So if you were using X11/Xorg before you could find yourself now using Wayland without knowing. On terminal type `echo $XDG_SESSION_TYPE` to see which you are currently using. I use Barrier KVM software and that too does not work (at least not yet) under Wayland, and what barrier does is similar to what VNC does in some ways. If you are using Wayland try logging off and logging back in using X11/Xorg, See here for a good guide: https://itsfoss.com/switch-xorg-wayland/
cn flag
My setup is not headless so I used one of the terminals in the UI to check and the variable I checked using a shell from my desk top and my XDG_SESSION_TYPE is set to x11. This seems to indicate I am not using Wayland then.
codlord avatar
ru flag
Yes you are using X11 and not Wayland. The log says `xrdb: Can't open display ':3'` so have you tried a VNC connection with another display such as :0 or :1 or :2 etc? Just thinking maybe something in the upgrade changed and there is no longer a display number 3?
cn flag
I added an update section in the original statement. I was able to get a different xstart to run but it has its own set of issues. Yes I have tried :1, :2 up to :4. vncserver automatically increments these so it won't increase unless I get one to start. My new xstart is able to do that so I was able to test higher numbers and that does not help.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.