Skip to content

fix(selinux): stop two harmless security warnings on every boot - #1201

Closed
kylerankin wants to merge 1 commit into
projectbluefin:testingfrom
kylerankin:fix/selinux-booted-image-avc-denials
Closed

kylerankin wants to merge 1 commit into
projectbluefin:testingfrom
kylerankin:fix/selinux-booted-image-avc-denials

Conversation

@kylerankin

@kylerankin kylerankin commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary: Every time Utah starts, a small service that records which version of Utah is running makes the tool that updates Utah run in the wrong security context. That writes two harmless "denied" warnings to the security log on every boot. Nothing breaks, but those warnings are alarming to see, and now that Utah's automated tests read that log, they would fail every test run. This change runs the update tool the way Utah already runs it elsewhere — as the service's own startup command instead of from inside a helper script — so it gets the correct security context and the warnings stop, while still recording the same image for fastfetch to show.

What I need from you: Approve it.


What changed

  • The service that records the booted image now runs the update tool directly as its own startup command (ExecStart), so the tool runs in its own SELinux domain instead of inside the helper script's broad, unrestricted domain.
  • The helper script no longer runs the update tool. It only reads the output the service saved and writes it, unchanged, where fastfetch can find it.
  • A startup step creates the folder for the saved output first, so the tool has somewhere to write before it runs.

Why

  • The two warnings come from the update tool's own self-check, which probes whether it may relabel files. That probe is allowed only when the tool runs in its own SELinux domain. Wrapped inside the helper script it ran in the unrestricted service domain, so the probe was denied and logged two SELinux "denied" entries every boot.
  • Utah already runs this same tool the correct way in one other service, whose notes say exactly this: the tool must stay the bare startup command, and wrapping it in a script put it in the wrong context.
  • Evidence: a testsuite run on ghcr.io/projectbluefin/utah:testing failed its SELinux gate on exactly these two records — two chcon calls denied mac_admin, 134 ms apart, about 12.7 s into boot, from ublue-booted-image.service.

Acceptance

  • No chcon "denied" entries in the boot log or audit log of a booted :testing build.
  • /run/ublue-os/booted-image still holds the same reference bootc status reports, so fastfetch shows the right image.
  • The reader that fastfetch uses still works.

Tests

  • Added a unit test (tests/test_booted_image_unit.py) that pins the service's shape: the update tool runs directly as ExecStart, its output is truncated to a file, a startup step makes the folder first, the helper script reads that file, and the helper script no longer runs the tool itself. All 5 cases pass.

Note for a maintainer

  • The SELinux gate in the testsuite is only reachable on a built image. If you can, run testsuite manual.yml with suites=common on this PR's built image (testsuite fix(tuned): keep TuneD off the bootc sysroot lock #1171 or main) and link the run so the AVC gate is confirmed green.

— hive: backend=pi model=lemonade/ornith-1.5-35b-a3b-gguf-q6_k

@github-actions

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign ahmedadan after the PR has been reviewed.
You can assign the PR to them by writing /assign @ahmedadan in a comment when ready.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hivecommons-hive

Copy link
Copy Markdown
Contributor

/ok-to-test

@github-actions

Copy link
Copy Markdown
Contributor

Cannot /ok-to-test because Error: hivecommons-hive[bot] is not a reviewer or approver for any changed file

@hivecommons-hive hivecommons-hive Bot added author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head labels Nov 13, 2026
ublue-booted-image.service recorded the booted image ref by running
`bootc status --json` from the ublue-booted-image-sync script. bootc then
ran in the script's unconfined service domain instead of its own SELinux
domain, so its relabelling chcon probe was denied mac_admin, logging two
AVC denials in every boot.

Run bootc as the unit's bare ExecStart so it enters bootc's install_exec_t
domain, truncate its JSON to a file, and parse that file in ExecStartPost
with the existing sync script. /run/ublue-os/booted-image still holds the
same reference for fastfetch.

Hive-Run: projectbluefin#1198
Hive-Plan: selinux-booted-image-avc-denials
Hive-Spec: projectbluefin#1198

Signed-off-by: kylerankin <kylerankin@users.noreply.github.com>
@hivecommons-hive

Copy link
Copy Markdown
Contributor

/ok-to-test

@github-actions

Copy link
Copy Markdown
Contributor

Cannot /ok-to-test because Error: hivecommons-hive[bot] is not a reviewer or approver for any changed file

@Danathar

Copy link
Copy Markdown
Contributor

Closing as a duplicate of #1203, which has the identical diff (same author, opened 5 hours later from fix/selinux-booted-image-avc-denials-2). Review and follow-up are on #1203: the change needs rework because StandardOutput=truncate: re-truncates the JSON for ExecStartPost.

@Danathar Danathar closed this Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author/clanker A contributor's own hive authored this PR under their login dco All commits are DCO signed-off role/trusted Author is trusted for unattended merge (trusted-author role or registry/claim tier in require_tiers) stage/050-review-pending Review swarm requested; awaiting a verdict for the current head

Projects

None yet

Development

Successfully merging this pull request may close these issues.

selinux: ublue-booted-image runs bootc status from a script, so bootc's capability probe logs two chcon AVC denials every boot

2 participants