fix(images): let become work on molecule-ubuntu2604 and add gnupg #382

Merged
Defame1297 merged 4 commits from fix/376-2604-become into main 2026-11-25 21:50:15 +00:00
Owner

What and why

Part of #376. #381 closes it once the fixed image is pinned and its 26.04 smoke checks pass.

Please squash-merge. The branch history holds the diagnosis commits; the squash message should be the fix(images) commit's.

Cause. In a booted molecule-ubuntu2604 container, become from root fails:

pam_unix(sudo:account): read unix_chkpwd output error 0: Success
root : account validation failure, is your account locked?
  • Not sudo-rs. The image's sudo is classic sudo 1.9.17p2 (/etc/alternatives/sudo points to sudo.ws).
  • The image's files are fine. They pass when run under chroot. The unix_chkpwd helper that pam_unix's account check runs fails only inside the container (exit 127 when called directly, under Docker's seccomp filter).
  • Why the helper fails is not confirmed. Seccomp is the likely reason. This change works around it rather than fixing it.

Fix (images/molecule-ubuntu2604/Dockerfile):

  • /etc/pam.d/sudo gets account sufficient pam_rootok.so before @include common-account. Root's sudo, which is what Ansible's become runs as in these containers, skips the helper. A non-root caller still goes through pam_unix, as on a real 26.04 host. The build fails if the line does not apply.
  • gnupg is added, as in the 24.04 image: the docker and gitea scenarios need it on the target.
  • The contents label and docs/images/molecule-ubuntu2604.md are updated to match.
  • extensions/molecule/image-smoke (24.04) gets a become check. It passes on the current pin.

Sequence, following the 24.04 gnupg precedent (image first, then pin and tests):

  1. This PR. images/* and docs/* select no Molecule scenario; the 24.04 smoke runs.
  2. On merge, CI builds molecule-ubuntu2604:0.1.7 and Renovate opens the pin PR.
  3. #381 moves to that pin. It adds the 26.04 smoke become and gnupg checks and runs every role on 26.04.

Layer size estimate: gnupg and its dependencies (gpg, gpg-agent, dirmngr, gpgsm, keyboxd) add about 3–5 MB compressed, for a RUN layer of about 35 MB. That is well under the 100 MB limit. The figure is an estimate, not measured.

Verified

  • Run 5650, with the pam_rootok line applied at runtime in the 26.04 smoke container:
    • before the edit, sudo -n -u root true fails with the error above;
    • after it, sudo -H -S -n -u root /bin/sh -c 'echo BECOME-SUCCESS' succeeds and the become check passes;
    • the 24.04 smoke become check passes as well.
  • Run 5647: uid=0, nsswitch uses files, and the root shadow entry is the same as in the image file.
  • Under chroot, the extracted 26.04 rootfs passes sudo -H -S -n -u root, both with full capabilities and with Docker's default set.
  • pre-commit run --all-files and scripts/check_image_versions.py pins pass.

Not verified

  • The image build itself: it runs only on main. The sed line is guarded by grep -qx, so the build fails if it does not apply.
  • The built 0.1.7 image: it is proven by the 26.04 smoke checks in #381 after the pin.
  • The root cause of the unix_chkpwd failure.

  • I confirm third-party material is recorded in NOTICE and REUSE.toml, or there is none.

Assisted-by: Claude Code

## What and why Part of #376. #381 closes it once the fixed image is pinned and its 26.04 smoke checks pass. **Please squash-merge.** The branch history holds the diagnosis commits; the squash message should be the `fix(images)` commit's. **Cause.** In a booted `molecule-ubuntu2604` container, `become` from root fails: ``` pam_unix(sudo:account): read unix_chkpwd output error 0: Success root : account validation failure, is your account locked? ``` - **Not sudo-rs.** The image's `sudo` is classic sudo 1.9.17p2 (`/etc/alternatives/sudo` points to `sudo.ws`). - **The image's files are fine.** They pass when run under `chroot`. The `unix_chkpwd` helper that `pam_unix`'s account check runs fails only inside the container (exit 127 when called directly, under Docker's seccomp filter). - **Why the helper fails is not confirmed.** Seccomp is the likely reason. This change works around it rather than fixing it. **Fix** (`images/molecule-ubuntu2604/Dockerfile`): - `/etc/pam.d/sudo` gets `account sufficient pam_rootok.so` before `@include common-account`. Root's sudo, which is what Ansible's `become` runs as in these containers, skips the helper. A non-root caller still goes through `pam_unix`, as on a real 26.04 host. The build fails if the line does not apply. - `gnupg` is added, as in the 24.04 image: the docker and gitea scenarios need it on the target. - The contents label and `docs/images/molecule-ubuntu2604.md` are updated to match. - `extensions/molecule/image-smoke` (24.04) gets a `become` check. It passes on the current pin. **Sequence**, following the 24.04 `gnupg` precedent (image first, then pin and tests): 1. This PR. `images/*` and `docs/*` select no Molecule scenario; the 24.04 smoke runs. 2. On merge, CI builds `molecule-ubuntu2604:0.1.7` and Renovate opens the pin PR. 3. #381 moves to that pin. It adds the 26.04 smoke `become` and `gnupg` checks and runs every role on 26.04. **Layer size estimate:** `gnupg` and its dependencies (gpg, gpg-agent, dirmngr, gpgsm, keyboxd) add about 3–5 MB compressed, for a RUN layer of about 35 MB. That is well under the 100 MB limit. The figure is an estimate, not measured. ## Verified - Run 5650, with the `pam_rootok` line applied at runtime in the 26.04 smoke container: - before the edit, `sudo -n -u root true` fails with the error above; - after it, `sudo -H -S -n -u root /bin/sh -c 'echo BECOME-SUCCESS'` succeeds and the `become` check passes; - the 24.04 smoke `become` check passes as well. - Run 5647: `uid=0`, `nsswitch` uses `files`, and the root shadow entry is the same as in the image file. - Under `chroot`, the extracted 26.04 rootfs passes `sudo -H -S -n -u root`, both with full capabilities and with Docker's default set. - `pre-commit run --all-files` and `scripts/check_image_versions.py pins` pass. ## Not verified - **The image build itself:** it runs only on `main`. The `sed` line is guarded by `grep -qx`, so the build fails if it does not apply. - **The built `0.1.7` image:** it is proven by the 26.04 smoke checks in #381 after the pin. - **The root cause** of the `unix_chkpwd` failure. --- - [x] I confirm third-party material is recorded in `NOTICE` and `REUSE.toml`, or there is none. Assisted-by: Claude Code
Defame1297 was assigned by Claude 2026-11-25 21:29:42 +00:00
Claude added 1 commit 2026-11-25 21:29:43 +00:00
test(images): check become in the image-smoke scenarios
Build / build (pull_request) Successful in 30s
Molecule / molecule (pull_request) Failing after 1m20s
Lint / lint (pull_request) Failing after 1m50s
62ffae7764
Both smoke scenarios now run a become task, as every role scenario does,
so a molecule image where become fails no longer passes its own pin pull
request. The 26.04 scenario also carries temporary diagnostics for #376.

Assisted-by: Claude Code
Defame1297 added 1 commit 2026-11-25 21:33:35 +00:00
test(images): try pam_rootok for become on 26.04 (temporary diagnostics)
Build / build (pull_request) Successful in 29s
Molecule / molecule (pull_request) Successful in 1m4s
Lint / lint (pull_request) Successful in 1m56s
5364f18728
Assisted-by: Claude Code
Defame1297 added 1 commit 2026-11-25 21:44:07 +00:00
fix(images): let become work on molecule-ubuntu2604 and add gnupg
Build / build (pull_request) Successful in 30s
Molecule / molecule (pull_request) Failing after 1m4s
Lint / lint (pull_request) Successful in 1m56s
efd3a550c5
In the booted 26.04 container, pam_unix's account check for sudo runs
the unix_chkpwd helper, which fails there, so become from root fails
with "account validation failure". /etc/pam.d/sudo now lets root
through with pam_rootok before common-account; a non-root caller still
goes through pam_unix. The build fails if the line does not apply.

gnupg joins the image, as in the 24.04 image: the docker and gitea
scenarios need it on the target. The temporary diagnostics are removed.

Closes #376

Assisted-by: Claude Code
Defame1297 added 1 commit 2026-11-25 21:48:21 +00:00
test(images): check become on 26.04 after the fixed image is pinned
Build / build (pull_request) Successful in 30s
Molecule / molecule (pull_request) Successful in 38s
Lint / lint (pull_request) Successful in 1m40s
87b87dbcef
The 26.04 smoke checks run against the pinned image, which gains the
fix only after this change is built and pinned; they follow with the
pin.

Assisted-by: Claude Code
Claude changed title from WIP: fix(images): make become work on the 26.04 molecule image and add gnupg to fix(images): let become work on molecule-ubuntu2604 and add gnupg 2026-11-25 21:48:37 +00:00
CODEOWNERS rules requested review from Defame1297 2026-11-25 21:48:37 +00:00
Defame1297 approved these changes 2026-11-25 21:50:10 +00:00
Defame1297 merged commit 0d0fc3d1ec into main 2026-11-25 21:50:15 +00:00
Defame1297 deleted branch fix/376-2604-become 2026-11-25 21:50:16 +00:00
Sign in to join this conversation.
No Reviewers
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#382