001: Runner and Prefix Management¶
- Status: Developed
- Date: 2026-12-02
- Author(s): João V. Farias
- Traces to: ADR-006 Categories 2 and 3
Context¶
Linux distributions package inconsistent Wine releases and frequently omit 32-bit multilib libraries. Because of that mismatch, Windows toolchains fail unpredictably across developer machines and CI images. winesmith standardizes Wine and Proton acquisition alongside isolated and shared Windows 7, 10, and 11 prefixes.
Benchmark¶
Two reference approaches shaped the design of runner downloads and prefix scoping:
- Bottles and Lutris download portable Wine builds effectively, yet bind workflows to desktop GUIs without lockfile digests, headless CLI flags, or spec-hashed prefix sharing.
- Modern package tools such as
rustupanduvstore pinned binaries under local XDG caches without touching global distro packages, andwinesmithfollows that model for Wine runners and prefixes.
Interaction flow¶
Runner resolution and prefix initialization follow eight sequential steps:
- Merge
[runner],[windows], and[prefix]settings across configuration layers. - Select the pinned Kron4ek Wine 10
staging-amd64-wow64release when[runner]is omitted. - Check
$XDG_DATA_HOME/winesmith/runners/for portablekron4ekorge-protonbuilds, downloading missing archives to$XDG_CACHE_HOME/winesmith/downloads/, checking SHA-256 or SHA-512 checksums, and unpacking atomically. - Resolve
systemWine or Steamprotonrunners from hostPATH, explicitwine:/proton:paths, or Steamlibraryfolders.vdfmanifests. - Derive the target prefix directory under
$XDG_DATA_HOME/winesmith/prefixes/, using explicit[prefix].nameor a spec hash undersharedmode and a project-path hash underisolatedmode. - Acquire an exclusive
fs4advisory lock on<prefix>/.winesmith.lock. - Boot the prefix with
WINEDLLOVERRIDES="mscoree,mshtml="to block Mono and Gecko installers, runwinecfg -v <win7|win10|win11>, and disable crash dialogs (ShowCrashDialog = 0). Then createdosdevices/mounts anddrive_csymlinks and writewinesmith-state.json. - Compare desired settings against
winesmith-state.jsonon later runs, reconciling safe drift (mounts,symlinks, Windows version, registry entries) in place and blocking breaking architecture or Proton layout changes until--reinstallis passed.
Visual design¶
This state diagram outlines how winesmith handles missing runners, prefix locks, first-time boot, and drift reconciliation:
stateDiagram-v2
[*] --> ResolveRunner
ResolveRunner --> DownloadVerify: Portable missing
ResolveRunner --> AcquireLock: Runner ready
DownloadVerify --> AcquireLock: Checksum verified
AcquireLock --> BootPrefix: Prefix missing
AcquireLock --> CheckDrift: winesmith-state.json exists
BootPrefix --> ConfigureWindows: Apply win7/win10/win11 and suppress dialogs
CheckDrift --> ConfigureWindows: Safe drift detected
CheckDrift --> Ready: State matches
ConfigureWindows --> ApplyMounts: Apply mounts, symlinks, overrides
ApplyMounts --> WriteState
WriteState --> Ready
Ready --> [*]
Implementation¶
Manifest configuration fields¶
Projects configure Windows version, runner backend, prefix mode, drive mounts, and symlinks inside winesmith.toml:
[windows]
version = "win10" # "win7" | "win10" | "win11"
arch = "win64" # "win64" | "win32"
display = "none" # "none" | "xvfb" | "host"
wineserver_persist_secs = 30
[runner]
kind = "kron4ek" # "kron4ek" | "system" | "proton" | "ge-proton"
version = "10.0-staging-amd64-wow64" # or "10.0-staging-amd64" for multiarch win32
[prefix]
mode = "shared" # "shared" | "isolated"
# name = "neorune-net10"
[mounts]
w = "."
[symlinks]
"users/steamuser/AppData/Local/App/Saved" = "/path/on/host/Saved"
Edge cases and constraints¶
Three runtime details keep Wine and Proton prefixes consistent and safe under retries:
- Proton places
drive_cinside<prefix>/pfx/drive_cand requiresSTEAM_COMPAT_CLIENT_INSTALL_PATHplusSTEAM_COMPAT_DATA_PATH, soRunnerLayoutandPreparedPrefixnormalize user profile and drive paths across vanilla Wine and Proton. - Kron4ek
staging-amd64-wow64runs 32-bit Windows binaries inside a 64-bit prefix without host 32-bit multilib libraries, whereas legacyWINEARCH=win32setups require a multiarch Kron4ek build (staging-amd64),systemWine, or Proton. - Downloads stream into temporary
.partfiles and move into$XDG_CACHE_HOME/winesmith/downloads/only after hash checks pass, removing partial files when verification fails.