Skip to content

Conversation

@cgwalters
Copy link
Collaborator

Add a lint that warns when /run or /tmp contain any content. These
directories are tmpfs at runtime and should be empty in container images.

Common causes of content in these directories include:

  • podman/buildah's RUN --mount leaving directory stubs
  • Build tools leaving temporary files

This is particularly important for bootc with composefs because content
in these directories can cause digest mismatches between build-time
(mounted filesystem) and install-time (OCI tar layers) views, leading
to sealed boot failures.

The lint uses the walk API with noxdev() to automatically skip mount
points, and filters out content injected by container runtimes
(.containerenv, secrets, packages).

Assisted-by: OpenCode (Opus 4.5)

@bootc-bot bootc-bot bot requested a review from jeckersb January 14, 2026 20:08
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new lint, nonempty-run-tmp, which warns if the /run or /tmp directories contain any files in the container image. These directories are mounted as tmpfs at runtime and should be empty in the base image to avoid issues, particularly with composefs. The implementation of the lint in Rust is robust, correctly handling mount points to avoid false positives from runtime-injected content. The associated changes in the Dockerfile and Dockerfile.cfsuki are excellent, adopting the modern RUN --mount=type=tmpfs pattern to prevent build artifacts from leaking into these directories. The changes are clean, correct, and improve the quality and correctness of the built container images. The addition of tests for the new lint is also appreciated.

jeckersb
jeckersb previously approved these changes Jan 14, 2026
Copy link
Collaborator

@jeckersb jeckersb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeckersb
Copy link
Collaborator

I guess moving the linting to the end to allow the bind mounts to release in the sealed case isn't working:

[3/4] STEP 3/3: RUN --network=none bootc container lint --fatal-warnings
error: Linting: Checks failed: 1
Lint warning: nonempty-run-tmp: Found content in runtime-only directories (/run, /tmp):
  /run/packages

@jeckersb
Copy link
Collaborator

Hm if I run just build-sealed locally (which is roughly what the CI job is doing) that works ok for me. Maybe something that's fixed in newer podman? Looks like the ubuntu runner ends up with 5.4.1:

Unpacking podman (5.4.1+ds1-1) over (4.9.3+ds1-1ubuntu0.2) ...

Whereas locally I have 5.7.1.

@cgwalters cgwalters force-pushed the lint-check-run branch 3 times, most recently from 114703e to 835aa92 Compare January 15, 2026 13:53
@cgwalters
Copy link
Collaborator Author

Lint warning: nonempty-run-tmp: Found content in runtime-only directories (/run, /tmp):
/run/packages

This should be fixed now, had to avoid the global -v /run/packages injected in the podman build.

jeckersb
jeckersb previously approved these changes Jan 15, 2026
@jeckersb
Copy link
Collaborator

Now:

Lint warning: nonempty-run-tmp: Found content in runtime-only directories (/run, /tmp):
  /run/systemd
  /run/systemd/resolve
  /run/systemd/resolve/stub-resolv.conf

😭

@cgwalters
Copy link
Collaborator Author

Hmm yes I wasn't reproducing that locally; I think it may indeed be a difference in the podman networking setup. I tried enforcing a tmpfs for /run across all RUN invocations.

@cgwalters
Copy link
Collaborator Author

No you were right it is a podman version difference, my agent research turned up containers/buildah#6233 which looks like the likely fix.

@jeckersb
Copy link
Collaborator

No you were right it is a podman version difference, my agent research turned up containers/buildah#6233 which looks like the likely fix.

Good job agent! 🤖

@cgwalters cgwalters disabled auto-merge January 15, 2026 20:46
@cgwalters
Copy link
Collaborator Author

Disabling automerge for this until we do a point release

When using --mount=type=bind,target=/run/foo, podman/buildah creates
the mount point directory in the image layer even though the mounted
content is not committed. These empty directory stubs pollute /run
in the final image.

Fix by using --mount=type=tmpfs,target=/run with bind mounts nested
inside. This ensures /run remains empty in the committed layer.

Also move the lint invocation in Dockerfile.cfsuki to a separate RUN
command so it runs after the bind mount is released.

Assisted-by: OpenCode (Opus 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
Add a lint that warns when /run or /tmp contain any content. These
directories are tmpfs at runtime and should be empty in container images.

Common causes of content in these directories include:
- podman/buildah's RUN --mount leaving directory stubs
- Build tools leaving temporary files

This is particularly important for bootc with composefs because content
in these directories can cause digest mismatches between build-time
(mounted filesystem) and install-time (OCI tar layers) views, leading
to sealed boot failures.

The lint uses the walk API with noxdev() to automatically skip mount
points, and filters out content injected by container runtimes
(.containerenv, secrets, packages).

Assisted-by: OpenCode (Opus 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
Add a helper function that returns WalkConfiguration with noxdev()
enabled by default. This ensures consistent behavior across all
filesystem walks in the linting code.

The doc comment clarifies that noxdev skips directory mount points
(to avoid descending into bind mounts, tmpfs, etc.) but non-directory
mount points like bind-mounted regular files will still be visited.

Assisted-by: OpenCode (Opus 4.5)
Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters enabled auto-merge (rebase) January 16, 2026 13:07
@cgwalters cgwalters requested a review from jeckersb January 16, 2026 13:16
@cgwalters cgwalters merged commit d5c6515 into bootc-dev:main Jan 16, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants