VNC viewer issue - showing black screen

Vnc viewer is showing black screen. Following are the configuration : Please figure out the issue ?

cat /root/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
 unset SESSION_MANAGER
 exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &
====================================================================



vi /etc/sysconfig/vncservers

 VNCSERVERS="2:root"

 VNCSERVERARGS[2]="-geometry 1024x768"

=================================================================

Run level :

chkconfig --list vncserver
vncserver       0:off   1:off   2:on    3:on    4:on    5:on    6:off

I figured I should answer my own question...in case anyone else runs into a similar problem. I just added localhost to xhost, and voila! took me a lot of hunting around to find this solution, so maybe this'll help a couple of you.

chmod 775 xstartup

I saw the same symptom. For me, the issue was how I used bsub to invoke vncserver.

Using 'bsub -Is' caused a black screen. Using 'bsub -I' fixed the issue.


Same issue. It seems that there is a dbus-launch in anaconda2/bin. If a user has that in their path vncserver fails to find the correct dbus-launch - /usr/bin/dbus-launch. The Xvnc starts but none of the window manager applications that depend on dbus. My fix was to create a /usr/local/bin/vncserver:

#!/bin/bash
#added because there is a dbus command in /usr/local/anaconda2/bin !!!!
export PATH=/usr/bin:/usr/local/sbin:/usr/sbin
# added because nvidia driver overwrites these - tkovacs 5/23/19
export LD_LIBRARY_PATH=/usr/local/vnclib:$LD_LIBRARY_PATH
/usr/bin/vncserver $*