LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to use: vncserver and vncviewer (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-use-vncserver-and-vncviewer-934826/)

linuxandtsm 03-16-2012 01:09 PM

how to use: vncserver and vncviewer
 
Hi all,

Installed vncserver rpm on RHEL5 and trying to start vncviewer (installed realvnc on windows box) for a user and getting this error:

Code:

unable to connect to host: Connection refused (10061)
I stopped the firewall
Code:

]# service iptables status
Firewall is stopped.

MORE info:
Code:

]# rpm -qa |grep vnc
vnc-server-4.1.2-14.el5_5.4
vnc-4.1.2-14.el5_5.4

entry in /etc/sysconfig/vncservers

 VNCSERVERS="1:admin"
 VNCSERVERARGS[1]="-geometry 800x600 -depth 16"

and

]# more /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 &

Then as "admin" user
Code:

$ vncpasswd
Password:
Verify:

Then started vncserver as admin user

$ vncserver :1

New 'hostname:1 (admin)' desktop is hostname:1

Starting applications specified in /home/admin/.vnc/xstartup
Log file is /home/admin/.vnc/hostname:1.log

and

$ more /home/admin/.vnc/xstartup
#!/bin/sh

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

I am confused how to use this VNC ?

Does the RHEL server should be running at runlevel 5 to use VNC ?
it is currently at runlevel 3.



Thanks in advance!

eSelix 03-16-2012 01:49 PM

Show log /home/admin/.vnc/hostname:1.log You can also check if vncviewer works on localhost. And you did not mentioned: are you trying to connect to port 5901? Like that:
Code:

vncviewer SERVER_IP:1

Celyr 03-16-2012 01:52 PM

You have started vncserver on the desktop 1 so the port will be default+1.
You can see wich one is by using:
Code:

netstat -nalpt | grep vncser
Then put in address on vncviewer ip:port

linuxandtsm 03-16-2012 02:04 PM

Hi eSelix,

Code:

more /home/admin/.vnc/hostname:1.log
Couldn't open RGB_DB '/usr/X11R6/lib/X11/rgb'
_XSERVTransmkdir: Owner of /tmp/.X11-unix should be set to root

Xvnc Free Edition 4.1.3 - built Oct 15 2008 12:55:42
Copyright (C) 2002-2008 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40201000, The XFree86 Project, Inc


Fri Mar 16 14:55:05 2012
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on port 5901
 vncext:      Listening for HTTP connections on port 5801
 vncext:      created VNC server for screen 0
error opening security policy file /usr/X11R6/lib/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/CID/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!

Fatal server error:
could not open default font 'fixed'
XIO:  fatal IO error 104 (Connection reset by peer) on X server "hostname:1.0"
      after 0 requests (0 known processed) with 0 events remaining.
vncconfig: unable to open display "hostname:1"
xterm Xt error: Can't open display: hostname:1
twm:  unable to open display "hostname:1"

I noticed that immediately after starting the vncserver, it is getting stopped.
Code:

# service vncserver status
Xvnc is stopped
[root@hostname ~]# service vncserver start
Starting VNC server: 1:admin
New 'hostname:1 (admin)' desktop is hostname:1

Starting applications specified in /home/admin/.vnc/xstartup
Log file is /home/admin/.vnc/hostname:1.log

                                                          [  OK  ]
# service vncserver status
Xvnc is stopped


I tried

$ vncviewer IP:1

VNC Viewer Free Edition 4.1.3 for X - built Oct 15 2008 12:49:56
Copyright (C) 2002-2008 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
vncviewer: unable to open display ""

I am using vncviewer with hostname:1

Hi Celyr

Code:

# netstat -nalpt |grep vnc
# echo $?
1

and also DOES THE SERVER WHERE VNCSERVER INSTALLED NEED TO BE AT RUN_LEVEL ?

Celyr 03-16-2012 05:14 PM

No, you can run it at run level 3 with no problem at all.
It seems that the vncserver doesn't start because of the missing font, tomorrow I'll look for it :)

eSelix 03-16-2012 06:18 PM

Check 3rd question on vncserver FAQ They say that on Red Hat you probably need to install 100dpi fonts or use "-dpi 75" option.

linuxandtsm 03-19-2012 10:17 AM

Ok, now i am able to see the desktop but it is all grey desktop but not real GUI one.

How to make it real GUI desktop ?

Below are few files
Code:

# more .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 &

The log file is

Code:

# more /root/.vnc/hostname:1.log
_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/hostname:1
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6

Xvnc Free Edition 4.1.2
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 70101000, The X.Org Foundation


Mon Mar 19 11:00:47 2012
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on port 5901
 vncext:      Listening for HTTP connections on port 5801
 vncext:      created VNC server for screen 0
localuser:root being added to access control list
No profile for user 'root' found

Mon Mar 19 11:02:02 2012
 Connections: accepted: 54.29.51.35::2993
 SConnection: Client needs protocol version 3.8
 SConnection: Client requests security type VncAuth(2)

Mon Mar 19 11:02:06 2012
 VNCSConnST:  Server default pixel format depth 16 (16bpp) little-endian rgb565
 VNCSConnST:  Client pixel format depth 8 (8bpp) rgb max 3,3,3 shift 4,2,0
 VNCSConnST:  Client pixel format depth 16 (16bpp) little-endian rgb565

Thanks in advance!

Master_CAPS 03-19-2012 10:41 AM

I think there is a GUI for modern distros. All I did was click some stuff in settings and allowed vnc users with a special password.

Satyaveer Arya 03-19-2012 12:51 PM

checkout this link: http://www.walkernews.net/2007/07/05...ux-vnc-server/, very helpful..

linuxandtsm 03-19-2012 01:11 PM

Hi Satyaveer Arya,

Thank you for the link.
I did similar setup/config but not getting desktop manager to work.
Only having text based console only.

eSelix 03-19-2012 05:06 PM

But do you have twm installed? If not, install it or run another window manager that you have, in your xstartup file. Show also your /etc/X11/xinit/xinitrc.

linuxandtsm 03-20-2012 08:06 AM

Hi eSelix,

I think twm is installed
Code:

]# rpm -qa |grep -i twm
xorg-x11-twm-1.0.1-3.1

and below is the /etc/X11/xinit/xinitrc file
Code:

# Mandatorily source xinitrc-common, which is common code shared between the
# Xsession and xinitrc scripts which has been factored out to avoid duplication
. /etc/X11/xinit/xinitrc-common

# The user may have their own clients they want to run.  If they don't,
# fall back to system defaults.
if [ -f $HOME/.Xclients ]; then
    exec $SSH_AGENT $DBUS_LAUNCH $HOME/.Xclients || \
    exec $SSH_AGENT $HOME/.Xclients
elif [ -f /etc/X11/xinit/Xclients ]; then
    exec $SSH_AGENT $DBUS_LAUNCH /etc/X11/xinit/Xclients || \
    exec $SSH_AGENT /etc/X11/xinit/Xclients
else
    # Failsafe settings.  Although we should never get here
    # (we provide fallbacks in Xclients as well) it can't hurt.
    [ -x /usr/bin/xsetroot ] && /usr/bin/xsetroot -solid '#222E45'
    [ -x /usr/bin/xclock ] && /usr/bin/xclock -geometry 100x100-5+5 &
    [ -x /usr/bin/xterm ] && xterm -geometry 80x50-50+150 &
    [ -x /usr/bin/twm ] && /usr/bin/twm
fi

and how to know what is the default window manager and how to change them ?

deep27ak 03-20-2012 09:38 AM

are you able to use vncserver as root?

just give a cross check

instead of admin use root and assign a vncpasswd for root

Code:

#vncpasswd

#service vncserver restart

and check the status of service

and post the output of
Code:

#rpm -qa | grep vnc

linuxandtsm 03-20-2012 10:17 AM

Hi deep27ak,

Yes i am running vnc as root. I assigned a passwd and started the vncserver.

Code:

# service vncserver status
Xvnc (pid 2464) is running...

below is rpm output
Code:

# rpm -qa |grep vnc
vnc-4.1.2-14.el5_5.4
vnc-server-4.1.2-14.el5_5.4


eSelix 03-20-2012 05:16 PM

If you get "text based console only" then it means that your Xvnc is working, but only window manager not started. Default in my system (Ubuntu) is stored in "/etc/X11/default-display-manager". You can change it in "~/.vnc/xstartup" file in place of line "/usr/bin/twm &".

linuxandtsm 03-21-2012 09:28 AM

Hi eSelix,

I did not find "/etc/X11/default-display-manager" but looks like twm is the window manager here.
But anyway can i install any other window manager package like Gnome or Kde etc on this RHEL5 box and configure .vnc/xstartup file so that i can see the GUI ?

looks like there are some gnome packages installed already but not sure how to configure so that i can use it ?

Code:

]# rpm -qa |grep gnome
gnome-python2-gnomevfs-2.16.0-1.fc6
gnome-mime-data-2.4.2-3.1
gnome-keyring-0.6.0-1.fc6
gnome-doc-utils-0.8.0-2.fc6
gnome-vfs2-2.16.2-6.el5_5.1
libgnomeui-2.16.0-5.el5
gnome-python2-canvas-2.16.0-1.fc6
gnome-mount-0.5-3.el5
gnome-python2-gtkhtml2-2.14.2-7.el5
gnome-python2-bonobo-2.16.0-1.fc6
libgnomecanvas-2.14.0-4.1
libgnome-2.16.0-6.el5
gnome-python2-2.16.0-1.fc6
gnome-python2-gconf-2.16.0-1.fc6
rhn-setup-gnome-0.4.20-46.el5
gnome-python2-extras-2.14.2-7.el5

Thanks in advance!

eSelix 03-21-2012 02:49 PM

Sorry, there was a display manager "kdm". A window manager I have as symlink in "/etc/alternatives/x-window-manager". You should be able to use another one. KDE window manager is called "kwin" and GNOME - I think "metacity".

deep27ak 03-22-2012 12:27 AM

kill all the cureent running vncserver and restart the server with following changes

Code:

#vncserver -kill :2
Code:

#vi /etc/sysconfig/vncservers
 VNCSERVERS="2:root"
# VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost" <---donot uncomment this line

Code:

#vncpasswd
Code:

#service vncserver restart
Code:

#vi /root/.vnc/xstartup
#!/bin/sh

# Uncomment the following two lines for normal desktop:
# unset SESSION_MANAGER  <--------dont uncomment this line

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 &


linuxandtsm 03-22-2012 10:17 AM

Hi deep27ak,

Followed but no change. Still endup with text based white console with xclock displayed on right on the vncviewer window.

Les Windoze 03-22-2012 10:31 AM

I use gnome-session rather than twm.

linuxandtsm 03-22-2012 10:55 AM

Hi Les Windoze,

could you tell me how to use gnome-session ?
If you mean just putting a "exec gnome-session" in .vnc/xstartup file, then i tried that.

And i am not sure how to check if gnome related packages are installed and how to use them.
Thanks!

J_U_D_E 03-26-2012 03:09 AM

It seems there has not been any resolution. I am having similar problem setting up a vnc session server on Redhat 5.


Please i created a vnc sersion between Redhat linux 5 and windows server 2003. Redhat linux is the vnc server while window server 2003 is the vnc viewer. I can not connect to Redhat despite starting Redhat. I have an error in windows.

VNC Viewer :Error
Unable to connect to host: Connection refused(10061)

There is network connection between both and their hostname can also be resolve.(hosts file contains ipaddress and hostname).

VNC viewer in Linux can access the windows(I installed both VNC server and viewer on windows). Redhat 5 has both VNC viewer and server installed when the OS is installed.

I started up vnc server from services and it is running.
The following below is the command to start and the error log message.

[root@idsl01 ~]# vncserver -geometry 1920x1200

New 'idsl01:3 (root)' desktop is idsl01:3

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/idsl01:3.log

[root@idsl01 ~]# more /root/.vnc/idsl01:3.log
_XSERVTransSocketOpenCOTSServer: Unable to open socket for inet6
_XSERVTransOpen: transport open failed for inet6/idsl01:3
_XSERVTransMakeAllCOTSServerListeners: failed to open listener for inet6

Xvnc Free Edition 4.1.2
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 70101000, The X.Org Foundation


Sat Mar 24 15:16:01 2012
vncext: VNC extension running!
vncext: Listening for VNC connections on port 5903
vncext: Listening for HTTP connections on port 5803
vncext: created VNC server for screen 0
[root@idsl01 ~]#

Regards,
Jude

deep27ak 03-26-2012 04:09 AM

Quote:

Originally Posted by J_U_D_E (Post 4636294)

VNC Viewer :Error
Unable to connect to host: Connection refused(10061)

you should have started a new thread as your problem seems to be different. Here OP is able to connect to vnc but not able to get proper display and you are not at all able to connect to vnc server
The possible reasons can be

# server firewall is blocking
# vncserver service is not running
# vncserver is not configured properly


All times are GMT -5. The time now is 12:08 PM.