From 542febbb12c619ee25cbb94b31fff6f916bcff33 Mon Sep 17 00:00:00 2001 From: Michal Nasiadka Date: Sun, 15 Nov 2026 19:05:38 -0600 Subject: base: Install full systemd on Debian and Ubuntu Rocky images already ship full systemd, as lvm2 and iscsi-initiator-utils in base hard-require it. Debian and Ubuntu base install systemd-standalone-sysusers instead, to keep systemd out because the OpenSearch packages call systemctl in their postinst without checking whether systemd is running. grafana, nova-compute and nova-libvirt pull in full systemd as a hard dependency anyway, replacing systemd-standalone-sysusers in those images. Install full systemd in base on Debian and Ubuntu, so that all distributions behave the same, and while installing OpenSearch and OpenSearch Dashboards replace systemctl and systemd-tmpfiles with /bin/true using new disable_systemd_commands and restore_systemd_commands macros. Remove /etc/machine-id in base, as installing systemd creates it and it would otherwise be shared by all containers. Disable the Bifrost OCI artifact registry in bifrost-base, as kolla-ansible already does. It runs podman as a systemd service, which doesn't work inside a container, and installing it pulled podman, buildah and systemd into the image. Related-Bug: #2138705 Change-Id: I2e362eb89501c1dfc1daa42f764ef2b21046749c Signed-off-by: Michal Nasiadka --- kolla/docker/macros.j2 | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'kolla/docker/macros.j2') diff --git a/kolla/docker/macros.j2 b/kolla/docker/macros.j2 index 6d43b4ccf..f44cad572 100644 --- a/kolla/docker/macros.j2 +++ b/kolla/docker/macros.j2 @@ -68,6 +68,24 @@ RUN usermod --append --home {{ homedir }} --groups kolla {{ name }} \ {%- endif %} {%- endmacro %} +{# NOTE(mnasiadka): Some Debian/Ubuntu packages call systemctl or + systemd-tmpfiles from their maintainer scripts without checking that + systemd is running, which fails during an image build. Replace them with + /bin/true while installing such packages, and restore them afterwards. #} +{% macro disable_systemd_commands() -%} +{% for cmd in ['/usr/bin/systemctl', '/usr/bin/systemd-tmpfiles'] -%} + dpkg-divert --local --rename --add {{ cmd }} && ln -s /bin/true {{ cmd }} + {%- if not loop.last %} && {% endif %} +{%- endfor %} +{%- endmacro %} + +{% macro restore_systemd_commands() -%} +{% for cmd in ['/usr/bin/systemctl', '/usr/bin/systemd-tmpfiles'] -%} + rm -f {{ cmd }} && dpkg-divert --local --rename --remove {{ cmd }} + {%- if not loop.last %} && {% endif %} +{%- endfor %} +{%- endmacro %} + {% macro enable_extra_repos(repos) %} {{ handle_repos(repos, 'enable') }} -- cgit v1.2.3