How do I get my Tiger VNC Server to start properly on a CentOS 7 Operating System?

I recently attempted to:
 yum install -y   tigervnc-server.x86_64

I followed all the instructions contained in the the file:
 /lib/systemd/system/vncserver@.service
which I found when I read the contents of /etc/sysconfig/vncservers

When I tried to start the service
e.g
[root@localhost bin]# service vncserver start
Redirecting to /bin/systemctl start  vncserver.service
Failed to issue method call: Unit vncserver.service failed to load: No such file or directory
I then tried just running Xnvc supposedly this starts VNC Server  but then I check and even though it looks like things are running I get timeouts when I try to connect.
NOTE I also set the iptables firewall  on the server to allow tcp ports 5901, 5902  etc...

What  file or directory would the program be looking for??
Just as a test I ran Xvnc  with no arguments and it appears to have started something.
I tried to connect to it but got timeouts when I tried connecting raw to the CentOS server

Note the following appeared when I ran Xvnc
[root@localhost bin]# ps -ef|grep Xvnc
root     28907     1  0 22:52 pts/0    00:00:00 ./Xvnc :1 -desktop localhost.localdomain:1 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901 -fp catalogue:/etc/X11/fontpath.d -pn
root     30902 28565  0 23:19 pts/0    00:00:00 grep --color=auto Xvnc
LVL 2
Robert SilverSr. Software EngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arnoldCommented:
VNC is useful in a graphical environment, you do not appear to be running a GUI based setup.

what is the output of runlevel on your system?
is it N 3
Meaning multiuser non-graphical?

Depending on what you want to do, using ssh -x to redirect display from the remote system to your workstation might be a way to get some graphical tools to run.

yum grouplist

See which are installed.
Robert SilverSr. Software EngineerAuthor Commented:
Okay I get:
[rss@localhost ~]$ yum grouplist
Loaded plugins: fastestmirror, langpacks
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Determining fastest mirrors
 * base: mirror.cogentco.com
 * extras: mirror.cs.pitt.edu
 * updates: mirror.es.its.nyu.edu
google-chrome                                                                                                                             3/3
Available environment groups:
   Minimal Install
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
arnoldCommented:
What is your Runlevel? (run command runlevel)
Are you running your system in Graphical Mode?
If you are not running your system in graphical mode (/etc/inittab)
id:3:initdefault: (non-graphical command line environment)

id:5:initdefault: (graphical Desktop)


Not sure what VNC functionality you are after that an SSH can not provide?

yum groupinstall "Server with GUI" "Graphical Administration Tools"


I can tell you what to install, it might be a waste of both resources and space when your insistence on installing a VNC server might be unnecessary.
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

gheistCommented:
You can use X11 over SSH, no need to open VNC ports.
Robert SilverSr. Software EngineerAuthor Commented:
Interesting  - I was under the impression that VNC was the typical remote desktop gui for linux in general.
but perhaps this is a better solution. I will look into that and get back to you gheist.
Robert SilverSr. Software EngineerAuthor Commented:
I just tried following the steps from the video:
https://www.youtube.com/watch?v=Q4JUkSudALY

But that did not work.  I got the following when I tried using :1 for the display number
I also tried :2 as display number and so updated my /etc/vncservers file to reflect this:
e.g
VNCSERVERS="1:rob"
VNCSERVERARGS[1]="-geometry 800x600"
I also ran
vncserver :1  first and it showed  a lock issue:
Warning: localhost.localdomain:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server localhost.localdomain:1
A VNC server is already running as :1
I tried logging out as well as clearing iptables   e.g iptables -F;iptables -X

I tried  updating the vncservers file to 2 instead of one for display # and then tried
vncserver :2

[root@localhost sysconfig]# ps -ef|grep vnc
root      4731     1  0 07:23 pts/0    00:00:00 /bin/Xvnc :2 -desktop localhost.localdomain:2 (root) -auth /root/.Xauthority  -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn
root      4738     1  0 07:23 pts/0    00:00:00 /bin/vncconfig -iconic
root      6667  4039  0 07:37 pts/0    00:00:00 grep --color=auto vnc

When I try to connect via tightVNC    client I get  connection target machine actively refused
arnoldCommented:
It is not clear what it is you tried.

When connecting to the server you must specify within the SSH application that you want the X11/Graphical redirect. IF the tunnel does not exist in the connection which sets the DISPLAY variable automatically going back to the source, you can not use export DISPLAY=myserver:0.0
The tunnel does not exist.

ssh -X username@remotesystem (earlier example used the wrong switch -x which actually disables X11 forwarding.)
ssh -Y username@remotesystem
After login, echo $DISPLAY and it will point to the tunnel that is established through the connection.
now when you run any GUI tool, it will be sent through the X11 tunnel within the SSH connection back to the X11/Windowing system on the desktop/system from which you connected to this system.
vncclient can be used to connect to other system, not vncserver.
For VNCServer to run, this system must boot in Graphical/Desktop mode (run level 5)
Robert SilverSr. Software EngineerAuthor Commented:
arnold
https://www.youtube.com/watch?v=Q4JUkSudALY

Then I tried to connect with a version of TightVNC client on a windows 7 box.
What is unclear?
I believe TigerVNC was previously installed then I applied every step in the YouTube video as well
The console GUI appears to be working fine. What displayID would the console GUI session be using???
Robert SilverSr. Software EngineerAuthor Commented:
Hello Arnold,
I expect this to be a long process to get this working.
note as part of the video I ran iptables -F and iptables -X to clear the iptables firewall to accept anything anywhere.
I still have problems. Please advise
Robert SilverSr. Software EngineerAuthor Commented:
I am using standard ports but by zapping the iptables firewall that should not matter. Perhaps there is an issue with some other security issue on the service?  My first time playing with CentOS 7.
I have not used VNC software for over a decade. I wanted to get this working because the machine resides in a hallway and the console is not very comfortable to work in. cold, drafty and noisy not to mention the being trampled occasionally.
arnoldCommented:
are you using port 5902 to connect? This seems to be the port that vncserver is,listening for connections.

lsof -i:5902

netstat -an | grep ":59"
see whether vncserver is listening only on localhost or on all network interfaces.
gheistCommented:
something like freenx or spice is more efficient than vnc, X11 is the very classical UNIX GUI.
Robert SilverSr. Software EngineerAuthor Commented:
At this point I will look at others but to answer arnold:

# netstat -an | grep ":59"
tcp        0      0 0.0.0.0:5902            0.0.0.0:*               LISTEN    

I will look into Spice as well.
Robert SilverSr. Software EngineerAuthor Commented:
So I am currently at the same state with VNC and TightVNC. When I run the client and try to connect it gives me the attached file message. But basically says tried to connect but target server actively refused the connection

Are there any log files I may check that could provide additional information on troubleshooting this and again
They look wide open to me:
Perhaps on CentOS 7 it is necessary to give permissions to a GNOME file? KDE file??
iptables --list:
Chain INPUT (policy ACCEPT)
target     prot opt source               destination        

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination        

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination        

I seem to be very close to get this working ...
vnc-err-on-client-side.jpg
Robert SilverSr. Software EngineerAuthor Commented:
Just to add more information here:
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":3"^M
      after 222 requests (222 known processed) with 0 events remaining.^M


shows up in the ~/.vnc/host.domain:3.log file
Here is the complete file:
Xvnc TigerVNC 1.2.80 - built Jun 10 2014 06:14:52
Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11500000, The X.Org Foundation

Initializing built-in extension Generic Event Extension
Initializing built-in extension SHAPE
Initializing built-in extension MIT-SHM
Initializing built-in extension XInputExtension
Initializing built-in extension XTEST
Initializing built-in extension BIG-REQUESTS
Initializing built-in extension SYNC
Initializing built-in extension XKEYBOARD
Initializing built-in extension XC-MISC
Initializing built-in extension XFIXES
Initializing built-in extension RENDER
Initializing built-in extension RANDR
Initializing built-in extension COMPOSITE
Initializing built-in extension DAMAGE
Initializing built-in extension MIT-SCREEN-SAVER
Initializing built-in extension DOUBLE-BUFFER
Initializing built-in extension RECORD
Initializing built-in extension DPMS
Initializing built-in extension X-Resource
Initializing built-in extension XVideo
Initializing built-in extension XVideo-MotionCompensation
Initializing built-in extension VNC-EXTENSION
Initializing built-in extension GLX

Thu Apr  2 11:46:00 2015
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5903
 vncext:      created VNC server for screen 0
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":3"^M
      after 222 requests (222 known processed) with 0 events remaining.^M

Open in new window

arnoldCommented:
Not clear why it is trying to open window 3/ or attach to window :3.

The issue could be that you edited the configuration file on a windows system and uploaded/transferred it there.

use dos2unix to get the control (^M) out of the file.

cat -v config_file | more see if you have ^M in there.

you can remove the control character using vi as well
In perenthesis are the key combos to hit to get the control character \r is the equivalent, but I had mixed results with it.
%s/(ctrl-V enter)//g
Robert SilverSr. Software EngineerAuthor Commented:
i may try that, Also I may try another tutorial but it looks like I am close to a resolution here as
vnc cient tries to connect but is refused for some unknown reason.
If I can get a detailed debug perhaps I can finally resolve this. Does anyone know how to create a more detailed
log file from vncserver ???
Robert SilverSr. Software EngineerAuthor Commented:
Still working on this. I will report back early May.
arnoldCommented:
Check your software firewall, iptables  -L --line-numbers
System-config-firewall to allow Vnc through.

You may have port 5900 locked.so long as your system is not directly exposed to the Internet for incoming
/etc/init.d/iptables stop
To shutdown the firewall.
Robert SilverSr. Software EngineerAuthor Commented:
Actually I got this working on another server but I also realized I did something  wrong on the client side by not including
the tcp/ip port(Display)  e.g    hostname or IP:1
I also found I had to grant permissions on several folders/directories including the tmp folder.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Robert SilverSr. Software EngineerAuthor Commented:
As I appreciated all the contributed answers the big issues appear to be a need to give access to the /tmp folder and using the correct
hostname:port number on the client side.
e.g    myremotehostname.domain.com:1     for the number 1 port used for the window number

This was the problem all along. Sorry it took so long to return back here
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.