• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 832
  • Last Modified:

VNC Server won't start!

I am trying to get VNC to work on my Redhat 9 machine.  At command line I type /home/username/.vnc/xstartup and I receive
(gnome-session:3965): Gtk - WARNING **: cannot open display:

I am receiving this error after I changed the .vnc/xstartup from 'exec /etc/X11/xinit/xinitrc' to 'exec gnome-session'  

Before I chaned xstartup I received
xrdb: Can't open display ''
xrdb: Can't open display ''
xmodmap: unable to open display ''
/usr/X11R6/bin/xmibind: can't open display ''

(gnome-session:3972): Gtk - WARNING**: cannot open display:

Can someone please help!!

I can get VNC to start and run great when I'm logged in as a user at the local machine and type /usr/bin/vncserver.  But I need to have this run from boot and stay running all the time without having access to the console.
0
goffer
Asked:
goffer
1 Solution
 
kiitiiCommented:

1. Add the username whom you which to run vnc
edit /etc/sysconfig/vncservers, example
VNCSERVERS="1:billgates"

2. To make sure everytime, when you boot up, the vncserver runs
# chkconfig  vncserver  on

3. Assign vnc password for user billgates
# su -  billgates
$ vncpasswd
$ exit

4. To restart vncserver  
# service  vncserver  restart

4. Test it
# vncviewer  192.168.0.1:1

0
 
kiitiiCommented:
To allow more users, edit
/etc/sysconfig/vncservers
VNCSERVERS="1:billgates   2:stevejobs  3:linus"

Then
# su - billgates
$ vncpasswd
$ exit

# su - stevejobs
$ vncpasswd
$ exit

and ...

0
 
leisnerCommented:
I found the vnc startup had some quirks -- it wasn't painless when I did it on fedora3 (I have to check why).

Its a good idea to see if the vnc servers are running after you run the start script....i.e.

ps -aux | grep Xvnc
or
pgrep Xvnc

It took me several hours of playing around with what SHOULD have been a simple process to get it
working right....I'll check later to see what I modified (it may have been operator error... ;-))
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
wnrossCommented:
xstartup won't start vnc, that file is used to initialize your session

Also, use the full path to gnome-session
eg: exec /usr/X11R6/bin/gnome-session

(adjust to suit your environment)

now this probably is not a problem, but
  chkconfig --list xfs

if it comes back *off* for all runlevels, do a
  chkconfig xfs on
  service xfs start

Finally
follow kiitii's instructions to get each instance configured

Minimally:
/etc/sysconfig/vncservers
VNCSERVERS="1:goffer"  

(use your user name on the system)
now again:
[~] chkconfig --list vncserver
vncserver             0:off   1:off   2:off   3:off   4:off   5:off   6:off
[~] chkconfig vncserver on
[~] chkconfig --list vncserver
vncserver             0:off   1:off   2:off   3:on   4:on   5:on   6:off

Cheers
-Bill
0
 
genehayesCommented:
Okay, apparently all I had to do was the chkconfig vncserver on.  That seems to have done the trick.  I had already set the vnc passwd and set the /etc/sysconfig/vncserver as VNCSERVER="1:user", but when I was trying to just run the command I got those errors.  But apparently using chkconfig vncserver on works, does that do something different?
0
 
gofferAuthor Commented:
Oops, commented from someone else's account.  Thanks for the help.
0
 
wnrossCommented:
look in your /etc/rc1.d/* /etc/rc5.d/* etc

Those soft links are links to /etc/init.d

eg:
/etc/rc5.d/S95vncserver --> /etc/init.d/vncserver
/etc/rc6.d/K35vncserver --> /etc/init.d/vncserver

Now look at the top few lines of /etc/init.d/vncserver:
#!/bin/bash
#
# chkconfig: - 91 35

Now init *only* looks in the rcnn.d folder for lists of programs to stop and start, so we softlink them all to scripts
that take a stop or start command.  The files are numbered so that the correct sequence is maintained
(eg: useless to start a web server BEFORE network services are up)

Now and administrator's job is to make sure that these softlinks are created or changed to suit whichever services need to be run for each runlevel.
chkconfig just automates that task

Simple example
service start vncserver [vnc is now running]
chkconfig --del vncserver
ls /etc/rc3.d/
ls /etc/rc6.d/
note the soft link is gone

chkconfig --add vncserver
ls /etc/rc3.d/
ls /etc/rc6.d/
Presto chango its back

chkconfig --list vncserver
vncserver       0:off   1:off   2:off   3:off   4:off   5:off   6:off

chkconfig vncserver on
vncserver       0:off   1:off   2:on    3:on    4:on    5:on    6:off
ls /etc/rc3.d/
ls /etc/rc6.d/
note that K35vncserver is gone and S91vncserver is now present.

Cheers,
-Bill
0

Featured Post

Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now