Hello openembedded-core developers,


We are using systemd service files that use instance name to configure their 
WantedBy dependency. The names of the services could be 
abc@multi-user.service<mailto:abc@multi-user.service> or 
abc@basic.service<mailto:abc@basic.service> – the 
abc@.service<mailto:abc@.service> is a template systemd service that reference 
the instance using “%i” in the [Install] section.



[Install]

WantedBy=%i.target



Expected behavior: When enabling abc@multi-user.service, WantedBy=%i.target is 
replaced as WantedBy=multi-user.target because the 
abc@multi-user.service’s<mailto:abc@multi-user.service%E2%80%99s> instance name 
is “multi-user”. And the enable script would then create a symlink from 
/etc/systemd/system/multi-user.target.wants/abc@.service -> 
/usr/lib/systemd/system/abc@.service



Actual behavior: When using openembedded-core’s native systemctl script for 
enabling abc@multi-user.service during a yocto build, the %i is not replaced. 
The symlink created is 
/etc/systemd/system/%i.target.wants/abc@multi-user.service -> 
/usr/lib/systemd/system/abc@.service



Currently, for Yocto’s systemctl script to replace the “%i” with instance, the 
first character after WantedBy= must not be a “%” character. The regex used is 
in 
https://github.com/openembedded/openembedded-core/blob/master/meta/recipes-core/systemd/systemd-systemctl/systemctl#L205
 (pasting the github mirror link because the normal git repo is inaccessible at 
my end currently).


It seems like faulty behavior from my perspective. 
Systemd.unit<https://www.freedesktop.org/software/systemd/man/latest/systemd.unit.html#Specifiers>
 man page does not mention any restriction about having “%i” be the first 
pattern after WantedBy=, and systemd’s systemctl program currently allows 
WantedBy=%i.target.



Thank you,

Eric

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#206035): 
https://lists.openembedded.org/g/openembedded-core/message/206035
Mute This Topic: https://lists.openembedded.org/mt/109075726/21656
Group Owner: openembedded-core+ow...@lists.openembedded.org
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to