From 8d9fb2c449290ed50cec122ed08310cff802091a Mon Sep 17 00:00:00 2001 From: Will Szumski Date: Mon, 30 Nov 2026 10:38:51 +0000 Subject: base: Keep an empty /etc/machine-id Removing /etc/machine-id makes systemd treat every container start as first boot, and enable all units according to presets. This starts firewalld in the bifrost container on Rocky Linux, which runs with host networking and blocks DHCP to dnsmasq, so inspection fails. Truncate the file instead. systemd then uses a transient ID, so containers still do not share a machine ID, without first boot semantics. Closes-Bug: #2178419 Generated-By: Claude Code claude-opus-5-5 Change-Id: I1da7fd42f29c8d90c959dd9ed1a6c27621246c18 Signed-off-by: Will Szumski --- kolla/docker/base/Dockerfile.j2 | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'kolla/docker') diff --git a/kolla/docker/base/Dockerfile.j2 b/kolla/docker/base/Dockerfile.j2 index 731aaaf60..660da3bdb 100644 --- a/kolla/docker/base/Dockerfile.j2 +++ b/kolla/docker/base/Dockerfile.j2 @@ -151,9 +151,12 @@ RUN {{ macros.install_packages(base_rocky_yum_repo_packages | customizable("rock # Install base packages {{ macros.enable_extra_repos(['epel']) }} {# NOTE(mnasiadka): systemd (pulled in by lvm2 and iscsi-initiator-utils) creates - /etc/machine-id, which must not be shared by all containers. #} + /etc/machine-id, which must not be shared by all containers. + NOTE(wszumski): Leave an empty file rather than removing it. systemd treats + a missing /etc/machine-id as first boot and enables all units according to + presets, e.g. firewalld in bifrost. An empty file gets a transient ID. #} {{ macros.install_packages(base_rocky_packages | customizable("rocky_packages")) }} \ - && rm -f /etc/machine-id + && truncate -s 0 /etc/machine-id {# endif for base_package_type rpm #} {% elif base_package_type == 'deb' %} @@ -298,8 +301,9 @@ RUN apt-get --error-on=any update \ && 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 \ + shared by all containers. Leave an empty file, as a missing one + triggers first boot presets. #} + && truncate -s 0 /etc/machine-id \ # NOTE: python3-pip installs dependent tzdata package and blocks mount in docker - 2091161 && unlink /etc/localtime -- cgit v1.2.3