LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (http://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to use: vncserver and vncviewer (http://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 &".


All times are GMT -5. The time now is 06:44 AM.