LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-06-2017, 08:35 AM   #31
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled

Quote:
Originally Posted by jpollard View Post
1 What are you trying to do with the program?
I'm trying to replace the PC of my pinball machine with a newer one, the program on the PC controls every action going on on the pinball playfield an plays the sound and video on the pinball monitor. I already got all this to work fine, but I have to start the program on the PC manualy by entering a command in terminal or by doubleclicking an autoststart.sh or by doubleclicking a desktop icon (.desktop file).
What I need is , when giving power to the pinball the PC gets also power an boots directly into the pinball control program.
Quote:
2 Does it require a GUI?
I think NO. In the installation scripts which worked with older linux versions I found this line:
Code:
 update-rc.d -f gdm remove
update-rc.d -f lxdm remove
mv /etc/init/lxdm.conf /etc/init/lxdm.conf.nostart
mv /etc/init/plymouth-splash.conf /etc/init/plymouth-splash.conf.nostart
Quote:
3 Does it have to run as a user?
I do not realy know, when I start it from Terminal I have to do "sudo su" perhaps this is because all the files are located in a subfolder from /root
Quote:
"kiosk mode".
I do not have any idea what this is!
Could a cron job help me? Perhaps with @reboot?
 
Old 02-06-2017, 01:19 PM   #32
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Kiosk mode is what is provided by systems that boot into a predefined GUI, with the application running as a predefined user. There is no login, as the login has already been defined.

It is also one of the possible operations for embedded systems with a GUI - though frequently those don't use X for the GUI, it is possible for them to do so.

http://ze.phyr.us/kiosk-mode-in-linux/

Last edited by jpollard; 02-06-2017 at 01:20 PM.
 
Old 02-06-2017, 03:09 PM   #33
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,937

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
If you want to test if a GUI is necessary:-

Press CTRL+ALT+F1
Login & try running your sudo, cd and run of program
If it works then you don't need a GUI, otherwise you do need a GUI.

Press CTRL+ALT+F7 to revert to the Ubuntu GUI screen.
 
Old 02-06-2017, 05:50 PM   #34
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
You hit the point!!!!!
When doing your ALT CTL F1 I get a "terminal" like screen.
Entering my sudo... , cd... , ./root , the program starts, but exits whith a fatal error at the point where normaly the pinball video fills the screen. before the fatal error line I can read the line:
Could not open SDL Display

Whereas when starting the program in a terminal window on GUI the program starts fine and in the terminal window I can read:

SDL_VIDEO: Using Software Surface
Pitch 2560 Depth 32 Width 640 Height 480
MAX CORE 3
MTPA 3
Auto detecting playfield.

and the terminal window stays at this point until I hit F1 in the pinball video window.

So we do have a big difference in both situations
But what does this mean for my autostart project?

Thank you for staying with me and trying to help on this!
 
Old 02-06-2017, 08:09 PM   #35
JeremyBoden
Senior Member
 
Registered: Nov 2011
Location: London, UK
Distribution: Debian
Posts: 1,937

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498
It means that you must login to a GUI screen first.
The terminal window method is a very good imitation of a genuine command entry screen, running in a GUI environment.

So any method which doesn't start the GUI first, is going to fail.

It is rather unusual to autostart GUI programs, with the exception of those that can also run in a non-GUI environment.
You need to logon as a user, which will give you a GUI and you can then use a .desktop file to autostart a program.

I don't know if there are any possibilities in using a customised live distro?
 
Old 02-07-2017, 12:07 AM   #36
Ztcoracat
LQ Guru
 
Registered: Dec 2011
Distribution: Slackware, MX 18
Posts: 9,484
Blog Entries: 15

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Quote:
Originally Posted by JeremyBoden View Post
It means that you must login to a GUI screen first.
The terminal window method is a very good imitation of a genuine command entry screen, running in a GUI environment.

So any method which doesn't start the GUI first, is going to fail.

It is rather unusual to autostart GUI programs, with the exception of those that can also run in a non-GUI environment.
You need to logon as a user, which will give you a GUI and you can then use a .desktop file to autostart a program.

I don't know if there are any possibilities in using a customised live distro?
I agree that it's unusual to autostart an GUI Program.
The only program that I use to have start at boot was Simon.
Simon was a speech recognition program:-

I thought OP was already using a desktop file to start the program?
 
Old 02-07-2017, 01:34 AM   #37
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
Actualy when I power on the PC, it directly comes to the ubuntu desktop.
This desktop belongs to user "pinball" because when I start the filemanager I'm in home/pinball/ .
On this desktop I have an icon created with a .desktop file.
clicking this icon starts the pinball software.
1. a terminal window opens and several lines are displayed
2. when the lines come to the SDL_Video line,
- with option -window set, a second winow opens showing the pinball videos
- with option -fullscreen set the same videos start in fullscreen mode

EDIT: Do I have to focus an that SDL_VIDEO error ? Do I have to initalize some SDL system when I'm not in GUI?

Last edited by jumperger; 02-07-2017 at 01:58 AM.
 
Old 02-07-2017, 06:15 AM   #38
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
It appears you are just reinventing the kiosk mode I described earlier. Setting it up depends on the display manager, and the "desktop" chosen for the login.

In your case, you have to define an appropriate script to start the game.
 
Old 02-07-2017, 08:58 AM   #39
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
My script to start the game is called autostart.sh :
Code:
#!/bin/bash
#export DISPLAY=:0.0
#xscreensaver-command -exit

cd /root/newcore/bin
./run newcore -window
What do I have to do to get this kiosk thing running? Is this script what you are talking about?

I also created a working .desktop file pointing to the autostart.sh script.

I was told to put a copy of the .desktop into /home/myuser/.config/autostart/ to the game starting automatically after reboot.
This did not work.

But now I had the idea to delete the # in the export line of the script.
After reboot the game is now starting automatically.
I see the terminal window called by the ./run executable after a fee seconds the pinball video window pops up, this is called by the newcore executable.

The problem is that this second window closes immediately and the terminal window closes afterwards.

On 10 reboots I may get 1 where both windows stay open and everything works fine until I quit the game by pushing F1.

I can't understand this :-(
 
Old 02-07-2017, 09:45 AM   #40
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
Quote:
Originally Posted by jumperger View Post
My script to start the game is called autostart.sh :
Code:
#!/bin/bash
#export DISPLAY=:0.0
#xscreensaver-command -exit

cd /root/newcore/bin
./run newcore -window
What do I have to do to get this kiosk thing running? Is this script what you are talking about?

I also created a working .desktop file pointing to the autostart.sh script.

I was told to put a copy of the .desktop into /home/myuser/.config/autostart/ to the game starting automatically after reboot.
This did not work.

But now I had the idea to delete the # in the export line of the script.
After reboot the game is now starting automatically.
I see the terminal window called by the ./run executable after a fee seconds the pinball video window pops up, this is called by the newcore executable.

The problem is that this second window closes immediately and the terminal window closes afterwards.

On 10 reboots I may get 1 where both windows stay open and everything works fine until I quit the game by pushing F1.

I can't understand this :-(
Don't use the DISPLAY environment variable. At one time or another, it WILL be the wrong value.

A kiosk mode is automatically logged in by the display manager (which does start at boot). The display manager has to be used as it is what initializes the graphics display. Once the graphics display is started an "auto login" account MAY be used. But if the user doesn't specify what desktop to use, the display manager will use the default.

It depends on which display manager you are using as to what file needs to be created. It might just be that all you need (since you have the auto-login working) is a ".xinitrc" file in the home directory of the login used.

NOTE: the DISPLAY environment variable is defined by the display manager. It is not something you make up. Using :0 (or :0.0) USUALLY works. because when only one user is logged in, the value is set to :0. A second user gets :1.

The contents of the .xinitrc is usually something like
Code:
#!/bin/sh

exec ck-launch-session mate-session
and may be created by the login program when you select the desktop type (if you have more than one installed).

The exec starts the program you want with any arguments you want. In your case it the contents might be
Code:
#!/bin/sh

cd /root/newcore/bin
exec ./run newcore -window -fullscreen
When the program exits (if it does), then the display manager regains control. Usually in a kiosk mode this doesn't happen (unless bugs cause the program to abort).

Be careful with this, as it specifically defines what can be done. You might have to have a separate system to connect via ssh to do configuration control.
 
Old 02-07-2017, 12:08 PM   #41
jumperger
LQ Newbie
 
Registered: Oct 2016
Posts: 20

Original Poster
Rep: Reputation: Disabled
Quote:
It depends on which display manger you use
I do not know which display manager I use. I have installed Ubuntu 16.04 LTS from the 32bit ubuntu-16.04-desktop-i386.iso.
As you say I have to be careful, I want to ask if I understood well what I have to do

1. re-coment the export DISPLAY line with #
2. delete the .desktop in /home/myuser/.config/autostart
3. create the .xinitrc file in /home/myuser/ , because this file does not exist.
4. Inside the created file I'll write:
Code:
#!/bin/sh
cd /root/newcore/bin
exec ./run newcore -window
Do I need a sudo su in the beginning of the file?

For your information, "run" and "newcore" are 2 different executables in the /root/newcore/bin folder.

Do I need to initiate this kiosk service somewhere?
 
  


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
[SOLVED] systemd[1]: Failed to start OpenBSD Secure Shell server during boot pan64 Linux - General 14 10-31-2015 05:14 AM
[SOLVED] Centos 7 - how to start Java app requiring networking on boot with systemd rylan76 Linux - Server 3 06-26-2015 03:30 AM
Boot Delay 30min: systemd-analyze blame systemd-tmpfiles-setup.service BGHolmes Fedora 0 07-27-2011 09:02 AM
[SOLVED] Newbie problem getting Ubuntu s/w to start on triple boot Acer Aspire One netbook meggiedude Linux - Newbie 17 05-19-2011 01:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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