Failing to prime content with overlay and partitions
Metadata
Current evaluation
Fixed by merged PR canonical/craft-parts#1123 (commit 3540e306), using partition stage files and migration state when priming overlay content.
Resolution: closed resolved
Reason: PR canonical/craft-parts#1123 was merged as commit 3540e306, replacing layer-based visibility checks with partition stage files and tracked migration state.
Evaluated by: mr-cal-bot
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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/craft-parts#1123 (commit 3540e306), using partition stage files and migration state when priming overlay content. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR canonical/craft-parts#1123 (3540e306), which uses partition stage files and migration state to prime overlay content instead of relying on the layer. | |
| 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 work
-
Likely Fixed By:
canonical/craft-parts#1123
(confidence 100%)
Merged fix for priming overlay content split across partitions.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1123 fix: Prime content from overlay when split into partitions | craft-parts | merged | Merged PR #1123 (commit 3540e306), fixing overlay priming with partitions by using stage content and migration state while preserving existing prime state files. | |
| #1093 Prototype distributing content from overlay to partitions | craft-parts | closed | Prototype PR #1093 (overlay content to partitions) was closed unmerged with 10 unresolved review comments and failing CI. Its work landed separately in #1109 (8810ccc2) and the follow-up fix #1123 (3540e306). | |
| #1035 feat: reconcile overlays and partition features | craft-parts | merged | Merged PR #1035 at commit b575539e, enabling overlay and partition features simultaneously and fixing canonical/craft-parts#1028. | |
| #1611 Extra part triggering stage step before overlay step | craft-parts | closed | Fixed in canonical/craft-parts#1618 (18239b07): overlay-organized parts now build and organize before dependency staging, preventing fstab content from being missed. | |
| #1226 Organize content into the overlay | craft-parts | closed | Parts can organize content into the mounted overlay via merged PR #1254 (commit 0c806f20), shipped in craft-parts 2.22.0. | |
| #121 overlay: migrate overlay data to stage and prime (CRAFT-468, CRAFT-82) | craft-parts | merged | Merged PR #121 as d45d7079, moving overlay data into stage/prime, translating whiteouts and opaque directories to OCI, and cleaning shared overlay data. |