Bug 13535

Summary: systemctl-native fails if service file contains non-unix newlines
Product: [Build System, Metadata & Runtime] OE-Core Reporter: f.bre
Component: coreAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Undecided CC: meta.mr.watcher, meta.watcher, richard.purdie
Version: unspecified   
Target Milestone: ---   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description f.bre 2019-09-17 12:54:44 UTC
This is similar to Bug 9337.
I had a start-firmware.service file which contained a \r\n as newline instead of just \n at the end of the WantedBy line. The result was the service is not enabled in the image. It took me 2 days to find that out.

I think, the problem is in the recipes-core/systemd/systemd-systemctl/systemctl shell script. The "real" systemctl binary on the target system works properly.
Comment 1 f.bre 2019-09-17 13:08:50 UTC
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.
Comment 2 Ross Burton 2019-09-17 20:26:57 UTC
If you can replicate the problem easily by breaking your file again can you test that this patch against systemctl fixes it:

-                line = line.rstrip("\n")
+                line = line.strip()
Comment 3 Ross Burton 2019-09-17 20:30:46 UTC
Patch on the list