If a .service file of a recipe contains a space / tab at the end of the WantedBy line, the service is not enabled in the image. If a .ipk for the same recipe is installed in the target, the service is enabled after installation. The problem is in the recipes-core/systemd/systemd-systemctl/systemctl shell script. The "real" systemctl binary on the target system works properly. Preconditions/Environment ------------------------- tested with * Yocto 1.8 and * the current git version of the systemctl script Triggering Action/Cause ----------------------- 1. Add a space or tab to the end of the WantedBy line of a .service file 2. build an image 3. start the built system The problem can also reproduced by simply executing recipes-core/systemd/systemd-systemctl/systemctl --root=<rootfs-dir> <servicename>.service and checking the result. Expectation ----------- The service should be enabled (symlink created) Actual Result ------------- The service is not enabled. There is no message in the build process about it. Reproducibility --------------- always
As mentioned on the bugboard call, depending on the actual bug, we could add a QA, build time check so that we catch malformed .service files before runtime.
I don't have a working systemd build right now, but can you see if changing unit_types_re to: unit_types_re='\.\(service\|socket\|device\|mount\|automount\|swap\|target\|path\|timer\|snapshot\)\s*$' Fixes this? Basically, add \s* before the $. (allow some whitespace before the line end)
Patch on the list
Fixed in oe-core 0395162aa45a416db6a0a38e7ee6c0f808272393.
The systemctl script in poky/meta/recipes-core/systemd/systemd-systemctl is a bit too complicated for me to understand. But a fast look let me tend that somewhere in the beginning it should do a tr '\r\n' '\n' or something of the whole .service file.
oops sorry, wrong ticked. This should go to Bug 13535