← Back to issue list

Priming files into /lib breaks system binaries in the final image

View original Github issue

Metadata

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

Current evaluation

Priming files under Ubuntu usrmerge paths could replace base symlinks and break binaries; layer packing now rewrites those paths, but issue #137 remains open.

Suggested action: close resolved

Reason: Merged PR #154, commit 607d934f, introduced symlink-aware packing that places primed files under the base symlink's target instead of replacing it. Current rockcraft/layers.py still detects lower-layer symlinks and rewrites archive paths, and the lifecycle documentation describes this exact Ubuntu usrmerge failure.

Evaluated by: mr-cal-bot

Impact: 74 Quick Win: 24 Complexity: 65 Confidence: 97 Actionability: 92

Issue body

For the following `rockcraft.yaml`, the `files/` directory contains just an empty `file.txt`: ```yaml name: broken-image summary: summary description: description version: "0.0.1" license: Apache-2.0 base: ubuntu:22.04 platforms: amd64: parts: p1: plugin: dump source: files organize: file.txt: /lib/file.txt ``` After building and loading the ROCK into docker with skopeo, the binaries inside the container are broken: ```bash $ docker run -it broken-image bash exec /usr/bin/bash: no such file or directory ``` -------------------------------- From a little testing, I think the issue is the interaction between the base image layer and the new layer created for the parts. In `ubuntu:22.04`, `/lib` is a symlink to `/usr/lib`. The layer created for the parts' files has a `/lib/file.txt` and this is breaking the symlink; the "final" filesystem used in the containers has a regular `/lib` dir that is *not* a symlink, and only contains `file.txt`. Thus the binaries that link against `/lib` are now broken because the dependencies cannot be resolved anymore. This example is simple but the bug probably affects many plugins; in particular the `python` plugin breaks because it writes the `site-packages` in `/lib`.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha
Impact: 74
Quick Win: 24
Complexity: 65
Confidence: 97
Actionability: 92
close resolved Priming files under Ubuntu usrmerge paths could replace base symlinks and break binaries; layer packing now rewrites those paths, but issue #137 remains open.
qwen/qwen3.6-35b-a3b
Impact: 95
Quick Win: 30
Complexity: 65
Confidence: 95
Actionability: 90
close resolved Rockcraft breaks system symlinks (e.g. /lib -> /usr/lib) when priming files into symlinked directories, causing broken binaries in the final image.
qwen/qwen3.8-27b
Impact: 80
Quick Win: 24
Staleness: 75
Complexity: 70
Confidence: 72
Support Request: 5
close stale Priming files into /lib (a symlink to /usr/lib in Ubuntu 22.04) breaks the symlink in the final image, causing system binaries to fail. Multiple usrmerge-related PRs have since been merged addressing symlink handling in layers.
qwen/qwen3.6-35b-a3b
Staleness: 95
Complexity: 85
Confidence: 90
Support Request: 0
close stale Priming files into /lib replaces symlinks and breaks system binaries in container images. Maintainers discussed layering strategies and overlay workarounds. Inactive for over 3 years.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 80
Confidence: 80
Support Request: 5
needs triage Bug where priming files into /lib replaces a critical symlink with a directory, breaking system binaries in Ubuntu-based ROCK images. Technical discussion occurred in late 2022 but stalled, leaving the issue untriaged and unresolved for over three years.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: rockcraft#154 (confidence 98%)

    Merged commit 607d934f fixed packing for usrmerged Ubuntu bases by writing primed files into symlink target directories.

Related issues

No related issues found above the similarity threshold.