Skip to contentSkip to conversation

Issues enabling systemd template service using WantedBy construct

langdale Martin Siegumfeldt 1 participant 1 message Mar 13, 2023

lore
Share & tools
lore
#0 lore raw

Hi all,

We are seeing some systemd service issues during the process of bumping Yocto baseline from thud to langdale. The following service:

Unit]
Description="Nanocom TR600 Monitor Application slot %i" RequiresMountsFor=/data
Wants=redis.service
After=redis.service
PartOf=tr600@%i.service tr600-dma@%i.service After=tr600@%i.service tr600-dma@%i.service Requires=gs-dtoverlay.service After=gs-dtoverlay.service

[Service]
ExecStart=/usr/bin/nanocom-tr600-monitor --service-instance-name=%i WorkingDirectory=/data
Restart=always
RestartSec=5

[Install]
WantedBy=tr600@%i.service tr600-dma@%i.service

is intended started whenever any of the tr600/tr600-dma template services are started. The following tr600 services are defined within the recipe:

SYSTEMD_SERVICE:${BPN} = "\
${BPN}@a.service \
${BPN}@b.service \
${BPN}@c.service \
${BPN}[email protected] \
${BPN}[email protected] \
${BPN}[email protected] \
"

and equivalently the nanocom-tr600-monitor services from it's recipe:

SYSTEMD_SERVICE:${BPN} = "\
${BPN}@a.service \
${BPN}@b.service \
${BPN}@c.service \
"

in the thud baseline we observe the following lines from the log.do_rootfs file:

Started /mnt/build/tmp/work/nanomind_z7045_nv3-gomspace-linux-gnueabi/nanocom-sdr-image/1.0-r0/recipe-sysroot-native/usr/bin/systemctl --root=/mnt/build/tmp/work/nanomind_z7045_nv3-gomspace-linux-gnueabi/nanocom-sdr-image/1.0-r0/rootfs enable [email protected] [email protected] [email protected] Try to find location of template [email protected] of instance [email protected]...
Found [email protected] in /lib/systemd/system/[email protected]
WantedBy=tr600@%i.service found in [email protected]
Enabled [email protected] for [email protected].
WantedBy=tr600-dma@%i.service found in [email protected]
Enabled [email protected] for [email protected].

and the rootfs content:

ll rootfs/etc/systemd/system | grep tr600
drwxr-xr-x  2 martin martin 4096 Mar  9 21:40 [email protected]/ drwxr-xr-x  2 martin martin 4096 Mar  9 21:40 [email protected]/ drwxr-xr-x  2 martin martin 4096 Mar  9 21:40 [email protected]/ drwxr-xr-x  2 martin martin 4096 Mar  9 21:40 [email protected]/ drwxr-xr-x  2 martin martin 4096 Mar  9 21:40 [email protected]/ drwxr-xr-x  2 martin martin 4096 Mar  9 21:40 [email protected]/

which works as expected when flashed.

On the langdale baseline, the created 'wants' links appear to be missing the template expansion:

ll rootfs/etc/systemd/system | grep tr600
drwxr-xr-x  2 martin martin 4096 Mar  9  2018 tr600-dma@%i.service.wants/ drwxr-xr-x  2 martin martin 4096 Mar  9  2018 tr600@%i.service.wants/

and the dependency does not work when flashed.

I have looked into the systemctl script (that has been refactored and ported from shell to python in between the baselines) but did not manage to locate the root cause. IMHO, it looks to be a regression but I have not managed to find the smoking gun.

Does anyone have a clue on this?

Thanks,
Martin