A20 Lime2-4gb / Run Gui application on bootup

Started by AnkyB, October 16, 2017, 02:09:52 PM

Previous topic - Next topic

AnkyB

We are using A20lime2 board with official debian jessie image. We have created qt qml desktop application .We are able to run application manually when system is fully booted. We want to run this gui application on startup without showing bootup msg and linux home page as well as shutdown when application is closed . We have searched a lot for this, We tried different ways but didn't get it working.

1) We have tried simplest way that is calling application in rc.local, this is working for python scripts but not for qt qml application

2) tried creating service in /etc/init.d and calling that script in rc.local but not getting anything. when We call  service manually using start and stop command We get error "job for xyz service failed. see 'systemctl status xyz service' and 'journalctl -xn' for details." when We run 'systemctl status xyz service' , We get error "Active : failed...." and "Failed to start LSB: log file hand...." for journalctl -xn'

3) followed this procedure https://debian-administration.org/article/28/Making_scripts_run_at_boot_time_with_Debian getting no error but it is not running on startup.

4) We made simple executable .sh file which is calling gui application and called that .sh file in ~/.bashrc file, this is giving us partial result. Application runs when we enter $su and then root password but shows home screen i.e desktop screen when application is closed. We tried disabling root password using passwd commands but did not help much. Is there any way to run this application without root password on startup ? We need root permissions as some functions are based on it.   
Is there any other way to run gui application om startup ? or are we going wrong ?

Regards

SR-Digitronic

#1
We are using the Micro board, but it should be the same:

/etc/lihgtdm:
autologin-user=olimex
autologin-user-timeout=0


/usr/share/lightdm/lightdm.conf.d/electron.conf:
[SeatDefaults]
user-session=openbox


This directly starts into an openbox session, which is basically just a black screen and cursor.

/home/olimex/.config/openbox/autostart runs our GUI, followed by the reboot command.
Scripts wait until the called program exits, if your program forks to background and exits the main process, this won't work.
Our GUI goes into full screen mode, otherwise you'll have window decorations.

Edit: rc.local won't work, since the X server isn't started yet. .bashrc gets called when you open a terminal / ssh connection and your user uses bash, other shells are available, via ssh you won't have the X server available. You need the X server (or wayland or directly work with the framebufer) for graphical applications, you are not just running a script.

If you already use the framebuffer, you can try to teach lightdm to start your application instead of a window manager / desktop environment. Could work just with user-session, but I don't know.

AnkyB

Thank you SR-Digitronic , We tried using following modifications , We dont have /etc/lightdm but /etc/lightdm/lightdm.conf. So we did changes in lightdm.conf file
Quote from: SR-Digitronic on October 16, 2017, 03:35:57 PM
We are using the Micro board, but it should be the same:

/etc/lihgtdm:
autologin-user=olimex
autologin-user-timeout=0


/usr/share/lightdm/lightdm.conf.d/electron.conf:
[SeatDefaults]
user-session=openbox


This directly starts into an openbox session, which is basically just a black screen and cursor.

/home/olimex/.config/openbox/autostart runs our GUI, followed by the reboot command.
Scripts wait until the called program exits, if your program forks to background and exits the main process, this won't work.
Our GUI goes into full screen mode, otherwise you'll have window decorations.

But this modification caused some error ,  after reboot there was neither desktop window nor gui application but constant black screen. So we removed that image from sd card and using clone image.

Is there any other way to use lightdm ? we have not tried framebuffer, how to do that ?


Regards

SR-Digitronic

#3
Quote from: AnkyB on October 17, 2017, 12:39:12 PM
But this modification caused some error ,  after reboot there was neither desktop window nor gui application but constant black screen. So we removed that image from sd card and using clone image.

A black screen (with a cursor) is the expected behavior, openbox isn't a desktop environment. It does not have a desktop, no bars, no background. Which is ideal when you want to make the OS as invisible to the user as possible. The application gets started via the
This only makes sense when all you want to display is your application and make it look like nothing but your application is running on the board. (That is what I understood, you want to accomplish)


Quote from: AnkyB on October 17, 2017, 12:39:12 PM
we have not tried framebuffer, how to do that ?

I haven't tried it, since we don't use Qt, but this could help: https://wiki.qt.io/Qt_for_Embedded_Linux

But I don't know how you start it then, probably with a script. I think, you wouldn't use Xorg and lightdm (needs the previous) in that case. If you are using a touch display, you probably will need to handle the input device on your own with tslib, since Xorg does this usually.

Edit: If you have a mouse connected you can check whether openbox successfully started by performing a right click. Openbox does offer a context menu, which you can use to start a terminal or browser.