1
Our C++ Qt application runs graphically without X by specifying the -qws
switch. Because of that, I uninstalled and disabled the graphical environment on the BeagleBone Black. Now, when I power on the board, I end up with the standard text login screen.
When I log in as root with an empty password, I can run a script that sets some settings for the touchscreen etc. and then starts up our application. This works flawlessly.
Now, we need to autostart this application on every boot, as the whole bundle is supposed to be on duty in some industrial cabinet without any keyboard or mouse attached. In order to achieve that, I created a systemd service, but unfortunately it does not work. When I reboot the system, our application shows up for a fraction of a second, but it almost instantly collapses and goes back to the login screen.
When I log in and try to start the service, it also does not work. This is what systemctl status ivt.service
says:
ivt.service - IVT Startup Routines
Loaded: loaded (/lib/systemd/system/ivt.service; enabled)
Active: failed (Result: exit-code) since Sat 2000-01-01 00:35:26 UTC; 1min 39s ago
Process: 499 ExecStart=/usr/bin/ivtstartup.sh (code=exited, status=139)
Main PID: 403 (code=exited, status=139)
CGroup: name=systemd:/system/ivt.service
Jan 01 00:35:26 beaglebone ivtstartup.sh[499]: Shutdown clients...
Jan 01 00:35:26 beaglebone ivtstartup.sh[499]: Shutdown servers...
Jan 01 00:35:26 beaglebone ivtstartup.sh[499]: Shutdown PaPort1 ...
Jan 01 00:35:26 beaglebone ivtstartup.sh[499]: PaPort1 shutdown completed.
Jan 01 00:35:26 beaglebone ivtstartup.sh[499]: SYSTEM-SHUTDOWN COMPLETE.
Jan 01 00:35:26 beaglebone ivtstartup.sh[499]: Unload drivers...
Jan 01 00:35:26 beaglebone ivtstartup.sh[499]: CSystemManager::UnloadServers PaPort1
Jan 01 00:35:26 beaglebone ivtstartup.sh[499]: Unload drivers completed.
Jan 01 00:35:26 beaglebone systemd[1]: Failed to start IVT Startup Routines.
Jan 01 00:35:26 beaglebone systemd[1]: Unit ivt.service entered failed state
This is the script that I want to execute with the service (at /usr/bin/ivtstartup.sh
):
#!/bin/bash
ifconfig eth0 172.17.6.136 netmask 255.255.248.0 up
route add default gw 172.17.1.200
echo "nameserver 172.17.1.51" > /etc/resolv.conf
ln -s /dev/ttyO2 /dev/ttyM0
/home/root/testbg &
(
export TSLIB_TSDEVICE="/dev/input/touchscreen0";
export TSLIB_CALIBFILE="/etc/pointercal";
export QWS_MOUSE_PROTO="Tslib:/dev/input/touchscreen0";
bash -c '/home/root/testgui -qws';
)
And finally this is the service /etc/systemd/system/ivt.service
:
[Unit]
Description=IVT Startup Routines
[Service]
Type=forking
ExecStart=/usr/bin/ivtstartup.sh
[Install]
WantedBy=multi-user.target
When I log in an then run /usr/bin/ivtstartup.sh
manually, everything works. The application testbg
runs in the background (used for some serial communication etc.) and the testgui
shows up and works as expected.
What is the problem with that configuration? Is there another way to achieve an automatic start of that script without logging in manually? Thanks in advance!
Maybe you'll find an answer in this post? How to run a shell script at startup
– JeromeLEKIEFFRE – 2017-11-17T09:58:40.650