I'm trying to run Qt GUI application automatically when booting Raspberry Pi using Openbox but have problems and can't make it work. Steps I did:
- run
raspi-config
and changedBoot Options
toConsole Autologin
- in
/etc/rc.local
I addedstartx &
beforeexit 0
- in
/etc/X11/xinit/xinitrc
I commented. /etc/X11/Xsession
and addedexec openbox-session
- in
/etc/xdg/openbox/autostart
I added/home/pi/Wt/WidgTest &
which is my app.
OpenBox runs because I have black screen with cursor in it and can access it's menus but my application doesn't. Can someone tell me what I do wrong?
Thanks.
---Edit---
As suggested in the comments I tried to used systemd unit files to do this. First I made an unit file for xsession:
[Unit]
Description=session
[Service]
Type=idle
ExecStart=startx
[Install]
WantedBy=multi-user.target
Then I made the unit file to run openbox session:
[Unit]
Description=Openbox
After=session.service
[Service]
Type=idle
ExecStart=/usr/bin/openbox-session
[Install]
WantedBy=multi-user.target
And unit file to run my app:
[Unit]
Description=MyApp
After=openbox.service
[Service]
Type=idle
ExecStart=/home/pi/Desktop/MyApp/MyApp
[Install]
WantedBy=multi-user.target
The openbox service fails to run. systemctl status openbox.session
output:
openbox.service - Openbox
Loaded: loaded (/lib/systemd/system/openbox.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Tue 2020-12-08 06:52:56 GMT; 46s ago
Process: 415 ExecStart=/usr/bin/openbox-session (code=exited, status=1/FAILURE)
Main PID: 415 (code=exited, status=1/FAILURE)
Dec 08 06:52:51 raspberrypi systemd[1]: Started Openbox.
Dec 08 06:52:56 raspberrypi openbox-session[415]: Openbox-Message: Failed to open the display from the DISPLAY environment variable.
Dec 08 06:52:56 raspberrypi systemd[1]: openbox.service: Main process exited, code=exited, status=1/FAILURE
Dec 08 06:52:56 raspberrypi systemd[1]: openbox.service: Failed with result 'exit-code'.
UPDATE with info from a comment:
I'm trying to do is to boot raspberry to my app. I want to display my splashscreen and then run my app. So I switched boot to Console Autologin and try to run Openbox just for my application. At first I tried to do that by running my app directly in the framebuffer, but I had problem with rotating my app and displaying gradients so I'm looking for another alternative.
ExecStart=
this command within a Unit file with some additional statements to get the same environment of the command line. systemd manages GUI resources by itself using thegraphical.target
but I don't know if there are special issues with OpenBox and/or with your setup. Can you please add the working command line command to the question?