Failing to prime content with overlay and partitions
Metadata
Current evaluation
Closed and deferred to internal tracking ticket CRAFT-4600. No public fix or merge was provided. The bug involves incorrect overlay file visibility checks during partition priming causing stage migration failures.
Suggested action: —
No scores available.
Issue body
### Bug Description
Following https://github.com/canonical/craft-parts/pull/1109, a `FilesystemMounts` object can be declared to distribute content from the overlay to the partitions.
For example with:
```
filesystems:
default:
- mount: /
device: default
- mount: /foo
device: bar
```
Content from the `/foo` directory of the overlay will be staged to the stage directory of the `bar` partition. After the STAGE step the content will be:
```
parts/
part1/
layer/
baz/
a
foo/
qux
partitions/
bar/
stage/
qux
stage/
baz/
a
foo/
```
However, the current implementation of `_migrate_overlay_files_to_prime`, called by `_run_prime` will determine that the `foo` directory is visible when migrating content for the `bar` partition and will thus fail because this directory was *not* staged in this partition. This is due to the fact that the part layer directory is used as a `lowerdir` and the **partition's stage** directory as a `upperdir` to determine file visible in the layer.
### To Reproduce
With `filesystems.yaml`:
```
filesystems:
default:
- mount: "/"
device: "default"
- mount: "/boot/efi"
device: "(volume/pc/efi)"
```
Run:
```
mkdir /tmp/overlay
python3 -mcraft_parts --filesystem-mounts filesystems.yaml --partitions default,volume/pc/efi,volume/pc/rootfs --overlay-base /tmp/overlay --trace -v prime
```
### part yaml
```shell
parts:
part1:
plugin: nil
override-build: |
echo "test-part1" > $CRAFT_PART_INSTALL/build-a
overlay-script: |
mkdir -p $CRAFT_OVERLAY/boot/efi/foo
part2:
after: [part1]
plugin: nil
overlay-script: |
echo "a2" > $CRAFT_OVERLAY/a
```
### Relevant log output
```shell
[...]
Execute: Prime part1
DEBUG:craft_parts.executor.executor:execute action part1:Action(part_name='part1', step=Step.PRIME, action_type=ActionType.RUN, reason=None, project_vars=None, properties=ActionProperties(changed_files=None, changed_dirs=None))
DEBUG:craft_parts.executor.part_handler:priming overlay files
DEBUG:craft_parts.executor.part_handler:migrate default partition part 'part2' layer to prime
DEBUG:craft_parts.overlays.overlays:check layer visibility in /workdir/parts/part2/layer/boot/efi
DEBUG:craft_parts.overlays.overlays:layer visibility files=set(), dirs=set()
DEBUG:craft_parts.executor.part_handler:excluding already migrated files: set()
DEBUG:craft_parts.executor.part_handler:excluding already migrated dirs: set()
DEBUG:craft_parts.overlays.overlays:check layer visibility in /workdir/parts/part2/layer
DEBUG:craft_parts.overlays.overlays:check if path is visible: root=/workdir/prime, relpath=a
DEBUG:craft_parts.overlays.overlays:layer visibility files=set(), dirs=set()
DEBUG:craft_parts.executor.part_handler:excluding already migrated files: set()
DEBUG:craft_parts.executor.part_handler:excluding already migrated dirs: set()
DEBUG:craft_parts.executor.part_handler:migrate default partition part 'part1' layer to prime
DEBUG:craft_parts.overlays.overlays:check layer visibility in /workdir/parts/part1/layer/boot/efi
DEBUG:craft_parts.overlays.overlays:check if path is visible: root=/workdir/partitions/volume/pc/efi/prime, relpath=.wh..wh..opq
DEBUG:craft_parts.overlays.overlays:check if path is visible: root=/workdir/partitions/volume/pc/efi/prime, relpath=foo
DEBUG:craft_parts.overlays.overlays:check if path is visible: root=/workdir/partitions/volume/pc/efi/prime, relpath=foo/.wh..wh..opq
DEBUG:craft_parts.overlays.overlays:layer visibility files={'.wh..wh..opq', 'foo/.wh..wh..opq'}, dirs={'foo'}
DEBUG:craft_parts.executor.part_handler:excluding already migrated files: set()
DEBUG:craft_parts.executor.part_handler:excluding already migrated dirs: set()
Error: /workdir/stage/boot/efi/foo: No such file or directory.
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Closed and deferred to internal tracking ticket CRAFT-4600. No public fix or merge was provided. The bug involves incorrect overlay file visibility checks during partition priming causing stage migration failures. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed and tracked internally via Jira CRAFT-4600. The overlay partition priming bug was triaged but no public fix or resolution was provided. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed and moved to internal Jira ticket CRAFT-4600 for resolution. The bug causes partition priming failures due to incorrect overlay file visibility checks during migration. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed and deferred to Jira ticket CRAFT-4600 without a GitHub fix. The bug involves overlay partition priming failures due to incorrect directory visibility checks during migration. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1123 fix: Prime content from overlay when split into partitions | craft-parts | merged | Merged fix for priming overlay content when split into partitions. Replaces direct overlay reliance with stage directory and migration state. Approved by three reviewers, passed all CI checks, and resolves issue #1127. | |
| #1611 Extra part triggering stage step before overlay step | craft-parts | closed | Closed after triage and logging as internal ticket CRAFT-5215. No fix was merged. The staging-before-overlay build order bug remains unresolved. | |
| #1093 Prototype distributing content from overlay to partitions | craft-parts | closed | Closed without merging. The prototype distributing overlay content to partitions was abandoned due to 10 unresolved review comments and multiple failing CI checks, leaving the feature unreviewed and incomplete. |