aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2026-11-26 15:19:53 +0000
committerGerrit Code Review <review@openstack.org>2026-11-26 15:19:53 +0000
commitac79ac2555406f0be2c9ce2d8fa3cedfadac9244 (patch)
tree40a5273239facca8f18bc9ed80d08c673ccdf8dd
parent9543b297b7dd3425d0050e96e49d16c9e3f664bf (diff)
parent542febbb12c619ee25cbb94b31fff6f916bcff33 (diff)
downloadkolla-ac79ac2555406f0be2c9ce2d8fa3cedfadac9244.tar.gz
kolla-ac79ac2555406f0be2c9ce2d8fa3cedfadac9244.zip
Merge "base: Install full systemd on Debian and Ubuntu"
-rw-r--r--kolla/docker/base/Dockerfile.j210
-rw-r--r--kolla/docker/bifrost/bifrost-base/build_arg.yml3
-rw-r--r--kolla/docker/macros.j218
-rw-r--r--kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j28
-rw-r--r--kolla/docker/opensearch/opensearch/Dockerfile.j28
5 files changed, 45 insertions, 2 deletions
diff --git a/kolla/docker/base/Dockerfile.j2 b/kolla/docker/base/Dockerfile.j2
index c0f52b230..731aaaf60 100644
--- a/kolla/docker/base/Dockerfile.j2
+++ b/kolla/docker/base/Dockerfile.j2
@@ -150,7 +150,10 @@ RUN {{ macros.install_packages(base_rocky_yum_repo_packages | customizable("rock
# Install base packages
{{ macros.enable_extra_repos(['epel']) }}
-{{ macros.install_packages(base_rocky_packages | customizable("rocky_packages")) }}
+{# NOTE(mnasiadka): systemd (pulled in by lvm2 and iscsi-initiator-utils) creates
+ /etc/machine-id, which must not be shared by all containers. #}
+{{ macros.install_packages(base_rocky_packages | customizable("rocky_packages")) }} \
+ && rm -f /etc/machine-id
{# endif for base_package_type rpm #}
{% elif base_package_type == 'deb' %}
@@ -228,7 +231,6 @@ COPY apt_preferences /etc/apt/preferences.d/kolla-custom
{% set base_apt_packages = [
'apt-utils',
'dumb-init',
- 'systemd-standalone-sysusers',
'gawk',
'iproute2',
'kmod',
@@ -248,6 +250,7 @@ COPY apt_preferences /etc/apt/preferences.d/kolla-custom
'python3-yaml',
'socat',
'sudo',
+ 'systemd',
'tgt',
'uuid-runtime',
'patch'
@@ -294,6 +297,9 @@ RUN apt-get --error-on=any update \
&& apt-get -y upgrade \
&& apt-get -y dist-upgrade \
&& {{ macros.install_packages(base_apt_packages | customizable('apt_packages'), True) }} \
+ {#- NOTE(mnasiadka): systemd creates /etc/machine-id, which must not be
+ shared by all containers. #}
+ && rm -f /etc/machine-id \
# NOTE: python3-pip installs dependent tzdata package and blocks mount in docker - 2091161
&& unlink /etc/localtime
diff --git a/kolla/docker/bifrost/bifrost-base/build_arg.yml b/kolla/docker/bifrost/bifrost-base/build_arg.yml
index 8c810f133..02c3359fd 100644
--- a/kolla/docker/bifrost/bifrost-base/build_arg.yml
+++ b/kolla/docker/bifrost/bifrost-base/build_arg.yml
@@ -5,3 +5,6 @@ install_dib: true
create_image_via_dib: false
ansible_python_interpreter: /var/lib/kolla/venv/bin/python
internal_ip: "127.0.0.1"
+# Bifrost's OCI artifact registry runs podman as a systemd service, which
+# doesn't work inside a container; kolla-ansible disables it too.
+enable_registry: false
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') }}
diff --git a/kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2 b/kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2
index f6bd31587..3d145930a 100644
--- a/kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2
+++ b/kolla/docker/opensearch/opensearch-dashboards/Dockerfile.j2
@@ -14,7 +14,15 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}"
{% set opensearch_dashboards_packages = ['opensearch-dashboards'] %}
+{% if base_package_type == 'deb' %}
+{# NOTE(mnasiadka): The opensearch-dashboards postinst runs systemctl and
+ systemd-tmpfiles without checking whether systemd is running. #}
+RUN {{ macros.disable_systemd_commands() }} \
+ && {{ macros.install_packages(opensearch_dashboards_packages | customizable("packages"), chain=True) }} \
+ && {{ macros.restore_systemd_commands() }} \
+{% else %}
{{ macros.install_packages(opensearch_dashboards_packages | customizable("packages")) }} \
+{% endif %}
&& chown -R opensearch-dashboards:opensearch-dashboards /usr/share/opensearch-dashboards
COPY extend_start.sh /usr/local/bin/kolla_extend_start
diff --git a/kolla/docker/opensearch/opensearch/Dockerfile.j2 b/kolla/docker/opensearch/opensearch/Dockerfile.j2
index 2765d9985..fca2efff5 100644
--- a/kolla/docker/opensearch/opensearch/Dockerfile.j2
+++ b/kolla/docker/opensearch/opensearch/Dockerfile.j2
@@ -18,7 +18,15 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}"
ENV OPENSEARCH_INITIAL_ADMIN_PASSWORD="Kolla24OpenSearch"
+{% if base_package_type == 'deb' %}
+{# NOTE(mnasiadka): The opensearch postinst runs systemctl and
+ systemd-tmpfiles without checking whether systemd is running. #}
+RUN {{ macros.disable_systemd_commands() }} \
+ && {{ macros.install_packages(opensearch_packages | customizable("packages"), chain=True) }} \
+ && {{ macros.restore_systemd_commands() }} \
+{% else %}
{{ macros.install_packages(opensearch_packages | customizable("packages")) }} \
+{% endif %}
&& chown -R opensearch:opensearch /usr/share/opensearch \
&& rm -f /etc/opensearch/*.pem \
&& rm -f /etc/opensearch/securityadmin_demo.sh