scripts: boot the loader under Wine or Proton from a checkout (LINUX-PROTON-DOCS-SCRIPTS) #1251

Closed
github-bot wants to merge 1 commit from gh-pr/1251/head into gh-pr/1251/base
Owner

@⁠Moriz82 on GitHub · 2026-11-24 20:52 UTC · original
split/linux-proton-docs-scripts → main · +293 −133 · 7 files · 1 commits · closed without merging

Claimed in the coordination issue as: LINUX-PROTON-DOCS-SCRIPTS (claim).

Part of the split of #984 into small pull requests.

Depends on: none

Overlaps: none found. docs/linux.md and the README's Running the loader on Linux cover the build and <out>/gta6rt.sh, and scripts/run_wine_session.sh runs the CI tests. This child adds the boot scripts of #984 and one page for them, and repeats neither.

What and why

scripts/linux-boot is for someone who boots the loader on Linux again and again while working on the runtime, straight from a checkout, and wants to know afterwards what happened:

  • configure-worktree.sh <checkout> configures the clang-cl and xwin cross-build in runtime/build/boot (SDL3_SRC makes it work offline).
  • boot.sh dry-run|init|run [seconds] starts the loader under Wine or Proton inside unshare -rn, a new user and network namespace that needs no root, so the title has no network at all. It sets the Vulkan backend and the shader library, moves NVIDIA's shader disk cache out of the way and raises its limit, and writes the startup and D3D12 traces with their tools/boot_trace.py summary.
  • run-boot.sh <name> <gta6rt.exe> [seconds] [KEY=VALUE ...] runs that as a systemd --user unit: it waits for memory headroom, holds a GPU lock and a build lock for the whole boot, samples RAM, swap, the unit's memory and VRAM every 2 s, and afterwards writes a digest (verdict, counts from the trace, captured frames, memory peaks, kernel OOM and GPU events, every distinct error line with its count). The digest is written also when the kernel or systemd-oomd killed the boot.

Everything the scripts produce goes to LEONIDA_BOOT_DIR, outside the repository. docs/linux_proton.md is the page, with one row in docs/README.md.

What changed against the scripts in #984

  • No fixed paths. The package, the shader library and the output folder come from LEONIDA_GAME_DIR, LEONIDA_SHADERS and LEONIDA_BOOT_DIR. A missing one is refused with one line before anything starts.
  • Only switches main has. The input script (#1074), the title's own window, the pipeline cache directory and checkpoints, the source-frame capture and the device-type default are gone from the scripts, and so are the digest counters for log lines that main does not print.
  • Two faults in the digest are fixed. It read the unit's result through tr -d "\x27", which GNU tr takes as the characters x, 2 and 7: a failed unit's result became 'eit-code', matched no case, and the verdict stayed OK. And the digest unit stopped waiting as soon as the boot unit began to deactivate, before systemd had logged the result. It now waits for the unit to end and also uses the loader's exit code.
  • One default Wine for both scripts (Proton Experimental's when Steam has it, else wine), and the page says in bold to use one Wine per prefix. In #984 boot.sh defaulted to wine and run-boot.sh to Proton. I made exactly that mistake while testing this child: one boot.sh run used the distribution's Wine 11.22 on the Proton prefix. A Proton prefix links to files inside the Proton installation, and the other Wine's prefix update wrote through those links: about 1,200 of Proton's own files were overwritten, and from then on every Proton start on this machine failed (its services could not create the device manager).
  • The Wine crash debugger is off (winedbg.exe=d). In that broken state, winedbg started for a crashing Wine service crashed as well and was started again for itself, about ten thousand times, until memory and swap were full. That happened twice before the cause was found. With the override a crashing process just ends; the loader's own trace still records the title's exceptions.
  • The page is cut down to what main does. #984's version was a test report of that branch: a boot timeline, three machines, the list of what the branch changes and where it stops. None of that holds for main, so none of it is here; it belongs with the children that bring those changes.
  • Not carried: the one line of runtime/test/xmem_test.cpp that the split map counted under this topic (it belongs to the xmem children), and the fork's own sync script.

Tested

CachyOS (Arch), kernel 7.3.5, Proton Experimental (Wine 11.0), Ryzen 5 5600X, 16 GB RAM, NVIDIA GeForce RTX 4070 12 GB (driver 620.73.04), clang-cl 23.1.5 with an xwin SDK, Ninja, ccache, bash 5, systemd user session. On main 6293c1c4f with this child:

SDL3_SRC=<SDL3 source tree> scripts/linux-boot/configure-worktree.sh .
cmake --build runtime/build/boot --target gta6rt -j6
export LEONIDA_GAME_DIR=<package> LEONIDA_SHADERS=<work>/shaders/spirv LEONIDA_BOOT_DIR=<scratch> WINEPREFIX=<boot prefix>
scripts/linux-boot/boot.sh dry-run
scripts/linux-boot/boot.sh init
scripts/linux-boot/run-boot.sh long runtime/build/boot/gta6rt.exe 60
scripts/linux-boot/run-boot.sh short runtime/build/boot/gta6rt.exe 3
python3 -I tests/test_linux_boot_scripts.py
  • Configure and build: both succeed (290 build steps, gta6rt.exe and gta6rt_tls_host.dll).
  • boot.sh dry-run and boot.sh init: exit 0, traces and summary written.
  • run-boot.sh with a 60 s limit: on main the title stops within seconds with an exception of its own, after creating its device, command queue, a descriptor heap and its first resources. The digest says EXITED WITH ERROR, unit result exit-code, and run-boot.sh exits 1. This was run several times while the scripts changed. The earlier runs stopped about 6 s in at a breakpoint exception (0x80000003). The run on the final tree stopped after 2 s with an access violation, but that run was made after the Proton installation had been damaged as described above, so it says nothing about main. Where main stops is not established here; what is checked is that the scripts report it.
  • run-boot.sh with a 3 s limit (before the damage and again on the final tree): the loader is stopped at the limit, the digest says OK (ran its full time limit), run-boot.sh exits 0. One line per boot is appended to boots.tsv.
  • Wrong input (no package folder, a missing loader, a missing gta6rt_tls_host.dll, a missing shader library, a name with a space, an unknown mode): each is refused with exit 2 and creates nothing.
  • tests/test_linux_boot_scripts.py (new): 3 tests pass. It checks that the five scripts parse (bash -n), are executable, have LF line endings, and refuse wrong input before they create a folder or start anything. With one check removed from boot.sh the test fails. It needs no Wine, no systemd unit and no game files, and skips itself outside Linux.
  • The standard-library and pytest files under tests/ the way ci.yml runs them: 521 files, 520 pass. tests/test_imhex_patterns.py fails, as it does on the base commit.
  • python3 -I scripts/check_no_game_data.py: passes.

Not run: any other distribution, plain Wine instead of Proton, an AMD or Intel GPU (the sampler's VRAM columns come from nvidia-smi and hold ? without it), a boot that reaches a picture (main does not get there on this machine), and a clean run of the KILLED BY OOM verdict (it appeared once, when the debugger incident above exhausted memory during a boot, but that path was not tested on purpose), and a boot on a repaired Proton installation after the final change (the final-tree boots ran in the damaged one). shellcheck is not installed on this machine; the scripts were checked with bash -n only. The translator suite was not run: no tool or runtime file changes.

GPUs tested: NVIDIA GeForce RTX 4070 (the scripts only start the loader; nothing here is GPU code).

AI-assisted: yes (Claude Code).

Checklist

  • Based on current main (6293c1c4f). One topic: scripts, their page and their test. No runtime or translator code.
  • No game data, no local paths. Traces, logs and digests are written outside the repository, and the page says to keep them local.
  • Nothing online: the title runs in a network namespace with no interfaces.

🤖 Generated with Claude Code

**@⁠Moriz82** on GitHub · 2026-11-24 20:52 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/1251) `split/linux-proton-docs-scripts` → `main` · +293 −133 · 7 files · 1 commits · closed without merging Claimed in the coordination issue as: LINUX-PROTON-DOCS-SCRIPTS ([claim](https://git.gtahub.st/github/ubiquitarianism--leonida/issues/14)). Part of the split of #984 into small pull requests. Depends on: none Overlaps: none found. `docs/linux.md` and the README's *Running the loader on Linux* cover the build and `<out>/gta6rt.sh`, and `scripts/run_wine_session.sh` runs the CI tests. This child adds the boot scripts of #984 and one page for them, and repeats neither. ### What and why `scripts/linux-boot` is for someone who boots the loader on Linux again and again while working on the runtime, straight from a checkout, and wants to know afterwards what happened: - `configure-worktree.sh <checkout>` configures the clang-cl and xwin cross-build in `runtime/build/boot` (`SDL3_SRC` makes it work offline). - `boot.sh dry-run|init|run [seconds]` starts the loader under Wine or Proton inside `unshare -rn`, a new user and network namespace that needs no root, so the title has no network at all. It sets the Vulkan backend and the shader library, moves NVIDIA's shader disk cache out of the way and raises its limit, and writes the startup and D3D12 traces with their `tools/boot_trace.py` summary. - `run-boot.sh <name> <gta6rt.exe> [seconds] [KEY=VALUE ...]` runs that as a `systemd --user` unit: it waits for memory headroom, holds a GPU lock and a build lock for the whole boot, samples RAM, swap, the unit's memory and VRAM every 2 s, and afterwards writes a digest (verdict, counts from the trace, captured frames, memory peaks, kernel OOM and GPU events, every distinct error line with its count). The digest is written also when the kernel or `systemd-oomd` killed the boot. Everything the scripts produce goes to `LEONIDA_BOOT_DIR`, outside the repository. `docs/linux_proton.md` is the page, with one row in `docs/README.md`. ### What changed against the scripts in #984 - **No fixed paths.** The package, the shader library and the output folder come from `LEONIDA_GAME_DIR`, `LEONIDA_SHADERS` and `LEONIDA_BOOT_DIR`. A missing one is refused with one line before anything starts. - **Only switches `main` has.** The input script (#1074), the title's own window, the pipeline cache directory and checkpoints, the source-frame capture and the device-type default are gone from the scripts, and so are the digest counters for log lines that `main` does not print. - **Two faults in the digest are fixed.** It read the unit's result through `tr -d "\x27"`, which GNU `tr` takes as the characters `x`, `2` and `7`: a failed unit's result became `'eit-code'`, matched no case, and the verdict stayed `OK`. And the digest unit stopped waiting as soon as the boot unit began to deactivate, before systemd had logged the result. It now waits for the unit to end and also uses the loader's exit code. - **One default Wine for both scripts** (Proton Experimental's when Steam has it, else `wine`), and the page says in bold to use one Wine per prefix. In #984 `boot.sh` defaulted to `wine` and `run-boot.sh` to Proton. I made exactly that mistake while testing this child: one `boot.sh` run used the distribution's Wine 11.22 on the Proton prefix. A Proton prefix links to files inside the Proton installation, and the other Wine's prefix update wrote through those links: about 1,200 of Proton's own files were overwritten, and from then on every Proton start on this machine failed (its services could not create the device manager). - **The Wine crash debugger is off** (`winedbg.exe=d`). In that broken state, `winedbg` started for a crashing Wine service crashed as well and was started again for itself, about ten thousand times, until memory and swap were full. That happened twice before the cause was found. With the override a crashing process just ends; the loader's own trace still records the title's exceptions. - **The page is cut down to what `main` does.** #984's version was a test report of that branch: a boot timeline, three machines, the list of what the branch changes and where it stops. None of that holds for `main`, so none of it is here; it belongs with the children that bring those changes. - **Not carried:** the one line of `runtime/test/xmem_test.cpp` that the split map counted under this topic (it belongs to the xmem children), and the fork's own sync script. ### Tested CachyOS (Arch), kernel 7.3.5, Proton Experimental (Wine 11.0), Ryzen 5 5600X, 16 GB RAM, NVIDIA GeForce RTX 4070 12 GB (driver 620.73.04), clang-cl 23.1.5 with an xwin SDK, Ninja, ccache, bash 5, systemd user session. On `main` `6293c1c4f` with this child: ```sh SDL3_SRC=<SDL3 source tree> scripts/linux-boot/configure-worktree.sh . cmake --build runtime/build/boot --target gta6rt -j6 export LEONIDA_GAME_DIR=<package> LEONIDA_SHADERS=<work>/shaders/spirv LEONIDA_BOOT_DIR=<scratch> WINEPREFIX=<boot prefix> scripts/linux-boot/boot.sh dry-run scripts/linux-boot/boot.sh init scripts/linux-boot/run-boot.sh long runtime/build/boot/gta6rt.exe 60 scripts/linux-boot/run-boot.sh short runtime/build/boot/gta6rt.exe 3 python3 -I tests/test_linux_boot_scripts.py ``` - Configure and build: both succeed (290 build steps, `gta6rt.exe` and `gta6rt_tls_host.dll`). - `boot.sh dry-run` and `boot.sh init`: exit 0, traces and summary written. - `run-boot.sh` with a 60 s limit: on `main` the title stops within seconds with an exception of its own, after creating its device, command queue, a descriptor heap and its first resources. The digest says `EXITED WITH ERROR`, unit result `exit-code`, and `run-boot.sh` exits 1. This was run several times while the scripts changed. The earlier runs stopped about 6 s in at a breakpoint exception (`0x80000003`). The run on the final tree stopped after 2 s with an access violation, but that run was made after the Proton installation had been damaged as described above, so it says nothing about `main`. Where `main` stops is not established here; what is checked is that the scripts report it. - `run-boot.sh` with a 3 s limit (before the damage and again on the final tree): the loader is stopped at the limit, the digest says `OK (ran its full time limit)`, `run-boot.sh` exits 0. One line per boot is appended to `boots.tsv`. - Wrong input (no package folder, a missing loader, a missing `gta6rt_tls_host.dll`, a missing shader library, a name with a space, an unknown mode): each is refused with exit 2 and creates nothing. - `tests/test_linux_boot_scripts.py` (new): 3 tests pass. It checks that the five scripts parse (`bash -n`), are executable, have LF line endings, and refuse wrong input before they create a folder or start anything. With one check removed from `boot.sh` the test fails. It needs no Wine, no systemd unit and no game files, and skips itself outside Linux. - The standard-library and pytest files under `tests/` the way `ci.yml` runs them: 521 files, 520 pass. `tests/test_imhex_patterns.py` fails, as it does on the base commit. - `python3 -I scripts/check_no_game_data.py`: passes. Not run: any other distribution, plain Wine instead of Proton, an AMD or Intel GPU (the sampler's VRAM columns come from `nvidia-smi` and hold `?` without it), a boot that reaches a picture (`main` does not get there on this machine), and a clean run of the `KILLED BY OOM` verdict (it appeared once, when the debugger incident above exhausted memory during a boot, but that path was not tested on purpose), and a boot on a repaired Proton installation after the final change (the final-tree boots ran in the damaged one). `shellcheck` is not installed on this machine; the scripts were checked with `bash -n` only. The translator suite was not run: no tool or runtime file changes. GPUs tested: NVIDIA GeForce RTX 4070 (the scripts only start the loader; nothing here is GPU code). AI-assisted: yes (Claude Code). ### Checklist - [x] Based on current `main` (`6293c1c4f`). One topic: scripts, their page and their test. No runtime or translator code. - [x] No game data, no local paths. Traces, logs and digests are written outside the repository, and the page says to keep them local. - [x] Nothing online: the title runs in a network namespace with no interfaces. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
scripts/linux-boot holds five scripts for booting gta6rt on Linux again and
again while working on the runtime: configure-worktree.sh (the clang-cl and
xwin cross-build), boot.sh (dry-run, init or run, with the network off in a
user and network namespace), and run-boot.sh with boot-inner.sh and
boot-digest.sh (a systemd --user unit that waits for memory, holds a GPU
lock and a build lock, samples memory and VRAM, and writes a digest of how
the boot ended). docs/linux_proton.md describes them.

They are the scripts of integration #984 made portable: no fixed paths
(LEONIDA_GAME_DIR, LEONIDA_SHADERS, LEONIDA_BOOT_DIR), only switches that
main has, one default Wine for both scripts, the Wine crash debugger off
(it started itself again without end when a Wine service crashed), and
a digest that no longer reports a failed boot as OK.

Run on main 6293c1c4f under Proton Experimental on an RTX 4070: configure
and build, dry-run and init (exit 0), and run-boot.sh with a 60 s limit
(the title stops within seconds with an exception of its own: verdict
EXITED WITH ERROR), a 3 s limit (verdict OK) and wrong input (refused).
tests/test_linux_boot_scripts.py covers parsing and the refusals without
Wine.

AI-assisted (Claude Code).

Co-authored-by: Plaaasma <[email protected]>
Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:44:31 +00:00
github-bot closed this pull request 2026-11-26 09:44:31 +00:00

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.