Skip to content

imagecache: fall back to legacy mount on pre-6.5 kernels - #504

Open
Mesut Oezdil (mesutoezdil) wants to merge 1 commit into
agent-substrate:mainfrom
mesutoezdil:fix/imagecache-legacy-mount-fallback
Open

imagecache: fall back to legacy mount on pre-6.5 kernels#504
Mesut Oezdil (mesutoezdil) wants to merge 1 commit into
agent-substrate:mainfrom
mesutoezdil:fix/imagecache-legacy-mount-fallback

Conversation

@mesutoezdil

@mesutoezdil Mesut Oezdil (mesutoezdil) commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #500.

SetupBundleRootfs mounts overlay rootfs with the new mount API,
using fsconfig lowerdir+ per layer. That option only exists on
Linux 6.5+. On older kernels every actor mount fails with a bare
EINVAL, which looks like flakiness, not a kernel version problem.

Fix: mountOverlay tries lowerdir+ directly on the first layer. If
the kernel does not recognize it, that call fails immediately and
queues "Unknown parameter" on the fs context log; only that specific
diagnostic triggers the fallback to a plain mount(2) call built from
the same lowerdir list, so a bad lowerdir path (ENOENT) is reported
as-is instead of being misread as a kernel version problem. The
legacy path keeps the old ~34 layer cap and errors with a kernel
hint if the option string would go over the mount(2) page limit.

Tested with go test ./internal/imagecache/... on a real Linux
kernel (root, CAP_SYS_ADMIN, tmpfs upperdir), including a test that
forces the fallback with an unrecognized option name and one for
the option string builder.

Comment thread internal/imagecache/bundle_linux.go Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

description is out of date.

agentic review pass (human reviewed before submission) comments inline

Comment thread internal/imagecache/bundle_linux.go
Comment thread internal/imagecache/bundle_linux.go
@BenTheElder

Copy link
Copy Markdown
Collaborator

Please prefer rebase to merge, and squash these, so the commit message will be useful.

we started using volatile, which may have bumped up the requirements, but its load bearing and I don't think we're targeting old kernels

cc igooch

@mesutoezdil
Mesut Oezdil (mesutoezdil) force-pushed the fix/imagecache-legacy-mount-fallback branch from 7a43e8a to 8f58ea3 Compare August 24, 2026 19:46
@mesutoezdil

Copy link
Copy Markdown
Contributor Author

Benjamin Elder (@BenTheElder) thx, squashed into one commit.

On volatile: it landed in Linux 5.10, older than the 6.5 this PR already requires for lowerdir+, so it does not raise the floor past what is here. The code only sets the plain volatile flag too, not the later reusable-remount behavior. Whether the project still wants to support pre-6.5 kernels at all is a separate call, happy to close this if not.

@mesutoezdil
Mesut Oezdil (mesutoezdil) force-pushed the fix/imagecache-legacy-mount-fallback branch from 39e03d5 to b580330 Compare August 26, 2026 07:12
SetupBundleRootfs mounts overlay rootfs with the new mount API using
fsconfig lowerdir+ per layer, which only exists on Linux 6.5+. On
older kernels every actor mount failed with a bare EINVAL, which
looked like flakiness rather than a kernel version problem.

mountOverlay now tries lowerdir+ on the first layer. If the kernel
does not recognize it, that call fails immediately with an Unknown
parameter diagnostic on the fs context log, and only that specific
diagnostic triggers a fallback to a plain mount(2) call built from
the same lowerdir list. A bad lowerdir path still fails as-is instead
of being misread as a kernel version problem. The legacy path keeps
the old about 34 layer cap and errors with a kernel hint if the
option string would go over the mount(2) page limit.

Fixes agent-substrate#500
@mesutoezdil
Mesut Oezdil (mesutoezdil) force-pushed the fix/imagecache-legacy-mount-fallback branch from b580330 to 852b0b8 Compare August 26, 2026 15:41
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.

imagecache: probe for overlayfs lowerdir+ support and fall back to legacy mount(2) on pre-6.5 kernels

2 participants