Skip to content

run: skip /dev/mqueue mount if not supported by the kernel#6941

Open
adenwuts wants to merge 1 commit into
podman-container-tools:mainfrom
adenwuts:run-skip-mqueue-unsupported
Open

run: skip /dev/mqueue mount if not supported by the kernel#6941
adenwuts wants to merge 1 commit into
podman-container-tools:mainfrom
adenwuts:run-skip-mqueue-unsupported

Conversation

@adenwuts

@adenwuts adenwuts commented Jul 6, 2026

Copy link
Copy Markdown

What type of PR is this?

/kind bug

What this PR does / why we need it:

On kernels built without CONFIG_POSIX_MQUEUE, the default type=mqueue mount for /dev/mqueue (seeded by runtime-tools' generate.New()) makes the runtime fail with ENODEV on every buildah run — and, through the copy vendored into podman, on every RUN instruction in podman build.

This ports the fix podman already has for podman run/create (podman-container-tools/podman#28639) into buildah's spec generation: check /proc/filesystems for mqueue support, and drop the /dev/mqueue mount from the spec when the kernel doesn't provide the filesystem. When mqueue is unsupported the userns+host-IPC bind-mount replacement is skipped too, since the host has no /dev/mqueue to bind in that case.

The isMqueueSupported implementation mirrors podman's (sync.OnceValue, same parsing) so the two stay consistent.

How to verify it

On a kernel without CONFIG_POSIX_MQUEUE (no mqueue line in /proc/filesystems), buildah run previously failed with ENODEV mounting /dev/mqueue; with this change the mount is dropped and the container starts. On normal kernels behavior is unchanged.

The added unit test stubs isMqueueSupported and checks that the /dev/mqueue mount is present in the generated spec if and only if the kernel supports it.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

The equivalent podman-side fix landed in podman-container-tools/podman#28639 (commits 1bda61b840 and d8df5c37ef); this change keeps buildah's behavior and implementation aligned with it.

Does this PR introduce a user-facing change?

Fixed `buildah run` failing with ENODEV on kernels built without CONFIG_POSIX_MQUEUE by omitting the /dev/mqueue mount when the kernel does not support the mqueue filesystem.

On kernels built without CONFIG_POSIX_MQUEUE, mounting the default
type=mqueue /dev/mqueue mount fails with ENODEV, breaking every
buildah run and, through the vendored copy, every RUN instruction
in podman build.

Check /proc/filesystems for mqueue support and drop the /dev/mqueue
mount when the filesystem is unavailable, mirroring the equivalent
fix in podman's specgen (podman-container-tools/podman#28639).

Signed-off-by: Aden Northcote <aden.northcote@whatbox.ca>
Comment thread run_linux.go

// isMqueueSupported reports whether the kernel supports the mqueue
// filesystem, i.e. was built with CONFIG_POSIX_MQUEUE.
var isMqueueSupported = sync.OnceValue(func() bool {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

if this uses the same function as podman it should be moved to the common library, maybe as a new pkg there pkg/fsinfo or something like that?
So that then podman and buildah can reuse the same function from one place which means we also only have to cache it once.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good call, I can take a look.

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