Skip to content

fix(build): apply kwin_wayland cap_sys_nice under fakecap, not in the bst sandbox - #356

Merged
hanthor merged 1 commit into
mainfrom
fix/kwin-setcap-fakecap
Oct 3, 2026
Merged

hanthor merged 1 commit into
mainfrom
fix/kwin-setcap-fakecap

Conversation

@hanthor

@hanthor hanthor commented Oct 3, 2026

Copy link
Copy Markdown
Member

Run 37069338183 got through every chunk, then build_final failed integrating oci/kde-linux/filesystem.bst and oci/layers/tromso-runtime.bst:

Command 'setcap cap_sys_nice+ep /usr/bin/kwin_wayland' failed with exitcode 1

Cause. oci/kde-linux/stack.bst ran that setcap as a public integration command. Integration commands run in BuildStream's sandbox, which cannot write security.capability xattrs. Every compose element that stages the stack therefore failed. The command has been there since May (8d1f30e); the build never reached it before #354/#355.

Fix. Remove it from the integration commands. Set the capability instead in the OCI assembly scripts, which run under freedesktop-sdk's fakecap LD_PRELOAD. That is freedesktop-sdk's own documented answer (see components/shadow.bst: "If those fail, please use components/fakecap.bst in LD_PRELOAD").

  • oci/tromso.bst (the published image) already ran setcap cap_sys_nice+ep /layer/usr/bin/kwin_wayland under fakecap.
  • oci/kde-linux/image.bst now does the same, so the intermediate KDE Linux image keeps parity.
  • build-oci reads the fakecap'd xattrs and writes them as SCHILY.xattr.* headers. It also compares xattrs against the parent layer, so the file lands in the layer with the cap.

Verification. build_final now runs getcap /usr/bin/kwin_wayland on the exported image. It fails if cap_sys_nice is missing.

xfce-linux has no setcap in any integration command; it already uses fakecap in oci/xfce-linux.bst.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY

… sandbox

build_final in run 37069338183 failed integrating oci/kde-linux/filesystem.bst
and oci/layers/tromso-runtime.bst on `setcap cap_sys_nice+ep
/usr/bin/kwin_wayland` (exit 1). That setcap was a public integration
command on oci/kde-linux/stack.bst, and BuildStream's sandbox cannot write
security.capability xattrs, so every compose element staging the stack
failed. It has been there since May; the build simply never got this far.

Drop it from the integration commands and set the capability in the OCI
assembly scripts instead, which run with freedesktop-sdk's fakecap
LD_PRELOAD (its documented answer for setcap in components/shadow.bst).
oci/tromso.bst already did this for the published image; oci/kde-linux/
image.bst now does too. build-oci records fakecap'd xattrs as SCHILY.xattr
headers and compares them against the parent, so the cap reaches the layer.

build_final now getcap's /usr/bin/kwin_wayland in the exported image and
fails if cap_sys_nice is missing.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY
Signed-off-by: hanthor <hanthor@users.noreply.github.com>
@hanthor

hanthor commented Oct 3, 2026

Copy link
Copy Markdown
Member Author

Local check of the mechanism (Fedora container, unprivileged uid with an empty bounding set, freedesktop-sdk 25.08.9 files/fakecap/fakecap.c):

plain:   unable to set CAP_SETFCAP effective capability: Operation not permitted   rc=1   <- same exit 1 as CI
fakecap: rc=0; getcap -> kw cap_sys_nice=ep
python os.listxattr/getxattr under fakecap -> security.capability present (what build-oci's layer_builder reads)

@hanthor
hanthor merged commit 7932454 into main Oct 3, 2026
14 checks passed
@hanthor
hanthor deleted the fix/kwin-setcap-fakecap branch October 3, 2026 06:16
hanthor added a commit that referenced this pull request Oct 3, 2026
#359)

With #356 in, build_final (run 37102603548) got past the compose
integrations; the fakecap setcap in image.bst succeeded. The next command,
`glib-compile-schemas /layer/usr/share/glib-2.0/schemas`, then failed with
exit 127: the element never build-depended on glib. oci/tromso.bst already
does; mirror it.


Claude-Session: https://claude.ai/code/session_01TexZnEN3jq4jRUi8T3zZuY

Signed-off-by: hanthor <hanthor@users.noreply.github.com>
Co-authored-by: hanthor <hanthor@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.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.

1 participant