Skip to content

Keep app.slice loadable with private procfs - #6494

Open
mateuspim wants to merge 1 commit into
basecamp:quattrofrom
mateuspim:fix/oomd-hidepid-compat
Open

Keep app.slice loadable with private procfs#6494
mateuspim wants to merge 1 commit into
basecamp:quattrofrom
mateuspim:fix/oomd-hidepid-compat

Conversation

@mateuspim

Copy link
Copy Markdown

Why

ManagedOOM*=kill makes a user unit unloadable when /proc is mounted with a privacy policy such as hidepid=invisible or hidepid=noaccess.

systemd resolves the implicit systemd-oomd.service dependency through cg_mask_supported(), which reads PID 1's cgroup from /proc/1/cgroup. With PID 1 hidden, that lookup returns ESRCH and unit loading fails with:

Unit app.slice failed to load properly, please adjust/correct and reload service manager: No such process

Because D-Bus, PipeWire, UWSM app scopes, and other user units depend on app.slice, this can prevent the graphical session from starting or leave launchers stuck at “Launching…”. The same failure affects every lingering user manager on the host.

The procfs policy is useful hardening and should not need to be weakened to boot Omarchy.

What

  • Add a systemd user generator that emits the existing app.slice OOM drop-in only when /proc/1/cgroup is readable.
  • Keep the existing drop-in as the single source of truth and link it into generator output on compatible systems.
  • Add a migration that reloads existing user managers, removing stale unconditional candidacy where PID 1 is hidden.
  • Update the original migration comments and file-layout documentation for the generated path.
  • Test both generator branches and keep the assertion that only app.slice is eligible for OOM killing.
  • Require packaging coverage for the generator and reject reinstalling the template unconditionally as a vendor drop-in.

Normal systems keep the OOM protection introduced in #6445. Hardened systems skip only the incompatible candidacy settings; systemd-oomd.service may remain enabled harmlessly.

Verified

  • Reproduced independently with temporary user slices: either ManagedOOMMemoryPressure=kill or ManagedOOMSwap=kill causes LoadState=error under hidepid=invisible.
  • Confirmed systemd debug output fails while determining supported controllers because PID 1 is hidden.
  • SYSTEMD_UNIT_PATH=/usr/lib/systemd/user systemd-analyze --user verify app.slice fails on the affected host.
  • Adding the compatibility override makes the same isolated verification pass.
  • Updated a live Omarchy installation from r1477 to r1485, reloaded the user manager, and rebooted twice with the procfs hardening unchanged.
  • Verified Ghostty, Nautilus, and a Discord web app launch through their real Hyprland/launcher paths and land under app.slice.
  • ./test/shell.d/systemd-test.sh passes.
  • ./test/shell reaches the pre-existing bar icons share slot and baseline geometry failure; tests before it pass.
  • test/shell.d/config-test.sh requires the private omarchy-pkgs checkout and will intentionally require the companion packaging update below.

Companion packaging change

omarchy-settings must stop installing:

default/systemd/user/app.slice.d/10-oomd.conf -> /usr/lib/systemd/user/app.slice.d/10-oomd.conf

The template remains under /usr/share/omarchy/default/. Install the generator instead:

install -Dm755 default/systemd/user-generators/omarchy-oomd-generator \
  "$pkgdir/usr/lib/systemd/user-generators/omarchy-oomd-generator"

Copilot AI review requested due to automatic review settings August 1, 2026 22:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Conditionally enables app.slice OOM candidacy so hardened procfs configurations remain usable.

Changes:

  • Adds and tests a compatibility-aware systemd user generator.
  • Reloads existing user managers through migration.
  • Updates packaging checks and layout documentation.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
default/systemd/user-generators/omarchy-oomd-generator Generates the OOM drop-in only when PID 1’s cgroup is readable.
migrations/1785620124.sh Reloads user managers after upgrading.
migrations/1785424256.sh Updates generator behavior comments.
test/shell.d/systemd-test.sh Tests both procfs compatibility branches.
test/shell.d/config-test.sh Enforces correct companion packaging.
docs/file-layout.md Documents template and generator locations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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