Openembedded Core Discussions
 help / color / mirror / Atom feed
From: "Martin Siegumfeldt" <mns@gomspace.com>
To: openembedded-core@lists.openembedded.org
Subject: Issues enabling systemd template service using WantedBy construct (Styhead -> Walnascar)
Date: Mon, 12 May 2025 05:12:27 -0700	[thread overview]
Message-ID: <Z2ch.1747051947055246176.oktf@lists.openembedded.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 6570 bytes --]

Hi all,

We have encountered what appears to be a regression when moving from styhead to walnascar baseline, regarding a systemd service that is no longer enabled. It is a templated service that relates to another through the "WantedBy" relation - sample layer/recipes/service is available here: https://github.com/mnsgs/meta-systemd-test.

Recipe:

DESCRIPTION = "Wanted-by service"
LICENSE = "CLOSED"

inherit systemd

SRC_URI = "file://${BPN}@.service"

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

do_install:append() {
install -d ${D}${systemd_system_unitdir}
install -m 0644 ${UNPACKDIR}/${BPN}@.service ${D}${systemd_system_unitdir}
}

FILES:${PN} += "${systemd_system_unitdir}"

Systemd service file:

[Unit]
Description="Test WantedBy service %i"

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/echo "Hello from WantedBy service (instance %i)"
ExecStop=/bin/echo "Hello from Wantedby service (instance %i)"

[Install]
WantedBy=svc-wants@%i.service

On styhead baseline, this yields the  following behavior:

root@qemux86-64:~# cat /etc/buildinfo
-----------------------
Build Configuration:  |
-----------------------
DISTRO = poky
DISTRO_VERSION = 5.1.4
-----------------------
Layer Revisions:      |
-----------------------
meta              = styhead:70dc28ac287bf35541270cae1d99130a0f6b7b5f
meta-poky         = styhead:70dc28ac287bf35541270cae1d99130a0f6b7b5f
meta-yocto-bsp    = styhead:70dc28ac287bf35541270cae1d99130a0f6b7b5f
meta-systemd-test = main:b0b53555ffb7f43a7e9651bde2e9b710e5ded25f -- modified
root@qemux86-64:~#
root@qemux86-64:~# systemctl is-enabled svc-wanted-by@
indirect
root@qemux86-64:~#
root@qemux86-64:~# systemctl is-enabled svc-wanted-by@a
enabled
root@qemux86-64:~#
root@qemux86-64:~# journalctl -f&
root@qemux86-64:~# May 12 11:40:14 qemux86-64 systemd-timesyncd[200]: Network configuration changed, trying to establish connection.
May 12 11:40:14 qemux86-64 systemd-timesyncd[200]: Network configuration changed, trying to establish connection.
May 12 11:40:14 qemux86-64 systemd-logind[217]: New seat seat0.
May 12 11:40:14 qemux86-64 systemd-logind[217]: Watching system buttons on /dev/input/event0 (Power Button)
May 12 11:40:14 qemux86-64 systemd-logind[217]: Watching system buttons on /dev/input/event2 (QEMU QEMU USB Keyboard)
May 12 11:40:14 qemux86-64 systemd[1]: Started User Login Management.
May 12 11:40:14 qemux86-64 systemd[1]: Reached target Multi-User System.
May 12 11:40:14 qemux86-64 systemd[1]: Finished Virtual Console Setup.
May 12 11:40:14 qemux86-64 systemd[1]: Startup finished in 1.488s (kernel) + 3.613s (userspace) = 5.102s.
May 12 11:40:16 qemux86-64 systemd-timesyncd[200]: Network configuration changed, trying to establish connection.
May 12 11:40:46 qemux86-64 systemd-resolved[196]: Clock change detected. Flushing caches.
May 12 11:40:46 qemux86-64 systemd-journald[130]: Forwarding to syslog missed 126 messages.
May 12 11:40:46 qemux86-64 systemd-timesyncd[200]: Contacted time server 216.239.35.8:123 (time3.google.com).
May 12 11:40:46 qemux86-64 systemd-timesyncd[200]: Initial clock synchronization to Mon 2025-05-12 11:40:46.809039 UTC.
root@qemux86-64:~#
root@qemux86-64:~# systemctl start svc-wants@a
root@qemux86-64:~# May 12 11:40:54 qemux86-64 systemd[1]: Created slice Slice /system/svc-wanted-by.
May 12 11:40:54 qemux86-64 systemd[1]: Created slice Slice /system/svc-wants.
May 12 11:40:54 qemux86-64 systemd[1]: Starting "Test WantedBy service a"...
May 12 11:40:54 qemux86-64 systemd[1]: Starting "Test Wants service a"...
May 12 11:40:54 qemux86-64 echo[240]: Hello from WantedBy service (instance a)
May 12 11:40:54 qemux86-64 echo[241]: Hello from Wants service (instance a)
May 12 11:40:54 qemux86-64 systemd[1]: Finished "Test WantedBy service a".
May 12 11:40:55 qemux86-64 systemd[1]: Finished "Test Wants service a".

As expected, the "WantedBy" service is started along.

The equivalent on walnascar:

root@qemux86-64:~# cat /etc/buildinfo
-----------------------
Build Configuration:  |
-----------------------
DISTRO = poky
DISTRO_VERSION = 5.2
-----------------------
Layer Revisions:      |
-----------------------
meta              = walnascar:9b96fdbb0cab02f4a6180e812b02bc9d4c41b1a5
meta-poky         = walnascar:9b96fdbb0cab02f4a6180e812b02bc9d4c41b1a5
meta-yocto-bsp    = walnascar:9b96fdbb0cab02f4a6180e812b02bc9d4c41b1a5
meta-systemd-test = main:b0b53555ffb7f43a7e9651bde2e9b710e5ded25f -- modified
root@qemux86-64:~#
root@qemux86-64:~# systemctl is-enabled svc-wanted-by@
disabled
root@qemux86-64:~#
root@qemux86-64:~# systemctl is-enabled svc-wanted-by@a
disabled
root@qemux86-64:~#
root@qemux86-64:~# journalctl -f&
root@qemux86-64:~# May 12 11:42:14 qemux86-64 kernel[210]: [    3.173784] systemd-journald[133]: Received client request to flush runtime journal.
May 12 11:42:14 qemux86-64 systemd-logind[216]: New seat seat0.
May 12 11:42:14 qemux86-64 systemd[1]: Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
May 12 11:42:14 qemux86-64 systemd-logind[216]: Watching system buttons on /dev/input/event0 (Power Button)
May 12 11:42:14 qemux86-64 systemd-logind[216]: Watching system buttons on /dev/input/event2 (QEMU QEMU USB Keyboard)
May 12 11:42:14 qemux86-64 systemd[1]: Started User Login Management.
May 12 11:42:14 qemux86-64 systemd[1]: Reached target Multi-User System.
May 12 11:42:14 qemux86-64 systemd[1]: Starting Virtual Console Setup...
May 12 11:42:14 qemux86-64 systemd[1]: Finished Virtual Console Setup.
May 12 11:42:14 qemux86-64 systemd[1]: Startup finished in 1.495s (kernel) + 3.622s (userspace) = 5.118s.
root@qemux86-64:~#
root@qemux86-64:~# systemctl start svc-wants@a
root@qemux86-64:~# May 12 11:42:51 qemux86-64 systemd[1]: Created slice Slice /system/svc-wants.
May 12 11:42:51 qemux86-64 systemd-journald[133]: Forwarding to syslog missed 120 messages.
May 12 11:42:51 qemux86-64 systemd[1]: Starting "Test Wants service a"...
May 12 11:42:51 qemux86-64 echo[250]: Hello from Wants service (instance a)
May 12 11:42:51 qemux86-64 systemd[1]: Finished "Test Wants service a".

where the "WantedBy" service is not started (as it is not enabled)

As mentioned, it appears to be a regression during the styhead -> walnascar development. I notice that the systemctl-native is now built from the systemd sources - is this correct? Should I consequently report this through systemd?

Thanks,
Martin

[-- Attachment #2: Type: text/html, Size: 7995 bytes --]

             reply	other threads:[~2025-05-12 12:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-12 12:12 Martin Siegumfeldt [this message]
2025-05-12 12:19 ` [OE-core] Issues enabling systemd template service using WantedBy construct (Styhead -> Walnascar) Alexander Kanavin
2025-05-28  3:38   ` Patrick Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z2ch.1747051947055246176.oktf@lists.openembedded.org \
    --to=mns@gomspace.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox