Systemd, problem to start an old Program on boot under Ubuntu 16.04
Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I did not write this program, I'm only transfering it to a newer Linux to get support for recent motherboards.
To install the program on Ubuntu 16.04, I copied all the program files to the same path as they were in the original installation on ubuntu 8.
As all the files needed by the program were stored in a folder called program in the root folder, I copied all that stuf to the root folder in my ubuntu 16.04 PC.
Simply copying this folder was not everything I had to do, I also installed missing liraries in 16.04 and created a lot of simlinks to get the program to run.
When doubleclicking the .desktop icon or by launching the program in Terminal everything runs fine.
The only thing I can't get to work is the autostart after boot.
I installed Teamviewer on this Pc and it starts automaticaly after boot, I checked how this works.
There is a systemd unit which starts teamviwer, but in addition to the teamviewerd.system file in /etc/systemd/system there is also a global.conf file in /etc/teamviewer/
In the original setup (ubuntu8) the autostart was made by initd files with following runlevels:
update-rc.d program start 99 2 3 4 5 .
No :-) , the folder is named after the real name of the program, I only used the word program as a placeholder for the real name, which is probably unknown by everybody.
No , as you can see in my autostart.sh the program may be startet with options:
cd /root/program/bin
./run program -window
run and program are 2 binaries in the /bin folder.
-window is an option stating that the program should execute in a window, when the -window option is set I have the ubuntu GUI in the background, a terminal window where I see the progress of the runing program and a window which displays pictures and videos in reaction to the actions of the ball on the pinball playfield. The "program" gets informations from the switches on the playfield through a parallel cable (LPT1) and in reaction to these informations gives signals to the coils on the playfield and displays the needed video sequence.
When I toggle the -window option to -fullscreen all videos are displayed in fullscreen mode and you can't see the GUI background and terminal window. The -fullscreen option is the standard option used when everything is setup right. When playing the pinball machine you do not have to notice that there's a computer runing behind.
No such program as run exists and program is a directory.
Even if they were both programs, you say that the GUI has been started, this won't happen unless you have logged on and started the GUI in Ubuntu.
Information seems to be released strictly on a need-to-know basis.
No such program as run exists and program is a directory.
Let's use the real name of the program called newcore, all the files which are related to this program are stored in a folder which is also named newcore and has many subfolders e.g. /bin or /scripts or /music or ...
In the /bin subfolder there are 2 binary files, with lozenge shaped blue icons, called run and newcore, both are executable.
In terminal I may start both separately with ./run and ./newcore
Quote:
Even if they were both programs, you say that the GUI has been started, this won't happen unless you have logged on and started the GUI in Ubuntu.
When I switch on my Ubuntu-PC with the POWER-ON/OFF button it comes to the ubuntu GUI without asking for password, only when the screensaver comes up I have to enter my password.
Quote:
Information seems to be released strictly on a need-to-know basis.
I will give you any information you need, but as a newbie I do not know which information and where to find it.
The only thing I realy know, is which command I have to type in terminal to start the programm. I know this because I found the commands by reading all the files in the /scripts folder.
In terminal I type:
sudo su -> I'm not asked for my password
then I change to following directory:
cd /root/newcore/bin -> found this in the autostart.sh script
then I start the ptogram by typing:
./run newcore -fullscreen -> found this in the autostart.sh script
This makes ubuntu GUI disapear and I have only pinball related images and sound on the monitor.
When I quit the pinball program by hitting F1 on the keyboard I come back to ubuntu GUI with terminal window open , which says something about Whatchdog (no idea what this is) and newcore SHUTDOWN and the terminal window closes.
In the newcore installation manual I found that there is also the option -window for starting the program. For my tests while trying to install it on ubuntu 16.04 I mostly used the -window option . With this option set I could see if something was runing in the background or not.
These are all the infos I have, maybe I miss something which doesn't look important to me but could be of great interest for you. You only have to ask, I will share any info I have!
Thank you for trying to help such a newbie as I am
cd /root/newcore/bin - is newcore really a subdirectory of /root??
Yes, I copied the newcore folder with all his content to /root because in the original installation on ubuntu 8 it was also in the /root folder. The /root folder is on the same directory level as /etc , /var , /usr , /bin , /boot , ...
You could create such a file - there will be similar examples present.
I have alresdy created a .desktop file with an associated icon, this icon is diplayed on my desktop. Doubleclicking the icon starts my pinballsoftware emulation, everything runs fine.
As you suggested I have created an autostart folder in .config and I copied my .desktop file into this autostart folder.
But after reboot my pinballsoftware does not show up.
Quote:
The program to be run needs to be a script, because you want to do several things.
The .desktop file points to my autostart.sh file which I posted earlier , is this a file which you consider being a script?
Code:
#!/bin/bash
#export DISPLAY=:0.0
#xscreensaver-command -exit
cd /root/newcore/bin
./run newcore -window
in the .desktop file will run only one program.
So you need a script that does both the cd and the run options.
BTW a programmer who uses program names like run & newcore should be shot.
Is there need to run your program with root privileges?
I hope these PC's never get connected to the internet.
The program is an emulator of the software driving a pinball machine built in 1999.
The motherboards of the machines are dieing after nearly 20 years of tough labour.
10 years ago this emulator was created, but is not supported anymore.
To use the emulator on a recent motherboard I had to get it to work on a newer linux . Now with a quad core and ssd the performance of the emulator is realy good.
Only the autostart is a problem, I have to get this to work because the LinuxPC is started at PowerOn of the pinball machine and needs to go directly into the emulator.
1 What are you trying to do with the program?
2 Does it require a GUI?
If it does, then starting at boot time will not work - there is NO GUI available right then, unless you are running the system in "kiosk mode" (and yes, you will have to look up how to run a systemd based system that way). Even then, you don't start it until AFTER the GUI has been started.
3 Does it have to run as a user?
If it does, then the user must exist... and be designated. And if it requires a GUI, then the the user must be logged in, and the proper display defined - some of this is what is done for you with "kiosk mode".
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.