linux: put the service user in the render group, so the engine can open an AMD or Intel GPU (#1535) - #1537
Merged
Conversation
…en an AMD or Intel GPU (#1535) The inference engine is the daemon's child and runs as `waired`. On Debian and Ubuntu, /dev/dri/renderD* and /dev/kfd are 0660 root:render, because both distributions build systemd with group-render-mode=0660. So without the group the engine cannot see an AMD GPU (ROCm or Vulkan) or an Intel GPU (Vulkan), and it runs on the CPU without saying why. #1466 had chosen not to grant the group, but that choice considered only the profiler's reading. - The .deb postinst runs `usermod -a -G render waired` on every configure, when the group exists, so an upgrade fixes an existing install. `waired-agent install` does the same through ensureGPUGroups. - `video` is left out (owner decision): it also opens cameras and the display, and computing does not need it. - The unit keeps no SupplementaryGroups=, because naming an absent group stops the unit (216/GROUP). systemd applies a User='s groups from the group database. - The gpu-topology.json reading from `sudo waired init` stays, as the floor for a host whose service user is not in the group. - The new decision record partly supersedes the 2000 decision. The notes and comments that said the service has no groups are corrected. - The troubleshooting and Linux install pages (en/ja) now name the group, with how to check it. Checked on a Linux host with an NVIDIA card and an AMD iGPU: - Without the group, the product's ollama does not list the iGPU at all. - With the group, it finds the iGPU through Vulkan. With default settings it then drops the iGPU and serves on CUDA, as it does today. - The postinst (run twice, as an upgrade) adds the group, and the restarted daemon runs with it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BviBGHJqCeM88hxCRYrtAg Signed-off-by: gen16k <gen16k@users.noreply.github.com>
|
📘 Docs preview — the preview channel for this PR has been deleted now that it is closed. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The inference engine is started by the daemon as its child (
internal/runtime/spawner_unix.go, with no credential change), so on Linux it runs aswaired.On Debian and Ubuntu,
/dev/dri/renderD*and/dev/kfdare0660 root:render. Both distributions build systemd with-Dgroup-render-mode=0660; upstream's default is0666. The engine needs these nodes for AMD GPUs (ROCm or Vulkan) and Intel GPUs (Vulkan). Without therendergroup it cannot see such a GPU, and it runs on the CPU without saying why.#1466 (for #459) had decided not to grant the group, so as not to add a standing privilege for a fact that never changes. That decision considered only the profiler's reading; the engine needs the node for every computation.
What changes
packaging/debian/waired/postinstrunsusermod -a -G render wairedon everyconfigure, when the group exists. An upgrade therefore fixes an existing install; the existing restart picks the group up.waired-agent installdoes the same throughensureGPUGroups(internal/platform/service/service_linux.go). Which groups to join, and how, are both passed in, so the table test drives the real function.usermodis declared inscripts/ci/lookpathguard/exemptions.go.renderonly, nevervideo(owner decision, 2026-09-22).videoalso opens cameras (/dev/video*) and the display (/dev/dri/card*), and computing does not need it on the supported distributions.SupplementaryGroups=in the unit.User='s groups from the group database (systemd.exec(5)).sudo waired initreading (gpu-topology.json) stays as the floor for a host whose service user is not in the group. With the group, the daemon reads the FUSION bit and an Intel card's memory itself, and a live reading already wins. The product stringunreadIntelMemoryReasonis unchanged: it now shows only when the live read fails.docs/decisions/20260922/1430-linux-service-user-joins-render.md. It partly supersedes20260920/2000(only the "do not grantrender" sentence), with links both ways.internal/hardware,internal/runtime/state/gpu_topology.go, and bothgpu_topology.gofiles undercmd/.troubleshooting/slow-or-wrong.md: the Linux paragraph now names the group, withid wairedto check it andusermodto fix it. It replaces "memory can only be read with administrator rights".getting-started/install/linux.mdx: a "Service user" row.assert_tier1checksrendermembership where the guest has the group, and thatvideois absent.assert_postinst_selfhealremoves the group beforedpkg-reconfigureand checks that it comes back.Verification
go test ./...: exit 0.golangci-lint: 0 issues on the touched packages (Linux).GOOS=windowsandGOOS=darwingo vet: OK. TheGOOS=windowslint findings are all in files this PR does not touch.install-script-lint(shellcheck and copy guard),decision-log-guard,hostname-guard,lookpathguardandnpm run i18n:check: all OK.video;groupExiststhat is always true;SupplementaryGroups=in the rendered unit;SupplementaryGroups=in the packaged unit.Groups: 117(waired only).renderD128,renderD129and/dev/kfdwere denied towaired;/dev/nvidia*are 0666.wairedon a spare port:renderandOLLAMA_IGPU_ENABLE=1, it appears aslibrary=Vulkan … type=iGPU;renderand the defaults, it is dropped (dropping integrated GPU) and CUDA serves. That is today's result, and waired's prediction still matches.configure <installed version>(an upgrade): exit 0 both times; the restarted daemon ran withGroups: 117 991. The host was then restored (gpasswd -d waired render, restart, binaries unchanged by sha256).id wairedfirst.Other operating systems (cross-OS parity)
.deb.Found alongside, not fixed here
Both are recorded in #1535 and #1534.
CAP_PERFMONor as root, andNoNewPrivileges=yesalso disables file capabilities. This affects Intel Arc, and granting a capability is a separate security decision./dev/nvidia-uvmcreated on demand by the setuidnvidia-modprobecannot be created underNoNewPrivileges=yes(inference: check whether Windows and Linux can fail first-start GPU discovery the way macOS did in #1521 (six unverified candidates) #1534 item 5).Fixes #1535
🤖 Generated with Claude Code
https://claude.ai/code/session_01BviBGHJqCeM88hxCRYrtAg