Problem: On CentOS 4.8, logging into VNC session on server for first time does not show Gnome session.
Solution: Edit the VNC xstartup file.
Edit the ~/.vnc/startup and replace the line
# xterm -geometry 80×24+10+10 -ls -title “$VNCDESKTOP Desktop” &
twm &
with
gnome-session &
When vncserver is first run, the xstartup file should be similar to the following:
[oracle@localhost ~]$ 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 &
After replacing the last line, the xstartup file should now appear as follows:
[oracle@localhost ~]$ 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" & gnome-session &
After running vncserver, if the GNOME desktop GUI does not load when you connect with the VNC viewer, then try replacing the contents of xstartup with the following:
#!/bin/sh # Add the following line to ensure you always have an xterm available. ( while true ; do xterm ; done ) & # 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" & gnome-session &
Note that you need to kill the vncserver session and restart it for the changes to take effect. For example, to kill the vncserver session 1, issue the following command:
vncserver -kill :1
Then rerun ‘vncserver’ to restart the VNC server session and reconnect with the VNC viewer.
Reference:
http://wiki.centos.org/HowTos/VNC-Server
Recent Comments