← Back to issue list

Consecutive runs of rockcraft pack fail

View original Github issue

Metadata

Project
rockcraft
Number
#188
Type
issue
State
open
Author
arturo-seijas
Labels
Created
Updated
Closed

Current evaluation

Second 'rockcraft pack' run fails when overlay-script creates a group/user because the cached overlay already has them. Workaround is 'rockcraft clean'. 1300 days old, no maintainer response, no labels. Docs now recommend override-build with useradd/groupadd --root instead.

Suggested action: close not a bug

Reason: The overlay filesystem is intentionally cached between runs, so a non-idempotent overlay-script (bare 'addgroup' with no existence check) failing on the second run is expected behavior — the same conclusion reached in the related issue #57, where a maintainer identified leftover-state failures as expected and directed the user to 'rockcraft clean'. The project now documents the recommended pattern in docs/how-to/crafting/add-internal-user-to-a-rock.rst (added in #653): use override-build with 'useradd --root ${CRAFT_PART_INSTALL}' / 'groupadd --root ${CRAFT_PART_INSTALL}', which is inherently idempotent per-build and avoids the cached-overlay problem entirely.

Impact: 15 Quick Win: 12.75 Staleness: 90 Complexity: 15 Confidence: 75 Support Request: 75

Issue body

Hi! I've came across an error when trying to pack for second time an image containing a part that creates a group and a user. The first run is successful but the second one throws an error stating that the group already exists. When running `rockcraft clean` the `pack` succeeds again ``` Executing action :: + addgroup --gid 2000 indico :: addgroup: The group `indico' already exists. 'overlay-script' in part 'add-user' failed with code 1. ``` The rockcraft.yaml is as follows: ``` name: indico summary: Indico rock description: Indico OCI image for the Indico charm version: "1.0" base: bare build-base: ubuntu:22.04 license: Apache-2.0 platforms: amd64: parts: add-user: plugin: nil overlay-script: | addgroup --gid 2000 indico adduser --system --gid 2000 --uid 2000 --home /srv/indico indico ``` Thank you

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 15
Quick Win: 12.75
Staleness: 90
Complexity: 15
Confidence: 75
Support Request: 75
close not a bug Second 'rockcraft pack' run fails when overlay-script creates a group/user because the cached overlay already has them. Workaround is 'rockcraft clean'. 1300 days old, no maintainer response, no labels. Docs now recommend override-build with useradd/groupadd --root instead.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 20
Confidence: 70
Support Request: 5
close stale Unlabelled bug report from 3.5 years ago describing a failure when running rockcraft pack twice due to addgroup complaining about an existing group. No maintainer response or updates.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 35
Confidence: 80
Support Request: 10
needs triage Unlabelled report of `rockcraft pack` failing on consecutive runs due to non-idempotent overlay scripts. No maintainer response in over 3 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 95
Complexity: 15
Confidence: 85
Support Request: 10
close stale Consecutive rockcraft pack runs fail when creating groups or users, throwing a group already exists error. Requires rockcraft clean to succeed. Issue remains unresolved and needs triage.

Update history

No update history recorded yet.

Related work

  • Duplicate Of: canonical/rockcraft#57 (confidence 80%)

    Same root cause: cached build state (overlay/files) from a prior 'rockcraft pack' run causes the second run to fail. #57 was triaged by a maintainer as expected behavior with 'rockcraft clean' as the remedy; the author of this issue also cross-referenced it.

  • Related To: canonical/rockcraft#653 (confidence 70%)

    Docs PR adding the 'Add an internal user' how-to, which recommends override-build with useradd/groupadd --root ${CRAFT_PART_INSTALL} — the supported alternative to the overlay-script approach used in this issue.

Related issues

Issue Project State Summary Similarity
#57 Leftover files affecting consecutive runs of "rockcraft pack" rockcraft open Rockcraft pack fails on second run after fixing an organize typo: leftover install-dir files cause a cp hard-link 'File exists' error. Maintainer asked reporter to re-test with rockcraft clean between runs; awaiting response.
76%