LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-14-2015, 07:45 AM   #1
gIn_gOut
Member
 
Registered: Jul 2015
Posts: 42

Rep: Reputation: Disabled
Boot-Time Script Complications


As one new to the forum, I believe I have a "simple" question for the community today

The scenario in question involves the launch of a bash script at boot (via upstart, init, or similar). This script takes care of some assorted rudimentary functions; and remains at work in those capacities until well past user login. All good so far.

Post-login, the script forks a program (pick anything from a lowly terminal to a browser) which includes a GUI. At this point, the music just stops; and the program so launched simply folds up and dies before even hitting the screen. The script itself goes merrily on...

We all know about tackling such problems from the desktop environment via autostart, ~/.xinitrc, or similar kludges. But what about situations in which one would prefer to have a consolidated boot-time solution which can simply serve all logins without hassle?

In sum, what might be a reasonable tack to effectively allow a GUI-based app to launch from a boot-level script?

Thanks again --
 
Old 07-14-2015, 08:00 AM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
X Virtual Frame Buffer (xvfb) is often used for launching background X windows based GUIs.

Doing search in Google reveals many hits for using this with init scripts:
https://www.google.com/search?q=xvfb...utf-8&oe=utf-8

I haven't used it in an init script myself but we do use it here for starting various Oracle GUIs in the background.
 
Old 07-14-2015, 10:56 AM   #3
gIn_gOut
Member
 
Registered: Jul 2015
Posts: 42

Original Poster
Rep: Reputation: Disabled
@MensaWater:

Thanks for the tip.

Xvfb up and running @ runlevel 2 with the following parameters:
Code:
/usr/bin/Xvfb :99 -screen 0 1024x768x24
All verified as up via Task Manager on the Desktop side...

However, the issue persists: Should Xvfb be called in conjunction with an offending program directly, or is there some other subtle point which presently eludes?

Ideas? Syntax???

Thanks again --
 
Old 07-14-2015, 02:17 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Did you specify the "-display :99" variable on start of the GUI so it will use the display you assigned in xvfb?
 
Old 07-14-2015, 02:35 PM   #5
gIn_gOut
Member
 
Registered: Jul 2015
Posts: 42

Original Poster
Rep: Reputation: Disabled
@MensaWater:

Trying that now; but I just wrapped up an experiment with a Python/GTK script which I equipped with
Code:
os.environ["DISPLAY"] = ":99"
just after the opening declarations (no dice).

Back in a few with the verdict on
Code:
/etc/foo -display :99
 
Old 07-14-2015, 03:26 PM   #6
gIn_gOut
Member
 
Registered: Jul 2015
Posts: 42

Original Poster
Rep: Reputation: Disabled
Placed -display :99 in everything except Linus' shorts: Still no luck. Again, everything in the chain works perfectly if it's called from the terminal by hand.

Started from boot, no dice!

Xvfb up and healthy...


Last edited by gIn_gOut; 07-14-2015 at 03:30 PM.
 
Old 07-14-2015, 05:08 PM   #7
gIn_gOut
Member
 
Registered: Jul 2015
Posts: 42

Original Poster
Rep: Reputation: Disabled
Here's something which might reasonably be expected to tick over for a dry run @ the terminal:
Code:
zenity --info --display=:99.0
...but, of course, only this will work
Code:
zenity --info --display=:0.0
So, how would we go about pointing zenity to display=:99 or, possibly, what might we do with the Xvfb line to cooperate with the likes of this?

(willing to try anything reasonable at this juncture)

 
Old 07-15-2015, 08:20 AM   #8
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
If started from terminal by hand...

Are you talking about the initial launch script or something you do in the GUI after it is launched? If the former your issue may be you're missing some environment variable in the boot script that you have when you do the initial launch. This is fairly common with background scripts like those run in init or cron. The most common one is PATH but their could be others you're relying on depending on the application. The PATH variable you have at command line usually has a lot more than the minimal one background tools will give you so you need to include it in the script itself.

Type "env" after login to see what variables you have set then determine if you need to add any to the startup.
 
Old 07-16-2015, 10:08 AM   #9
gIn_gOut
Member
 
Registered: Jul 2015
Posts: 42

Original Poster
Rep: Reputation: Disabled
@MensaWater:

Thanks for the info and tips. In the end nothing seemed to help...

So, I switched tack to add a (forked) launchline to the /etc/profile script which is reputed to serve well as a cross-login solution in cron settings. It worked; but in doing so I had to segment my approach to cover both root- and GUI-level functional requirements. Not as simple as blasting through and pointing something to the correct display, but effective in the end.

This is really strange behavior. I've heard the problem likened to having "gum stuck to your shoe" which somehow prohibits GUI launches throughout any chain from bootup scripting, even if a connected (or forked) downstream process is launched well after login.

Is this an integral part of the Linux security model, or just another "quirk" which we need to just live with???

At any rate, thanks again; and have a great day

Last edited by gIn_gOut; 07-16-2015 at 10:11 AM.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to run a script at boot time? umasahu Linux - Server 2 06-26-2014 05:36 AM
Executing a script at boot time digilink Linux - Server 3 04-22-2011 07:21 PM
Would there be any complications getting GRUB to boot from two HDs (IDE<->SATA)? DrunkPikachu Linux - Hardware 3 08-20-2007 02:05 PM
starting the script at boot time hudy_rob Mandriva 4 12-09-2004 10:29 AM
Stop boot script at boot time!! kmiles2 Linux - Newbie 1 02-23-2004 10:04 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:53 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