systemd service not enabled when adding simple recipe to image
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,@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
If anyone is interested:
The reason why systemd service works if installed using opkg and fails if I create an image:
The systemctl executable of OE is a shell script which handles the .service file in a different way.
I had a blank space behind the "WantedBy" line. The "real" systemctl has no problem with it, but the shell script silently ignores the entry without any error message and the service is not enabled in the image.
This is a bug. Can you please create a bug in bugzilla so it can be addressed
Quoted 17 lines · Sandro Stiller
If anyone is interested:
The reason why systemd service works if installed using opkg and fails if I create an image:
The systemctl executable of OE is a shell script which handles the .service file in a different way.
I had a blank space behind the "WantedBy" line. The "real" systemctl has no problem with it, but the shell script silently ignores the entry without any error message and the service is not enabled in the image.--
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel