Skip to content

OpenRC system_enable_template is applied to systemd units — breaks any image with system_services on a non-OpenRC base #320

Closed

Description

@atrawog

Symptom

charly -C box/cachyos box build githubrunner fails at STEP 69/97:

RUN rc-update add virtqemud.socket default && rc-update add virtnetworkd.socket default
/bin/sh: line 1: rc-update: command not found
Error: building at STEP ... exit status 127

check-githubrunner-pod is therefore red on main today.

Proven pre-existing

Regenerating from a clean origin/main tree (all local work stashed) emits rc-update
twice into box/cachyos/.build/githubrunner/Containerfile. Introduced by ca76c354
("feat(init,vm)!: OpenRC as a first-class init system"), not by any in-flight branch.

Root cause

sdk/deploykit/init.go:122 EmitInitAssembly loops over every entry in activeInits
and renders each one's system_enable_template against the same systemUnits slice,
collected once at :143-152. There is no attribution of a unit to the init that can actually
own it.

So when openrc is among the active inits, charly/charly.yml:1200-1202 (the openrc
system_enable_template) renders rc-update add {{$unit}} default for units that are
systemd units by construction.

candy/virtualization/charly.yml:141-145 declares use_packaged: virtqemud.socket with
distro: [fedora, arch], scope: system. CachyOS's distro chain is [cachyos, arch], so
ServiceEntryAppliesToDistro matches and the unit is collected.

The contradiction is visible in one file: the emitted Containerfile carries
LABEL ai.opencharly.init="supervisord" twenty lines below the failing rc-update RUN.

Blast radius

Any image composing a candy with use_packaged: + scope: system whose composition also
activates openrc. githubrunner confirmed.

Why this issue rather than a patch

The fix is a design choice inside the OpenRC model — either attribute each use_packaged:
unit to its owning init, or restrict system_enable_template rendering to the image's
resolved init. ca76c354 landed 2026-08-18 with work still active in that area, so a blind
patch risks conflicting with the intended design.

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

Activity

  1. atrawog commented on Aug 18, 2026

    @atrawog
    ContributorAuthor

    The root cause you identified is fixed on main — but this stays open until a bed proves it

    Your diagnosis is exactly right and matches #313, which was closed by
    opencharly/sdk#143 at 13:40Z — an hour after you
    filed this. Both issues report the same two units and the same failure:

    RUN rc-update add virtqemud.socket default && rc-update add virtnetworkd.socket default
    /bin/sh: line 1: rc-update: command not found
    

    Verified at the sdk pin main currently carries (f9feb208), not at a branch:

    git ls-tree origin/main sdk                     -> f9feb208
    sdk f9feb208:deploykit/init.go:165              -> if initName == img.InitSystem {
    

    The enable step is now wrapped so it renders for the image's resolved init only, while
    post_assembly_template still runs per active init — which was the trap in fixing it, since a
    continue would have skipped the post-assembly for every non-resolved init. The doc comment now
    states the narrowing explicitly:

    This runs for the image's RESOLVED init system ONLY (img.InitSystem, from
    InitConfig.ResolveInitSystem), never for every ACTIVE init. activeInits is a SET: a candy
    chain routinely contributes fragments for several inits at once, and each one legitimately gets
    its own …

    Your report corrected the record on impact, and that is worth stating. #313 called this
    "latent — charly has never been built into an image." That was wrong. Your
    check-githubrunner-pod evidence shows it red on main, and a re-measurement across every box put
    the real blast radius at 20 of 116 — the original figure had been taken on a single branch whose
    composition happened to avoid the affected path.

    Why this is not being closed now: the code fix is on main and the mechanism is verified, but
    the bed has not been re-run. charly -C box/cachyos box build githubrunner reaching STEP 69/97
    clean is what actually closes this, and a code reading is not that. Whoever next runs
    check-githubrunner-pod should close it with the pasted output — or reopen the investigation if it
    is still red, which would mean a second cause behind the same symptom.

    Filed as a duplicate-with-better-evidence of #313 rather than a separate defect, so nobody spends
    a cutover re-fixing EmitInitAssembly.

  2. atrawog commented on Aug 28, 2026

    @atrawog
    ContributorAuthor

    Validation (2026-08-28) — RESOLVED

    Verified against current sdk main. deploykit/init.go now guards system enablement with if initName == img.InitSystem (line 165), so a use_packaged: unit is enabled by the image RESOLVED init alone, never by every ACTIVE init. A dedicated regression test pins it: deploykit/init_enable_resolved_only_test.go ("TestEmitInitAssemblyEnablesOnlyResolvedInit ... This test FAILS against the unnarrowed generator"). The rc-update: command not found build failure cannot recur.

    Closing as resolved.

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