[oe] systemd service not enabled when adding simple recipe to image

Sandro Stiller sandro.stiller at elfin.de
Wed Mar 9 12:21:09 UTC 2016


Hello,
I have a problem enabling a simple systemd service:
If I install my package using the .ipk file, everything works fine
(systemd service ist enabled after install), but if I create an image
containing this package, the service is disabled.
It can be enabled by calling "systemctl enable <mytestscript.service>".
All files of the package are installed correctly (only the systemd
symlink is missing). I have other packages with working systemd, the
problem exists only in the simple case with a single shell script.

I use Angstrom v2015.06 / Yocto 1.8

Can anybody tell me what I'm doing wrong?

Thank you very much,

Sandro


My files:
###################### mytestscript.bb ########################
SUMMARY = "systemd test script"
DESCRIPTION = "This script is a quick demo for a not initialized systemd 
service."
SECTION = "console/network"
LICENSE = "MIT"
LIC_FILES_CHKSUM = 
"file://${COREBASE}/LICENSE;md5=4d92cd373abda3937c2bc47fbc49d690"

inherit systemd

SRC_URI = "file://mytestscript.service \
            file://mytestscript.sh \
           "

do_compile() {
}

do_install () {
   install -d ${D}${bindir}
   install -m 0755 ${WORKDIR}/mytestscript.sh ${D}${bindir}
   install -d ${D}${systemd_unitdir}/system
   install -m 0644 ${WORKDIR}/mytestscript.service 
${D}${systemd_unitdir}/system
   sed -i -e 's, at BINDIR@,${bindir},g' \
		${D}${systemd_unitdir}/system/mytestscript.service
}

NATIVE_SYSTEMD_SUPPORT = "1"
SYSTEMD_PACKAGES = "${PN}"
SYSTEMD_SERVICE_${PN} = "mytestscript.service"
SYSTEMD_AUTO_ENABLE = "enable"

FILES_${PN} += "${systemd_unitdir}/system/mytestscript.service"

###################### files/mytestscript.sh #########################
#!/bin/sh
echo "Hello from testscript"

###################### files/mytestscript.service ######################
[Unit]
Description=A test script
After=local-fs.target

[Service]
Type=oneshot
ExecStart=@BINDIR@/mytestscript.sh

[Install]
WantedBy=multi-user.target



More information about the Openembedded-devel mailing list