summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorArtur Kowalski <arturkow2000@gmail.com>2025-01-31 21:15:59 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2025-02-05 12:49:55 +0000
commitaab0fdf3b74ff8ebeca5cf08913b1b0eca1a1e2c (patch)
treefa5ab77c99952628221a0294c84c01a2fcc83149 /meta
parent1f96cd3d17640f97f52d269838b40bdf5d71161c (diff)
downloadpoky-aab0fdf3b74ff8ebeca5cf08913b1b0eca1a1e2c.tar.gz
systemd-systemctl: fix handling of instance unit files
This fixes handling of units with instance name in theirs filenames such as `gnome-shell@wayland.service` or `gnome-shell@x11.service`. Such files cause template file to be ignored (for the specific instance). Thanks to Markus Volk <f_l_k@t-online.de> for noticing the breakage when building images with gnome-shell: | Error: Systemctl preset_all issue in org.gnome.Shell@wayland.service | WARNING: /home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/temp/run.systemd_preset_all.2011511:158 exit 1 from 'systemctl --root="/home/flk/poky/build/tmp/work/intel_corei7_64-poky-linux/gnome-image/1.0/rootfs" --global --preset-mode=enable-only preset-all' The problem manifested after cdc3b3028f6d71788b5fdd99436f69fbf18f613e because we enabled preset-all for user units - org.gnome.Shell@wayland.service is a user service, so prior to that change the file wasn't processed at all. The error was triggered because there is no org.gnome.Shell@.service file. With this patch applied systemctl script looks for instance unit file and falls back to template unit in case of lack thereof, keeping the same behavior upstream systemctl does. (From OE-Core rev: 7eaad7c2a118b3d9db8b694730535afcd3ca985e) Signed-off-by: Artur Kowalski <arturkow2000@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rwxr-xr-xmeta/recipes-core/systemd/systemd-systemctl/systemctl12
1 files changed, 11 insertions, 1 deletions
diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl
index 81c246a5b2..65e3157859 100755
--- a/meta/recipes-core/systemd/systemd-systemctl/systemctl
+++ b/meta/recipes-core/systemd/systemd-systemctl/systemctl
@@ -224,7 +224,17 @@ class SystemdUnit():
224 instance = None 224 instance = None
225 unit = self.unit 225 unit = self.unit
226 226
227 path = self._path_for_unit(unit) 227 if instance_unit_name is not None:
228 try:
229 # Try first with instance unit name. Systemd allows to create instance unit files
230 # e.g. `gnome-shell@wayland.service` which cause template unit file to be ignored
231 # for the instance for which instance unit file is present. In that case, there may
232 # not be any template file at all.
233 path = self._path_for_unit(instance_unit_name)
234 except SystemdUnitNotFoundError:
235 path = self._path_for_unit(unit)
236 else:
237 path = self._path_for_unit(unit)
228 238
229 if path.is_symlink(): 239 if path.is_symlink():
230 # ignore aliases 240 # ignore aliases