Skip to content

Boot systemd as PID 1 in the default molecule docker config - #49

Merged
0x46616c6b merged 1 commit into
mainfrom
fix-molecule-systemd-pid1
Jul 29, 2026
Merged

0x46616c6b merged 1 commit into
mainfrom
fix-molecule-systemd-pid1

Conversation

@0x46616c6b

Copy link
Copy Markdown
Member

Summary

  • The default molecule-config never set an explicit command for the docker platform, so molecule's docker driver fell back to its own keep-alive default (a bare bash -c "while true; do sleep 10000; done" loop) as PID 1, instead of the test image's actual CMD (["/lib/systemd/systemd"] for geerlingguy/docker-*-ansible images).
  • Consuming repos relying on systemd/systemctl in their converge or prepare playbooks (e.g. Bump Userli to 6.10.2 ansible-role-userli#136) failed with "Service is in unknown state", since systemd never booted: /run/systemd/system was missing and systemctl is-system-running reported "offline".
  • Set command: "/lib/systemd/systemd" explicitly on the platform so the image boots its real init regardless of the docker driver's default behavior.

Test plan

  • Confirm a consuming repo's Molecule job (e.g. ansible-role-userli#136) passes with this workflow change

The default molecule-config never set an explicit command for the
docker platform, so the docker driver's own keep-alive default
(a bare sleep loop) ran as PID 1 instead of the test image's actual
CMD (["/lib/systemd/systemd"] for geerlingguy/docker-*-ansible
images). Consuming repos relying on systemd/systemctl in their
converge or prepare playbooks (e.g. systemli/ansible-role-userli#136)
failed with "Service is in unknown state" because systemd never
booted: /run/systemd/system was missing and
`systemctl is-system-running` reported "offline".

Set command explicitly to /lib/systemd/systemd so the image boots
its real init regardless of the docker driver's default behavior.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@0x46616c6b
0x46616c6b marked this pull request as ready for review July 29, 2026 14:37
@0x46616c6b
0x46616c6b merged commit 998371a into main Jul 29, 2026
6 checks passed
@0x46616c6b
0x46616c6b deleted the fix-molecule-systemd-pid1 branch July 29, 2026 14:38
0x46616c6b added a commit to systemli/ansible-role-userli that referenced this pull request Jul 29, 2026
v1.6.2 (systemli/github-ansible-workflow#49) bakes the
command: "/lib/systemd/systemd" fix into the default molecule-config,
so the local override duplicating it here is no longer needed.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant