LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 01-22-2007, 02:40 PM   #1
rterp
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Rep: Reputation: 0
Question Persistent VNC connection


Hello All,

I have a difficult problem and I'm hoping that someone out there can help.
In summary we have a piece of software that is graphical (requires X) and
needs to start at system boot. The suggestion we received was to have it
start in a persistent VNC session which in general works very well. I
created a service and if I start\stop while logged in everything is great
the software starts and is persistent. However when the service starts at
system boot the VNC session is there but the shell script referred to in
the service does not execute and all I have is a grey screen. It looks like
the xstartup file might not be read. However why it works after the system
boots but not during boot is a mystery to me. I am including a copy of the
service and Xstartup file in this message. Any help that you gurus can
provide would be GREATLY appreciated.

System is OpenSUSE 10.2


Code:
# !/bin/sh
#
# Author: Ryan Terp, 2007
#
#
### BEGIN INIT INFO
# Provides:          batchmanager
# Required-Start:    $local_fs $remote_fs xdm xinetd
# Should-Start:
# Required-Stop:    
# Should-Stop:        
# Default-Start:     5
# Default-Stop:      0 1 2 6
# Short-Description: OpenMFG Batch Manager
# Description:       OpenMFG Batch Manager
### END INIT INFO

# Load the rc.status script for this service.
.. /etc/rc.status

# Reset status of this service
rc_reset


case "$1" in
'start')
   echo -n "Starting OpenMFG Batch Manager"
   /bin/su - openmfg -l -c "/usr/bin/vncserver :5 -depth 16 -geometry
800x600" 2>nul
    rc_status -v
   ;;

'stop')
    echo -n "Shutting down OpenMFG Batch Manager"
   /bin/su - openmfg -l -c "/usr/bin/vncserver -kill :5" 2>nul
   rc_status -v
  ;;

*)
    echo "Usage: /etc/init.d/rc.vnc { start | stop }"
  ;;

esac
rc_exit

Code:
!/bin/sh

echo BatchManager Start at $(date) >> /var/log/batchmanager.log

xrdb $HOME/.Xresources
xsetroot -solid grey
# xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

~/batchmanager/BatchManager -geometry 300x320+10+10 
-databaseURL=psql://192.168.1.1/demodb:5432 -username=
-passwd=

echo BatchManager end at $(date) >> /var/log/batchmanager.log
 
Old 01-22-2007, 03:26 PM   #2
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
It is not working probably because you don't have X running or a display manager running. You're probably running booting to init 3 or to text mode.

After you login you have X or a display manager running so that is why vncserver will run then. You need to have X or a display manager such as gdm, kdm running in order for vncserver to run. Also make sure that the script you wrote is executed after the X or the display manager loads.
 
Old 01-22-2007, 03:41 PM   #3
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Does the system have a working X server running and does it start automatically.
Meaning do you get a gui login manager or a console login screen.

If I understand this you have a program that starts at boot from a script that is listed in /etc/init.d. Is this correct?

What is the name of this program?

Brian
 
Old 01-22-2007, 03:58 PM   #4
rterp
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by ramram29
It is not working probably because you don't have X running or a display manager running. You're probably running booting to init 3 or to text mode.

After you login you have X or a display manager running so that is why vncserver will run then. You need to have X or a display manager such as gdm, kdm running in order for vncserver to run. Also make sure that the script you wrote is executed after the X or the display manager loads.
ramram the server is booting into run level 5 and there is a working x Windows environment. I remotely administer the machine using the VNC remote admin functionality built-in to SUSE. I have also had no issues logging in from the console.

As you can see from my init info in the service script (see below) I'm forcing the service to wait until after xdm and xinetd (VNC) start as seen in the Required-Start section. Also the script is only allowed in run level 5 per the default-start section.


Code:
### BEGIN INIT INFO
# Provides:          batchmanager
# Required-Start:    $local_fs $remote_fs xdm xinetd
# Should-Start:
# Required-Stop:    
# Should-Stop:        
# Default-Start:     5
# Default-Stop:      0 1 2 6
# Short-Description: OpenMFG Batch Manager
# Description:       OpenMFG Batch Manager
### END INIT INFO
 
Old 01-22-2007, 04:06 PM   #5
rterp
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Brian1
Does the system have a working X server running and does it start automatically.
Meaning do you get a gui login manager or a console login screen.

If I understand this you have a program that starts at boot from a script that is listed in /etc/init.d. Is this correct?

What is the name of this program?

Brian

Brian,

The server runs in boot level 5, the X environment starts automatically and there is a GUI login available at the console.

I am using a script in /etc/init.d to try and start the program at system boot time. Sadly while it works great AFTER boot it fails to work during system boot presenting me with a grey screen. The name of the script in init.d is batchmanager and I have included the code below.


Code:
# !/bin/sh
#
# Author: Ryan Terp, 2007
#
#
### BEGIN INIT INFO
# Provides:          batchmanager
# Required-Start:    $local_fs $remote_fs xdm xinetd
# Should-Start:
# Required-Stop:    
# Should-Stop:        
# Default-Start:     5
# Default-Stop:      0 1 2 6
# Short-Description: OpenMFG Batch Manager
# Description:       OpenMFG Batch Manager
### END INIT INFO

# Load the rc.status script for this service.
.. /etc/rc.status

# Reset status of this service
rc_reset


case "$1" in
'start')
   echo -n "Starting OpenMFG Batch Manager"
   /bin/su - openmfg -l -c "/usr/bin/vncserver :5 -depth 16 -geometry
800x600" 2>nul
    rc_status -v
   ;;

'stop')
    echo -n "Shutting down OpenMFG Batch Manager"
   /bin/su - openmfg -l -c "/usr/bin/vncserver -kill :5" 2>nul
   rc_status -v
  ;;

*)
    echo "Usage: /etc/init.d/rc.vnc { start | stop }"
  ;;

esac
rc_exit
 
Old 01-22-2007, 04:18 PM   #6
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
I assume when you start it it is only listed in /etc/rc5.d directory as say s99name_of_script. An as k**name_of_script in rc3.d, rc4.d, rc6.d.
This way it will not start till X is running and the last thing to start.

Brian
 
Old 01-22-2007, 04:33 PM   #7
rterp
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Brian1
I assume when you start it it is only listed in /etc/rc5.d directory as say s99name_of_script. An as k**name_of_script in rc3.d, rc4.d, rc6.d.
This way it will not start till X is running and the last thing to start.

Brian

Brian

The batchmanager service I created is currently S12batchmanager and K10batchmanager in the /etc/init.d/rc5.d (run level 5) directory. At that number it is the second to last script to run. The only script that follows mine is S13Cupsrenice but I suspect that VNC should not need that to run. I have included a directory listing of /etc/init.d/rc5.d for your reference.


Code:
K09cupsrenice
K10batchmanager
K11cron
K11smbfs
K11xinetd
K12nscd
K12postfix
K12xdm
K13alsasound
K13boot.apparmor
K13cups
K13microcode
K13novell-zmd
K13ntp
K13powersaved
K13splash
K13sshd
K14nfs
K14nfsboot
K15auditd
K15portmap
K15splash_early
K16mdnsd
K16syslog
K17network
K19haldaemon
K20earlykbd
K20policykitd
K21acpid
K21dbus
K21earlysyslog
K21fbset
K21irq_balancer
K21random
K21resmgr
S01acpid
S01dbus
S01earlysyslog
S01fbset
S01irq_balancer
S01random
S01resmgr
S02earlykbd
S02policykitda
S03haldaemon
S05network
S06mdnsd
S06syslog
S07auditd
S07portmap
S07splash_early
S08nfs
S08nfsboot
S09alsasound
S09boot.apparmor
S09cups
S09kbd
S09microcode
S09novell-zmd
S09ntp
S09powersaved
S09splash
S09sshd
S10nscd
S10postfix
S10xdm
S11cron
S11smbfs
S11xinetd
S12batchmanager
S13cupsrenice
 
Old 01-22-2007, 05:11 PM   #8
Brian1
LQ Guru
 
Registered: Jan 2003
Location: Seymour, Indiana
Distribution: Distribution: RHEL 5 with Pieces of this and that. Kernel 2.6.23.1, KDE 3.5.8 and KDE 4.0 beta, Plu
Posts: 5,700

Rep: Reputation: 65
Not 100 percent sure but you may be killing your batch since both the S and K are listed in the same runlevel. I never had any list an S and a K for the same service in a single runlevel. Remove the K one and see how that goes.

Brian
 
Old 01-22-2007, 05:30 PM   #9
rterp
LQ Newbie
 
Registered: Jan 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Brian, I did not assign the numbers it was assigned automatically by the chkconfig command. I could manually change them but SUSE would just reassign them based on the init. Also just for clarification at boot the VNC session is created it's just not executing the contents of the xstartup file and presenting me with a grey screen. So I'm confident the script is not getting terminated prematurely.
 
Old 01-23-2007, 08:59 AM   #10
ramram29
Member
 
Registered: Jul 2003
Location: Miami, Florida, USA
Distribution: Debian
Posts: 848
Blog Entries: 1

Rep: Reputation: 47
From what I understand, you are getting the famos VNC grey screen. I've had the same problem. It has to do with XDM. I've tried vncserver, vnc4server, tightvnc-server and they all have the same problem with XDM. I was able to solve it months ago by modifying /etc/X11/xdm/{Xaccess,Xsetup,xdm-conf}; but setting up a full blown multiple-display VNC server is a real pain in the arzz.

If you need something quick and dirty then try x11vnc - it works great everytime. The only inconvenience is that by default it grabs the default screen 0, but that should be enough for administration purposes. If you are planning to use a VNC server with multiple displays then you need something more robust and then I would recommend using gdm or kdm instead of xdm. However, if all you need is to connect occasionally for admin purposes then try x11vnc.
 
  


Reply



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
VNC connection to SUSE Linux 10 from a Windows XP VNC Viewer determin2excel Linux - Software 13 10-03-2007 09:38 AM
Vnc : Connection refused dragunu Linux - Newbie 5 04-25-2006 05:54 AM
Implement persistent HTTP connection syseeker Programming 3 11-30-2005 01:18 AM
sftp over a persistent connection (days/weeks) develops a memory leak da_kidd_er Linux - Software 1 12-22-2004 06:56 PM
How to keep a persistent ssh (konsole) connection? coolersites Linux - Software 4 11-10-2003 03:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration