← Back to issue list

Extra part triggering stage step before overlay step

View original Github issue

Metadata

Project
craft-parts
Number
#1611
Type
issue
State
closed
Author
smethnani
Labels
Status: Triaged
Created
Updated
Closed

Current evaluation

Fixed in canonical/craft-parts#1618 (18239b07): overlay-organized parts now build and organize before dependency staging, preventing fstab content from being missed.

Resolution: closed resolved

Reason: Merged PR canonical/craft-parts#1618 at commit 18239b07 changes lifecycle ordering so BUILD/organize takes precedence over dependency STAGE for parts organized to the overlay. This directly resolves the reported rootfs staging race.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description While using imagecraft with the following imagecraft.yaml: ``` name: minimal version: "0.1" summary: A test image description: A test image base: bare build-base: ubuntu@24.04 platforms: amd64: filesystems: default: - mount: / device: (volume/pc/rootfs) - mount: /boot/efi/ device: (volume/pc/efi) parts: # build a simple rootfs rootfs: plugin: mmdebstrap mmdebstrap-variant: "minbase" mmdebstrap-packages: - ubuntu-server-minimal - grub2-common - grub-efi-amd64 - shim-signed - linux-image-generic override-build: | craftctl default mkdir -p $CRAFT_PART_INSTALL/boot/efi organize: "*": (overlay)/ apt-config: plugin: dump source: apt-config/ after: [rootfs] organize: ubuntu.sources: (overlay)/etc/apt/sources.list.d/ubuntu.sources fish-ppa.sources: (overlay)/etc/apt/sources.list.d/fish-ppa.sources keyrings/fish-ppa.gpg: (overlay)/etc/apt/keyrings/fish-ppa.gpg # Define a fstab fstab: plugin: nil after: [rootfs] overlay-script: | cat << EOF > $CRAFT_OVERLAY/etc/fstab LABEL=writable / ext4 discard,errors=remount-ro 0 1 LABEL=UEFI /boot/efi vfat umask=0077 0 1 EOF volumes: pc: schema: gpt structure: - name: efi type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B filesystem: vfat role: system-boot filesystem-label: UEFI size: 256M - name: rootfs type: 0FC63DAF-8483-4772-8E79-3D69D8477DE4 filesystem: ext4 filesystem-label: writable role: system-data size: 5G ``` I expected the overlay step in `fstab` to complete before `rootfs` staging. But: - the staging step of `rootfs` happens first (when fstab's layer is empty) since its needed to build the `apt-config` part - the content from `fstab` is in `parts/fstab/layer/etc/fstab` after packing but never makes it into the final image ``` 2026-06-05 13:35:50.323 Staging rootfs (required to build 'apt-config') ... 2026-06-05 13:36:24.832 Overlaying fstab ``` Without the `apt-config` part, the `fstab` overlay step happens before `rootfs` staging: ``` 2026-06-05 14:59:47.772 Overlaying fstab ... 2026-06-05 14:59:47.826 Staging rootfs (required to build 'fstab') ``` ### To Reproduce Run `imagecraft pack` with the example imagecraft.yaml with and without the apt-config part ### part yaml ```shell parts: # build a simple rootfs rootfs: plugin: mmdebstrap mmdebstrap-variant: "minbase" mmdebstrap-packages: - ubuntu-server-minimal - grub2-common - grub-efi-amd64 - shim-signed - linux-image-generic override-build: | craftctl default mkdir -p $CRAFT_PART_INSTALL/boot/efi organize: "*": (overlay)/ apt-config: plugin: dump source: apt-config/ after: [rootfs] organize: ubuntu.sources: (overlay)/etc/apt/sources.list.d/ubuntu.sources fish-ppa.sources: (overlay)/etc/apt/sources.list.d/fish-ppa.sources keyrings/fish-ppa.gpg: (overlay)/etc/apt/keyrings/fish-ppa.gpg # Define a fstab fstab: plugin: nil after: [rootfs] overlay-script: | cat << EOF > $CRAFT_OVERLAY/etc/fstab LABEL=writable / ext4 discard,errors=remount-ro 0 1 LABEL=UEFI /boot/efi vfat umask=0077 0 1 EOF ``` ### Relevant log output ```shell 2026-06-05 13:35:50.323 Staging rootfs (required to build 'apt-config') ... 2026-06-05 13:36:24.832 Overlaying fstab Without the `apt-config` part, the `fstab` overlay step happens before `rootfs` staging: 2026-06-05 14:59:47.772 Overlaying fstab ... 2026-06-05 14:59:47.826 Staging rootfs (required to build 'fstab') ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed in canonical/craft-parts#1618 (18239b07): overlay-organized parts now build and organize before dependency staging, preventing fstab content from being missed.
stealth/space-bunny-alpha — closed resolved Fixed by merged PR canonical/craft-parts#1618 (commit 18239b07), which prioritizes build/organize over dependency staging for overlay-organized parts.
qwen/qwen3.6-35b-a3b — — Closed and synced to internal Jira ticket CRAFT-5215. No fix, merge, or rejection was documented. The build order bug remains tracked externally.
qwen/qwen3.6-35b-a3b — — Closed after triage and logging as internal ticket CRAFT-5215. No fix was merged. The staging-before-overlay build order bug remains unresolved.
qwen3.6-35b-a3b-mtp-q6 — — Closed and deferred to internal tracking as CRAFT-5215. No public fix or resolution was provided.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/craft-parts#1618 (confidence 100%)

    Merged fix for overlay-organized part dependency ordering, commit 18239b07.

Related issues

Issue Project State Summary Similarity
#1261 feat: reorder steps if organizing to overlay craft-parts merged Merged in commit 55d01a3f, PR #1261 runs BUILD after OVERLAY for parts organizing to overlay so organized content is available to parts installing overlay packages.
75%
#1225 Reorder lifecycle steps if organizing to overlay craft-parts closed Fixed overlay-part lifecycle ordering: parts organizing to overlay now run BUILD after OVERLAY via merged PR #1261 (55d01a3f).
74%
#1254 feat: allow parts to organize to overlay craft-parts merged PR #1254 was merged, adding the (overlay) organize target to move part build files to the top of the mounted overlay stack (commit 0c806f20).
74%
#1228 Reorder parts to prioritize organize to overlay craft-parts closed Prioritized parts that organize overlays so installing overlay-package parts can use the prepared base; merged in canonical/craft-parts#1261 (55d01a3f).
74%
#137 many: add overlay step (CRAFT-84) craft-parts merged Merged craft-parts#137 as commit 1a813210, adding the overlay lifecycle step and subsystem support for package installation and filesystem mutations.
73%
#1127 Failing to prime content with overlay and partitions craft-parts closed Fixed by merged PR canonical/craft-parts#1123 (commit 3540e306), using partition stage files and migration state when priming overlay content.
73%
#1487 Multiple parts cannot organize to the same directory in the overlay craft-parts closed Fixed by merged PR canonical/craft-parts#1586 (commit 0797420f), allowing wildcard-organized overlay directories from multiple parts to merge despite metadata differences.
73%
#1735 Parts that organize to the overlay should not accept `overlay-script` or `override-overlay` craft-parts open craft-parts accepts overlay-script/override-overlay on parts whose organize targets (overlay), silently doing the wrong thing. Triaged by lengau, assigned to randyli, and targeted by open PR #1747 adding PartSpec validation plus tests/docs.
72%
#4948 docs: exclude overlay step, bump craft-parts to 1.34.0 snapcraft merged Merged in canonical/snapcraft#4948, fixing the docs build by excluding overlay-step docs and bumping craft-parts to 1.34.0 (f57f7e0c0, de13316cb).
71%
#1291 BUILD step of a part organizing to the overlay should invalidate overlay contents of following parts craft-parts open A part BUILD that organizes files into the overlay can change lower overlay layers without invalidating dependent OVERLAY steps; the precise reproducer exists but the open issue remains untriaged
70%