Skip to content

Containerfile emits BOTH init systems' enable templates: rc-update on a supervisord/Arch container fails the build (latent — charly has never been built into an image) #313

Closed
opencharly/sdk
#143

Description

@atrawog

What breaks

charly box build emits both init systems' enable templates into one Containerfile, and the build dies on whichever the image does not have.

STEP 24/47: RUN rc-update add virtqemud.socket default && \
            rc-update add virtnetworkd.socket default
/bin/sh: line 1: rc-update: command not found        exit status 127
charly: error: command "build": building agentteams-worker: podman build failed: exit status 127

rc-update is OpenRC. The base is Arch (systemd), the container runs supervisord, and it has neither OpenRC nor systemd.

Verified against the emitted artifact, not the failure message

.build/agentteams-worker/Containerfile
  rc-update lines:  2      (lines 181-182)
  systemctl lines:  1

Both init forms are emitted into a single Containerfile. The service being enabled is declared in candy/virtualization/charly.yml:141 as:

- name: virtqemud
  use_packaged: virtqemud.socket     # a SYSTEMD unit
  distro: [fedora, arch]
  enable: true
  scope: system

virtualization deliberately carries mixed service: entries — a use_packaged: form and a sibling exec: form, both scoped distro: [fedora, arch] — which is the init-polymorphism pattern the rulebook mandates ("Init-system polymorphism via mixed service: entries — never <name>-host/<name>-pod sibling candies"). For a supervisord container target the correct arm is the exec: entry. The generator is instead rendering the packaged-unit arm through OpenRC's system_enable_template (charly/charly.yml:1132).

Why nobody has hit this: it is LATENT, not a regression

Measured, not assumed:

files composing "- charly" in the superproject:   15
of those that are DEPLOYABLE boxes (have base:):   0
composing it in any box/<distro> submodule:        0

virtualization reaches an image only through the charly candy, and charly has never been composed into a built container image. Nothing on main builds it, so nothing on main exercises this path.

It surfaced because candy/agentteams-snapshot (new, unlanded — Factory Unit 6) is the first thing to compose charly into a real image build.

Consequence worth stating plainly: agentteams-snapshot's own premise — "the charly toolchain carried into a deployment" — has never been built by anyone, and cannot be until this is fixed.

Blast radius

Any box that composes charly (and therefore virtualization) into a container that is not systemd-init. That is currently zero boxes on main, and every box that would want the toolchain in-venue.

Where the fix lives

Init assembly is driven by the embedded init: vocabulary (charly/charly.yml, three entries: supervisord-conf at ~997, openrc-services at ~1098, systemd-services at ~1191) and rendered through sdk/deploykit (WriteCandySteps / compile_service_steps.go), with candy/plugin-init/resolve.go projecting the chosen init. The selection of which init's enable template applies to a given target is the thing that is wrong — it should resolve to one arm per target, and for a supervisord container that is the exec: entry.

This spans sdk and charly, so it is its own cutover with its own R10, not a fix to bolt onto the Unit 6 branch.

Reproduction

# on a branch where agentteams-worker composes agentteams-snapshot
charly box generate agentteams-worker
grep -c rc-update .build/agentteams-worker/Containerfile   # -> 2
grep -c systemctl .build/agentteams-worker/Containerfile   # -> 1
charly box build agentteams-worker                          # -> exit 1 at STEP 24/47

Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)

Activity

  1. atrawog commented on Aug 18, 2026

    @atrawog
    ContributorAuthor

    Correcting two claims in the issue body above, before the fix lands.

    The defect is real and the root cause holds, but I overstated the evidence. Tracing the emitter and then generating every box twice from one tree (guard neutralized, then in place) contradicts two things I wrote:

    Claim in the body What the measurement shows
    "emits both init systems' enable templates" / "Both init forms are emitted into a single Containerfile" Only one foreign init emitted. systemd was never in this box's active set.
    the table rc-update: 2 / systemctl: 1 offered as evidence of both arms The single systemctl hit is prose inside a LABEL (a skill description:), not an emitted command. It is still there after the fix.

    I read a grep count as a command count without opening the line. The rc-update figure was right; the systemctl figure never measured what I said it did.

    What is actually true. EmitInitAssembly rendered the shared use_packaged: unit list through every active init, and activeInits is a set. For agentteams-worker that set is {supervisord, openrc}: virtualization's use_packaged: entries pull in openrc, while the box resolves to supervisord, which declares no system_enable_template at all. So the box's own init correctly emitted nothing and openrc's template emitted rc-update add — one wrong arm, not two.

    That also corrects the body's closing suggestion. I wrote that the right emission was virtualization's sibling exec: entry; for this code path the right emission is nothing — supervisord consumes no distro units, and the exec: sibling is already handled by the fragment/service path, which was never broken.

    Blast radius, now measured instead of argued — 1 of 15 generated boxes before, 0 after. The complete diff -r of the two generated trees carries exactly one semantic change (the four-line rc-update block leaving agentteams-worker); every other differing line is ARG BASE_IMAGE's CalVer tag moving …1130→…1131 because the runs were a minute apart. Nothing was silently dropped.

    Fix + discriminating test: opencharly/sdk#143.

    Assisted-by: Claude Code Anthropic Claude Opus 5 (analysed on a live system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions