Skip to content

Add --overlay-opt option to pass extra overlayfs mount options - #784

Open
dam9000 wants to merge 1 commit into
containers:mainfrom
dam9000:pr-overlay-opt
Open

Add --overlay-opt option to pass extra overlayfs mount options#784
dam9000 wants to merge 1 commit into
containers:mainfrom
dam9000:pr-overlay-opt

Conversation

@dam9000

@dam9000 dam9000 commented Sep 5, 2026

Copy link
Copy Markdown

Add a new --overlay-opt option that passes additional mount options to the kernel's overlayfs for the next --overlay, --tmp-overlay or --ro-overlay mount. For example:

  bwrap --ro-bind / / --overlay-src /opt \
        --overlay-opt index=off,xino=off --tmp-overlay /opt true

This silences the overlayfs warnings seen with unprivileged bwrap, which runs without CAP_DAC_READ_SEARCH in the initial user namespace, so the kernel's file handle check fails for the upper and lower dirs:

overlayfs: upper fs does not support file handles, falling back to index=off.
overlayfs: fs on... does not support file handles, falling back to xino=off.

The "does not support file handles" wording is misleading: the check is capability-based, so the warnings appear even on filesystems with file handle support (and not when running as root). index=off,xino=off skips the check.

--overlay-opt may be given before or after the --overlay-src arguments, and may be repeated; the values are joined with a comma. The value is passed unvalidated to the kernel.

The overlay mount failure messages now print the mount op's dest instead of (null), which the last --overlay-src op has.

Test coverage: option before and after --overlay-src, repeated option, dangling --overlay-opt and unconsumed --overlay-src.

NOTE: the value is passed unvalidated to the kernel (which will reject invalid values). Values duplicating bwrap's own upperdir / workdir / lowerdir / userxattr are not rejected; the kernel's last-wins parser means a resolvable user value overrides bwrap's. Let me know if you would want parse-time checks for these.

Resolves #783

Add a new --overlay-opt option that passes additional mount options
to the kernel's overlayfs for the next --overlay, --tmp-overlay or
--ro-overlay mount. For example:

  bwrap --ro-bind / / --overlay-src /opt \
        --overlay-opt index=off,xino=off --tmp-overlay /opt true

This silences the overlayfs warnings seen with unprivileged bwrap,
which runs without CAP_DAC_READ_SEARCH in the initial user namespace,
so the kernel's file handle check fails for the upper and lower dirs:

overlayfs: upper fs does not support file handles, falling back to index=off.
overlayfs: fs on... does not support file handles, falling back to xino=off.

The "does not support file handles" wording is misleading: the
check is capability-based, so the warnings appear even on
filesystems with file handle support (and not when running as
root). index=off,xino=off skips the check.

--overlay-opt may be given before or after the --overlay-src
arguments, and may be repeated; the values are joined with a
comma. The value is passed unvalidated to the kernel.

The overlay mount failure messages now print the mount op's dest
instead of (null), which the last --overlay-src op has.

Test coverage: option before and after --overlay-src, repeated option,
dangling --overlay-opt and unconsumed --overlay-src.

Signed-off-by: Damjan 9000 <damjan.9000@gmail.com>
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.

using the overlay option causes kernel warnings "upper fs does not support file handles"

1 participant