LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   VNC - blank grey screen (https://www.linuxquestions.org/questions/linux-newbie-8/vnc-blank-grey-screen-730224/)

jnojr 06-02-2009 02:41 PM

VNC - blank grey screen
 
I have a host running CentOS 5 Final on which I installed vnc-server I connect to it with ssh (PuTTY 0.60) with port 5900 local forwarded to port 5902 on the remote CentOS host. I can connect with tightvnc 1.3.10 I used to have an xterm, and I launched Firefox and used it for a while. I managed to close Firefox and the xterm. Now, tightvnc shows me an empty grey screen with checkboxes for "Accept clipboard from viewers", "Send clipboard to viewers", and "Send primary selection to viewers".

How do I at least get an xterm back? If I run "xterm &" from the SSH session, I get "X connection to localhost:10.0 broken (explicit kill or server shutdown)." I do not recall having had to fiddle with $DISPLAY to get VNC working, and $DISPLAY certainly did not change from when I had an xterm to when I could not get another.

bathory 06-03-2009 08:31 AM

You can use the following ~/.vnc/xstartup file:
Quote:

#!/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" &
startx &
exec gnome-session &
to get a gnome desktop

Regards

jnojr 06-03-2009 10:40 AM

I have:

Quote:

[joliver@ns ~]$ cat .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 &
So... what do I need to do to get it to actually execute that???

pwc101 06-03-2009 10:54 AM

Put that in the xstartup file in the hidden directory .vnc (~/.vnc).

bathory 06-03-2009 11:07 AM

Remove or comment out the line "twm &" and use "exec gnome-session & " to start in gnome

jnojr 06-03-2009 11:12 AM

Quote:

Originally Posted by pwc101 (Post 3561802)
Put that in the xstartup file in the hidden directory .vnc (~/.vnc).

Uhhh...

[joliver@ns ~]$ cat .vnc/xstartup

jnojr 06-03-2009 11:13 AM

Quote:

Originally Posted by bathory (Post 3561817)
Remove or comment out the line "twm &" and use "exec gnome-session & " to start in gnome

Why? I do not have GNOME installed.

bathory 06-03-2009 11:19 AM

Isn't gnome the default DE for Centos?
Anyway if you don't have gnome, you can use "startkde &" or "startxfce4 &" and so on, depending of your DE.

pwc101 06-03-2009 11:26 AM

Quote:

Originally Posted by jnojr (Post 3561821)
Uhhh...

[joliver@ns ~]$ cat .vnc/xstartup

Ok, so make the file.

edit: my bad. As above, remove the twm& line and replace with startkde, startxfce or whatever floats your boat. Here's mine for reference:
Code:

pwc101@peter:~/src/build/x86_64> cat ~/.vnc/xstartup
#!/bin/sh

#xrdb $HOME/.Xresources
#xsetroot -solid grey
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &

#startkde &
#startxfce4 &
#startfluxbox &
#fvwm2 &
#icewm-session &
startlxde &
#xfce4-panel &
pwc101@peter:~/src/build/x86_64>

At the moment I'm using LXDE, but I can easily change it to xfce or kde or fluxbox or fvwm2 etc.

jnojr 06-03-2009 12:12 PM

Quote:

Originally Posted by pwc101 (Post 3561840)
As above, remove the twm& line and replace with startkde, startxfce or whatever floats your boat.

I do not have KDE or xfce or any other fancy desktop manager installed. I don't want the overhead, and I don't care about the eye candy. All I'm looking for is for an xterm to be started, like it used to be before I managed to close it.

pwc101 06-03-2009 12:43 PM

Quote:

Originally Posted by jnojr (Post 3561888)
I do not have KDE or xfce or any other fancy desktop manager installed. I don't want the overhead, and I don't care about the eye candy. All I'm looking for is for an xterm to be started, like it used to be before I managed to close it.

OK, I just tested this, and it launched just a grey screen and an xterm.
Code:

pwc101@peter:~/src/build/x86_64> !cat
cat ~/.vnc/xstartup
#!/bin/sh

xrdb $HOME/.Xresources
xsetroot -solid grey
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &

I presume from your description this is what you wanted.

You will need to restart your vnc server for this to be applied. I don't know of any way of launching an xterm from within a simple xsetroot-type environment.

jnojr 06-03-2009 01:04 PM

Quote:

Originally Posted by pwc101 (Post 3561914)
OK, I just tested this, and it launched just a grey screen and an xterm.

Yup... that's what I used to get. Now, I just get the grey screen... no xterm.

Quote:

You will need to restart your vnc server for this to be applied. I don't know of any way of launching an xterm from within a simple xsetroot-type environment.
Huh!

I'm positive I had restarted vncserver before. I did it just now, to say that I had... and my xterm is back!

Thanks for your persistence! :-)

pwc101 06-03-2009 01:36 PM

Quote:

Originally Posted by jnojr (Post 3561931)
Thanks for your persistence! :-)

Glad we got there in the end :)

Augusst 09-20-2009 01:02 AM

I had the same issue with VNC running on an VPS and I fixed by simply changing the .vnc/xstartup file from (without the quotes):

"#!/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 &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
x-window-manager &"

To simply:

"#!/bin/sh

startkde &"

At first I tried leaving the initial code and adding this last one under the last line (x-window-manager &) although it was taking much longer to start and after a few restarts it would even start again.

With this short code it starts fast and smooth.

Hope this helps :)

sien 12-15-2009 03:08 PM

make sure xtartup has executable permissions
 
Blank desktop means vnc couldn't find a valid window manager.
xstartup may look ok but if it doesn't have executable permissions, vnc won't read xstartup properly. vnc log file should indicate this.
Quick fix is to do
chmod +x xstartup

If permissions are correct, make sure paths to window manager are correct.
Quick way to check is do a which window_mgr_name to see if it is found and the path is correct in xstartup.
For instance:
%which gnome-session
returns this on my server
/usr/bin/gnome-session

Check that this path is correct in xstartup


All times are GMT -5. The time now is 09:24 PM.