If you create a recipe which has a systemd service file (as the one from below added at the my-test.service file) which you want to have enabled by default in the system the system will spin forever attempting to complete the systemd-postinst. You would think this would happen for only services which define a "After" to create a chicken before egg situation but this happens with even the simplest service files such as --- [Unit] Description=An example service [Service] ExecStart=/bin/true [Install] WantedBy=multi-user.target --- When booting you will see something like: [ *** ] A start job is running for Run pending postinsts (7s / no limit)
1. Create a recipe which include a service file (such as the one in the description) and has systemd variables set.
inherit systemd
do_install() {
install -d ${D}${sysconfdir}/systemd/system
install -m 0755 my-test.service ${D}${sysconfdir}/systemd/system
}
SYSTEMD_PACKAGES += "${PN}"
SYSTEMD_SERVICE_${PN} = "my-test.service"
SYSTEMD_AUTO_ENABLE_${PN} = "enable"
pkg_postinst_${PN}() {
#!/bin/sh -e
if [ x"$D" = "x" ]; then
# Do something
echo hanging Hello world at boot
else
exit 1
fi
}
2. Include the package created from this recipe in your image
3. attempt boot the image