← Back to issue list

Leftover files affecting consecutive runs of "rockcraft pack"

View original Github issue

Metadata

Project
rockcraft
Number
#57
Type
issue
State
open
Author
tigarmo
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action: keep open

Reason: Maintainer @gcomneno triaged this on 2026-02-26 (186 days ago) and asked the reporter to re-test with `rockcraft clean` between runs, so the issue is acknowledged and awaiting a response from the original author. The underlying behavior (install dir not cleaned between runs, causing cp --link to fail on existing files) is a real craft_parts lifecycle concern, not just a usage question, and no fix commit or PR addressing it was found in rockcraft or craft-parts history.

Impact: 50 Quick Win: 17.5 Staleness: 40 Complexity: 65 Confidence: 65 Support Request: 30

Issue body

I have the following directory structure: ``` $ tree . . ├── files │   ├── a.txt │   └── b.txt └── rockcraft.yaml ``` And in `rockcraft.yaml` I want to organize those two text files, but I make a typo and point both to `etc/newfiles/a.txt`: ``` name: leftover summary: Permissions description: Permissions license: Apache-2.0 version: "0.0.1" base: ubuntu:22.04 parts: default-config: plugin: dump source: files organize: a.txt: etc/newfiles/a.txt b.txt: etc/newfiles/a.txt stage: - etc/newfiles/a.txt - etc/newfiles/b.txt ``` `rockcraft pack` then expectedly fails: ``` $ rockcraft -v pack (...) :: + cp --archive --link --no-dereference . /root/parts/default-config/install Failed to organize part 'default-config': trying to organize file 'b.txt' to 'etc/newfiles/a.txt', but 'etc/newfiles/a.txt' already exists. Traceback (most recent call last): File "/snap/rockcraft/x1/lib/python3.8/site-packages/rockcraft/parts.py", line 92, in run aex.execute(action, stdout=stream, stderr=stream) File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 301, in execute self._executor.execute(actions, stdout=stdout, stderr=stderr) File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 126, in execute self._run_action(act, stdout=stdout, stderr=stderr) File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/executor.py", line 189, in _run_action handler.run_action(action, stdout=stdout, stderr=stderr) File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 160, in run_action state = handler(step_info, stdout=stdout, stderr=stderr) File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 320, in _run_build self._organize(overwrite=update) File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/part_handler.py", line 833, in _organize organize_files( File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/organize.py", line 82, in organize_files raise errors.FileOrganizeError( craft_parts.errors.FileOrganizeError: Failed to organize part 'default-config': trying to organize file 'b.txt' to 'etc/newfiles/a.txt', but 'etc/newfiles/a.txt' already exists. ``` However, if I fix the `organize` section and re-run `rockcraft -v pack`, I get another error: ``` :: + cp --archive --link --no-dereference . /root/parts/default-config/install :: cp: cannot create hard link '/root/parts/default-config/install/./b.txt' to './b.txt': File exists Failed to run the build script for part 'default-config'. Traceback (most recent call last): File "/snap/rockcraft/x1/lib/python3.8/site-packages/craft_parts/executor/step_handler.py", line 134, in _builtin_build subprocess.run( File "/snap/rockcraft/x1/usr/lib/python3.8/subprocess.py", line 516, in run raise CalledProcessError(retcode, process.args, subprocess.CalledProcessError: Command '['/root/parts/default-config/run/build.sh']' returned non-zero exit status 1. ``` If I make a "big" change like renaming the rock from `leftover` to `leftover2`, the packing finishes successfully. Thanks! (cc @cmatsuoka)

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 50
Quick Win: 17.5
Staleness: 40
Complexity: 65
Confidence: 65
Support Request: 30
keep 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.
qwen/qwen3.6-35b-a3b
Staleness: 70
Complexity: 40
Confidence: 80
Support Request: 85
close not a bug Reporter encountered build failures from leftover files after fixing a typo in rockcraft.yaml. Maintainer triaged, identified as expected behavior, and directed user to run rockcraft clean between runs. Awaiting re-test.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 15
Confidence: 85
Support Request: 90
close not a bug Leftover build artifacts from a failed run cause consecutive rockcraft pack failures. Maintainer clarifies this is expected behavior and points to rockcraft clean as the documented workflow to reset state.
qwen3.6-35b-a3b-mtp-q6
Staleness: 70
Complexity: 30
Confidence: 90
Support Request: 90
close not a bug Leftover files from failed rockcraft pack runs cause organize conflicts on subsequent builds. A maintainer requested re-testing with rockcraft clean between runs to verify expected behavior. Waiting for author response.

Update history

No update history recorded yet.

Related work

  • Related To: rockcraft#188 (confidence 70%)

    Same class of problem: consecutive rockcraft pack runs fail due to cached/leftover state, with rockcraft clean as the documented workaround.

Related issues

Issue Project State Summary Similarity
#188 Consecutive runs of rockcraft pack fail rockcraft open 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.
76%
#39 Clean slate between rebuilds rockcraft open rockcraft pack fails with 'path already exists' for /root/images/bare on rebuilds. The specific umoci init bug was fixed (commit d1a5f04); the broader clean-slate-between-rebuilds concern was identified as a craft-providers/craft-application layer issue. A 2026 triage comment asks whether a tracking issue exists upstream before closing as moved.
70%