Hi
I would like to implement a systemd service which can launch executable (application) on power on of system .
I added systemd service with reference to wayland-app-launch. service . But my native systemd service i.e init_script.service not getting enabled . following error as mentioned in the image.
Please suggest me any setting required to auto enable the systemd service on power on of system imx8.

native systemd service file
[Unit]
Description = Default script run
After=network.target
[Service]
Restart=on-failure
ExecStart=/usr/bin/init_script.sh -w -t 5
RestartSec=1
TimeoutSec=infinity
[Install]
WantedBy=multi-user.target
~
we are using tdx-reference-multimedia-image for Apalis iMX8 and Yocto Project dunfell to build this image.
Regards,
Deepak J
Hi @djewargi,
Thanks for posting your query on Toradex Community.
To better help you with your query we will further need details as below:
-
Complete hardware and software version.
-
Exact steps you have followed in order to get systemd service running.
-
Output of systemctl status service name.
Additionally do you need help in making yocto recipe to include systemd service for auto starting application or in general you want to know how to start application on linux boot.
We have article for this which you may want to check and let us know if this help you resolving the issue
Best Regrads
Ritesh Kumar
Thanks Ritesh,
I have referred ayland-app-launch.service and recipe-graphic
Now, I’m trying to add multiple systemd services to launch multiple Applications, for example application-1 ,application-2 and application-3.
Please find the bb file as follows.
# set the following variable to your one and only application which should
# be launched right after weston started
SUMMARY = "Recipe for init scrit and start application functionality"
DESCRIPTION = "Recipe for application functionality "
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"
inherit allarch systemd
SRC_URI = " \
file://init_script.service \
file://init_script.sh \
file://start_hmiapplication.service \
file://start_hmiapplication.sh \
"
S = "${WORKDIR}"
do_install() {
bbwarn "init_script installation started"
install -d ${D}${systemd_system_unitdir}
install -m 0644 init_script.service ${D}${systemd_unitdir}/system
install -d ${D}${systemd_system_unitdir}
install -m 0644 start_hmiapplication.service ${D}${systemd_unitdir}/system
install -d ${D}${bindir}
install -m 0755 init_script.sh ${D}${bindir}
install -d ${D}${bindir}
install -m 0755 start_hmiapplication.sh ${D}${bindir}
bbwarn "init_script installation completed"
}
FILES_${PN} += "${systemd_system_unitdir}/init_script.service"
FILES_${PN} += "${systemd_system_unitdir}/start_hmiapplication.service"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = "init_script.service"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = "start_hmiapplication.service"
following error after running commands as follows:
$ bitbake tdx-reference-multimedia-image
Error
Initialising tasks: 100% |#################################################################################################################################################################| Time: 0:00:10
Sstate summary: Wanted 486 Found 476 Missed 10 Current 3417 (97% match, 99% complete)
NOTE: Executing Tasks
WARNING: nhp-init-script-0.0.1-r0 do_install: init_script installation started
WARNING: nhp-init-script-0.0.1-r0 do_install: init_script installation completed
WARNING: nhp-image-1.0-r0 do_rootfs: nhp-init-script.postinst returned 1, marking as unpacked only, configuration required on target.
ERROR: nhp-image-1.0-r0 do_rootfs: Postinstall scriptlets of ['nhp-init-script'] have failed. If the intention is to defer them to first boot,
then please place them into pkg_postinst_ontarget_${PN} ().
Deferring to first boot via 'exit 1' is no longer supported.
Details of the failure are in /home/deepak/oe-core/build/tmp/work/apalis_imx8-tdx-linux/nhp-image/1.0-r0/temp/log.do_rootfs.
ERROR: Logfile of failure stored in: /home/deepak/oe-core/build/tmp/work/apalis_imx8-tdx-linux/nhp-image/1.0-r0/temp/log.do_rootfs.900570
ERROR: Task (/home/deepak/oe-core/build/../layers/meta-nhp/meta-nhp-image/recipes-images/images/nhp-image.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 10577 tasks of which 10558 didn't need to be rerun and 1 failed.
NOTE: Writing buildhistory
NOTE: Writing buildhistory took: 15 seconds
Summary: 1 task failed:
/home/deepak/oe-core/build/../layers/meta-nhp/meta-nhp-image/recipes-images/images/nhp-image.bb:do_rootfs
Summary: There were 3 WARNING messages shown.
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
**Please suggest or share links how to write recipe or bb file to install multiple systemd service @ ${D}${systemd_unitdir}/system**
Attached complete recipe file .
[recipes-nhp-init-script.tar.xz|attachment](upload://8HjUyOr8BiC7Pgv5pTmwAWPQwfh.xz) (1.6 KB)
Regards,
Deepak J