Solvedtigervnc Failed to connect to Socket

Hi I'm running TigerVNC on my centos server. I have 7 user accounts on the server but only ONE is not working. It was previously working just fine. Have tried connecting from multiple remote machines with vncviewer and restarted the vnc server and the physical server.

The error log from the failed account:

Xvnc TigerVNC 1.1.0 - built May 11 2016 13:01:55
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11704000, The X.Org Foundation


Thu Feb  1 13:26:32 2018
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5907
 vncext:      created VNC server for screen 0
Couldn't exec xfce-session: Permission denied
gnome-session[19706]: WARNING: Could not make bus activated clients aware of DISPLAY=:7 environment variable: Failed to connect to socket /tmp/dbus-FZpL5vLpNq: Connection refused
gnome-session[19706]: WARNING: Could not make bus activated clients aware of GNOME_DESKTOP_SESSION_ID=this-is-deprecated environment variable: Failed to connect to socket /tmp/dbus-FZpL5vLpNq: Connection refused
gnome-session[19706]: WARNING: Could not make bus activated clients aware of SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/19706,unix/unix:/tmp/.ICE-unix/19706 environment variable: Failed to connect to socket /tmp/dbus-FZpL5vLpNq: Connection refused

Error log from working account:

Xvnc TigerVNC 1.1.0 - built May 11 2016 13:01:55
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11704000, The X.Org Foundation


Thu Feb  1 13:26:11 2018
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0
GNOME_KEYRING_SOCKET=/tmp/keyring-lnEHz3/socket
SSH_AUTH_SOCK=/tmp/keyring-lnEHz3/socket.ssh
GNOME_KEYRING_PID=17324
Cleaned 26 files 9 still live

(process:17382): GLib-WARNING **: goption.c:2132: ignoring no-arg, optional-arg or filename flags (8) on option of type 0

(process:17382): GLib-WARNING **: goption.c:2132: ignoring no-arg, optional-arg or filename flags (8) on option of type 0

Found similar issues here:
Failed to connect to socket /tmp/dbus-xxx: Connection refused
[xfce4-session] dbus 1.10 prevents X starting correctly
vnc, Could not connect to session bus
VNC error: “Could not connect to session bus: Failed to connect to socket”

But I wasn't sure exactly which portions apply to me. Seems many of these people are using X11. I did add a line to the config file in /home/user7/.vnc/xstartup

Based on the links above, I added:
dbus-launch xfce-session
after lines

unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

entire config file reads:

#!/bin/sh

[ -r /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
export LANG
export SYSFONT
vncconfig -iconic &
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
dbus-launch xfce-session
OS=`uname -s`
if [ $OS = 'Linux' ]; then
  case "$WINDOWMANAGER" in
    *gnome*)
      if [ -e /etc/SuSE-release ]; then
        PATH=$PATH:/opt/gnome/bin
        export PATH
      fi
      ;;
  esac
fi
if [ -x /etc/X11/xinit/xinitrc ]; then
  exec /etc/X11/xinit/xinitrc
fi

Thanks. I don't often have to deal with sockets so this is outside my wheelhouse.
edit: formatting, clarification.

18 Answers

✔️Accepted Answer

It works for me, when I start XFCE with this command:

dbus-launch /usr/bin/startxfce4 &

in .vnc/xstartup of the user which starts vncserver.

Other Answers:

If you use anaconda, you may try this way:

conda uninstall dbus

restart vnc and login in again.

@hubutui I think the dbus in Anaconda influence this issue. When I uninstall it, it worked.

@mysteryzoz You might wanna remove anaconda installation path from you PATH environment.