run: support systems without a systemd user manager #337

Open
github-bot wants to merge 2 commits from github-bot/gh-337 into main AGit
Owner

@⁠loyodea on GitHub · 2026-12-03 17:08 UTC · original
loyodea:fix/251-init-system-support → main · +267 −14 · 8 files · 2 commits · open

Build and game launch now work with dinit, OpenRC, runit, or an unavailable systemd user manager. A shared user-scope probe retains the existing systemd memory limits when available; otherwise the launchers run directly with a warning that the cgroup memory cap is unavailable. Setup no longer requires systemd-run, and restart skips systemctl when no scope was used. Optional sleep inhibition and the Wine namespace remain.

Integrated upstream’s new GPU memory guard: when explicitly enabled for a detected AMD GPU, it requires a working systemd user scope and systemctl; otherwise startup refuses with instructions instead of starting an ineffective guard. Normal launches without the guard keep the init-independent fallback.

Validation: eighteen game-free launcher checks pass in Git Bash, covering missing and unusable systemd, retained memory properties, arguments with spaces, environment, stdin, exit status, no retry after scope launch failure, Proton/Wine paths, optional inhibition, restart, duplicate-run rejection, and synthetic GPU guard cases (both guard names, explicit disabling, unusable scope, and missing systemctl). The original launchers fail the same harness with missing systemd-run (exit 127). Individual bash -n checks and git diff --check pass.

Actual Linux service managers and game runtime were not tested in this Windows environment.

Fixes #251.

**@⁠loyodea** on GitHub · 2026-12-03 17:08 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/337) `loyodea:fix/251-init-system-support` → `main` · +267 −14 · 8 files · 2 commits · open Build and game launch now work with dinit, OpenRC, runit, or an unavailable systemd user manager. A shared user-scope probe retains the existing systemd memory limits when available; otherwise the launchers run directly with a warning that the cgroup memory cap is unavailable. Setup no longer requires `systemd-run`, and restart skips `systemctl` when no scope was used. Optional sleep inhibition and the Wine namespace remain. Integrated upstream’s new GPU memory guard: when explicitly enabled for a detected AMD GPU, it requires a working systemd user scope and `systemctl`; otherwise startup refuses with instructions instead of starting an ineffective guard. Normal launches without the guard keep the init-independent fallback. Validation: eighteen game-free launcher checks pass in Git Bash, covering missing and unusable systemd, retained memory properties, arguments with spaces, environment, stdin, exit status, no retry after scope launch failure, Proton/Wine paths, optional inhibition, restart, duplicate-run rejection, and synthetic GPU guard cases (both guard names, explicit disabling, unusable scope, and missing `systemctl`). The original launchers fail the same harness with missing `systemd-run` (exit 127). Individual `bash -n` checks and `git diff --check` pass. Actual Linux service managers and game runtime were not tested in this Windows environment. Fixes #251.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-03 17:12:07 +00:00
Author
Owner

@⁠Luxuride on GitHub · 2026-12-04 12:02 UTC · original

This is the smallest, best-tested PR in this batch and the one I would take today: 267 lines, bash tests/launchers.sh covers ~20 fixture checks without a game, and the guard fails closed with a message that tells the user what to do.

One regression to fix before it lands: the single-run guard is lost with the scope. run.sh:40-46 detects an already-running session only by listing um-*.scope units, so on dinit/OpenRC/runit two runs can start at once — exactly the "Access denied (os error 5)" failure documented two lines above, where the second run's exit kills the first's wineserver. A pidfile/lockfile under $state/run belongs in this PR; it is the only regression a non-systemd user will actually hit.

Two smaller ones: scope is a bare global array (env.sh:61-70) consumed as "${scope[@]}" in build.sh:46, which set -u rejects on bash < 4.4 when it is empty — use ${scope[@]+"${scope[@]}"}. And it is worth saying in the body that the guard now hard-exits rather than running unguarded, so an APU user with VICTORY_GPU_GUARD=1 gets "not started" until they disable it.

On the competing implementation: this is the better base — clean merge, real harness — so the hand-attached cgroup approach would only be a follow-up if someone insists on keeping the cap without systemd.

**@⁠Luxuride** on GitHub · 2026-12-04 12:02 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/337#issuecomment-7410898035) This is the smallest, best-tested PR in this batch and the one I would take today: 267 lines, `bash tests/launchers.sh` covers ~20 fixture checks without a game, and the guard fails closed with a message that tells the user what to do. One regression to fix before it lands: the single-run guard is lost with the scope. `run.sh:40-46` detects an already-running session only by listing `um-*.scope` units, so on dinit/OpenRC/runit two runs can start at once — exactly the "Access denied (os error 5)" failure documented two lines above, where the second run's exit kills the first's wineserver. A pidfile/lockfile under `$state/run` belongs in this PR; it is the only regression a non-systemd user will actually hit. Two smaller ones: `scope` is a bare global array (`env.sh:61-70`) consumed as `"${scope[@]}"` in `build.sh:46`, which `set -u` rejects on bash < 4.4 when it is empty — use `${scope[@]+"${scope[@]}"}`. And it is worth saying in the body that the guard now hard-exits rather than running unguarded, so an APU user with `VICTORY_GPU_GUARD=1` gets "not started" until they disable it. On the competing implementation: this is the better base — clean merge, real harness — so the hand-attached cgroup approach would only be a follow-up if someone insists on keeping the cap without systemd.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/337/head:github-bot/gh-337'
git switch 'github-bot/gh-337'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-337'
git switch 'github-bot/gh-337'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-337'
git switch 'github-bot/gh-337'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-337'
git switch 'main'
git merge --squash 'github-bot/gh-337'
git switch 'main'
git merge --ff-only 'github-bot/gh-337'
git switch 'main'
git merge 'github-bot/gh-337'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.