LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 07-02-2012, 11:08 AM   #1
igor012
Member
 
Registered: Feb 2010
Posts: 87

Rep: Reputation: 2
x11vnc at startup


Hello,
I am using opensuse 12.1 and I am trying to have x11vnc started before login.

I have created a /etc/init.d/vnc file :

Code:
#!/bin/sh
#
# /etc/init.d/vnc
#
### BEGIN INIT INFO
# Provides:          x11vnc server
# Required-Start:    $xdm  
# Should-Start: 
# Required-Stop: 
# Should-Stop: 
# Default-Start:     5
# Default-Stop:      0 1 2 6
# Short-Description: 
# Description:       Start or stop vnc server
### END INIT INFO

#INIT SCRIPT VARIABLES
SERVICE=$(basename $0)
PIDFILE="/var/run/${SERVICE}.pid"
BIN="/usr/bin/x11vnc "
AUTH=$(find /var/lib/xdm/authdir/authfiles/A:*)
OPT="-display :0 -auth ${AUTH} -nopw -unixpw -shared -oa /var/log/vnc.log -xkb -bg -verbose  "
CMD=${BIN}${OPT}


. /lib/lsb/init-functions

# Reset status of this service
rc_reset


case "$1" in
    start)
	echo -n "Starting ${SERVICE}..."
        ## Start daemon with startproc(8). 
	/sbin/startproc ${CMD}
	sleep 2s
	# Remember status and be verbose.
        rc_status -v
	;;
    *)
	echo -e "Usage: ${SERVICE} {start}"
	exit 1
	;;
esac
rc_exit
When launching it from the command line it works but it doesn't on boot.

Here x11vnc log file :
Code:
2/07/2012 19:00:49 x11vnc version: 0.9.12 lastmod: 2010-09-09  pid: 1002
02/07/2012 19:00:49 XOpenDisplay(":0") failed.
02/07/2012 19:00:49 Trying again with XAUTHLOCALHOSTNAME=localhost ...

02/07/2012 19:00:49 ***************************************
02/07/2012 19:00:49 *** XOpenDisplay failed (:0)

*** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.
*** There may be "Xlib:" error messages above with details about the failure.
Any idea ?
Thanks
 
Old 07-03-2012, 04:15 AM   #2
timufea
LQ Newbie
 
Registered: Jan 2006
Location: UK
Distribution: Slackware
Posts: 7

Rep: Reputation: Disabled
The error message probably means that the X server is not running yet. You will have to ensure that the X-server is started before x11vnc.

Since there is no ordinary user logged in at boot-time, the X-server will have to be displaying a login screen - i.e. you will need a display manager such as xdm, gdm or kdm running. See the x11vnc FAQ for how to do this.
 
Old 07-03-2012, 04:39 AM   #3
KuimFieg
Member
 
Registered: Sep 2011
Location: France
Distribution: Debian Squeeze
Posts: 32

Rep: Reputation: Disabled
I don't know OpenSuse but in Debian (since Lenny I think) you need to grab the XAUTHORITY token.

In my current setup I have to lauch x11vnc with gdm's random token.

Code:
export XAUTHORITY=/var/run/gdm3/auth-for-Debian-gdm-0Y9dhH/database
x11vnc -auth guess
or
Code:
x11vnc -auth /var/run/gdm3/auth-for-Debian-gdm-0Y9dhH/database
Maybe this could help. You have to search for the string XAUTHORITY to find the process allowed to connect to the graphical interface. In otherwords you have to launch x11vnc with gdm's "credentials".
Code:
grep --text auth-for /proc/*/environ| cat -v | sed 's/\^@/\n/g' | less
 
Old 07-03-2012, 08:54 AM   #4
igor012
Member
 
Registered: Feb 2010
Posts: 87

Original Poster
Rep: Reputation: 2
Hello,

I think timufea is right. This may occur because the X server has not started.
I have tried to change the priorities
Code:
ll /etc/init.d/rc5.d/S11vnc
lrwxrwxrwx 1 root root 6 Jul  3 12:09 /etc/init.d/rc5.d/S11vnc -> ../vnc
It used to be
Code:
/etc/init.d/rc5.d/S10vnc
But it still doesn't work.

Also I have changed how to locate the authfiles by running :
Code:
ps wwaux | grep '/X.*-auth' | grep -v grep | sed -e 's/^.*-auth *//' -e 's/ .*$//' | head -n 1
source
 
Old 07-03-2012, 11:56 AM   #5
KuimFieg
Member
 
Registered: Sep 2011
Location: France
Distribution: Debian Squeeze
Posts: 32

Rep: Reputation: Disabled
Can you ssh and run x11vnc via your script once fully booted?
 
Old 07-03-2012, 12:10 PM   #6
igor012
Member
 
Registered: Feb 2010
Posts: 87

Original Poster
Rep: Reputation: 2
Yes indeed
Once booted I can launch it.
 
Old 07-03-2012, 12:22 PM   #7
igor012
Member
 
Registered: Feb 2010
Posts: 87

Original Poster
Rep: Reputation: 2
I found what was the problem.

I changed the head from this:

Code:
### BEGIN INIT INFO
# Provides:          x11vnc server
# Required-Start:    $xdm
To this
Code:
### BEGIN INIT INFO
# Provides:          x11vnc server
# Required-Start:    xdm
It starts after xdm has fully booted.

Thanks for your time.

Last edited by igor012; 07-03-2012 at 12:33 PM.
 
2 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
x11vnc Shwick Linux - Server 1 12-09-2008 10:56 AM
x11vnc not working novell1 Suse/Novell 1 03-01-2008 04:29 PM
help with x11vnc gtludwig Linux - Networking 5 10-08-2006 05:53 PM
Trying to use x11vnc? Snump Mandriva 12 04-12-2006 03:57 AM
x11vnc + gnome Fuwex Linux - Software 0 09-27-2004 10:14 AM


All times are GMT -5. The time now is 07:28 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration