Service is not running at startup

Good morning,
We have a system that we are building on an Apalis imx8 board. We use a custom imagebase on the “tdx-reference-minimal-image” and we TFTP Boot the board with that image, which works perfectly. This image has a service that we created using a custom layer/custom recipe, this service has the followings:
→ A script Set the password for user “root” : “”
→ other files to Configure ssh with key to be able to remote login to the board.
→ A service to run on startup one time {}, this service is the entry point to start the set_root_password.
Note that set all other need configuration such as network configuration.
The problem is the service doesnt run on startup. It only works if i manually run it using: systemctl start custom-ssh-service.

Here is how the and the custom-ssh-service:

SUMMARY = “Custom SSH Configuration”
DESCRIPTION = “Custom SSH Configuration for Apalis iMX8”


License checksum file is always required

LIC_FILES_CHKSUM = “file://${COREBASE}/meta/files/common-licenses/MIT;md5=

#inherit systemd

SRC_URI = “file://

S = “${WORKDIR}”

inherit update-rc.d systemd


SYSTEMD_SERVICE_${PN} = “custom-ssh-service.service”

do_install() {
install -d ${D}${sysconfdir}/ssh/
install -d ${D}${sysconfdir}/systemd/system/
install -d ${D}${bindir}

install -m 0644 ${WORKDIR}/ ${D}${sysconfdir}/ssh/
install -m 0644 ${WORKDIR}/sshd_config ${D}${sysconfdir}/ssh/
install -m 0644 ${WORKDIR}/sshd.socket ${D}${sysconfdir}/systemd/system/
install -m 0755 ${WORKDIR}/ ${D}${bindir}/
install -m 0755 ${WORKDIR}/ ${D}${bindir}/
install -m 0644 ${WORKDIR}/custom-ssh-symlink.service ${D}${sysconfdir}/systemd/system/
install -m 0644 ${WORKDIR}/custom-ssh-service.service ${D}${sysconfdir}/systemd/system/


FILES_${PN} += “${sysconfdir}/ssh/

pkg_postinst:${PN}() {
mkdir -p $D${sysconfdir}/systemd/user/
ln -s ${sysconfdir}/systemd/system/custom-ssh-service.service $D${sysconfdir}/systemd/user/


Description=Custom SSH Configuration Service



ExecStart=/usr/bin/ start
ExecStart=/usr/bin/ start


Please, help us figure out why the service is not running on startup, Thanks!


When at the first boot (service not auto-started) , can you post the systemctl status <service_name> output? The service does need to be enabled in order to start on boot.

It may also be beneficial to break up your custom service into separate services, with appropriate before/after to isolate the problem area.

And also can you post/review the logs provided via journalctl -u <service_name>


Good morning,
I now know that it is best to have one service per recipe. Though, that was not the solution. The solution was to add “do_install:append” before FILES_${PN} and remove pkg_postinst (See image).
Additionally, the board booted with no logs, adding IMAGE_INSTALL +="rsyslog"in the conf/local.conf is very helpful for debugging.
Side note, to find if a package is available when building the image this command help:
→ bitbake -s | grep rsyslog
I was able to know there is “rsyslog” Whereas there is no “plocate” in seconds.

Anyway, I appreciate the help.