[PR #324] [MERGED] steam-fedora: stop migration loop wiping login state every boot #306

Closed
opened 2026-10-15 12:50:43 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/gow/pull/324
Author: @JBailes
Created: 4/25/2026
Status: ✅ Merged
Merged: 4/29/2026
Merged by: @ABeltramo

Base: master ← Head: fix/steam-fedora-migration-loop


📝 Commits (1)

  • 1439faa steam-fedora: stop migration loop that wiped login state every boot

📊 Changes

2 files changed (+29 additions, -11 deletions)

View changed files

📝 apps/steam/build-fedora/scripts/steam.sh (+14 -2)
📝 apps/steam/build-fedora/scripts/system-services.sh (+15 -9)

📄 Description

Summary

Fixes the fedora Steam image bug where every container restart asked for a fresh login and shuffled steamapps between locations (reported in Discord by Артём; touches the same area as #323).

Two interacting bugs:

  1. steam.sh (wrapper) pre-created ~/.steam/steam as a real directory, then called ln -sfn $STEAMDIR $STEAMDIR_LEGACY. Against an existing real directory, ln -s (even with -fn) cannot replace it and silently creates the link inside as ~/.steam/steam/Steam. The legacy path therefore remained a real directory forever.
  2. system-services.sh (migration) guarded only on [ ! -h $STEAMDIR_LEGACY ]. Because of (1) that test was always true, so the migration fired every boot:
    • rm -rf $STEAMDIR wiped the previous boot's .local/share/Steam (login state, steam.sh, any data).
    • mv $STEAMDIR_LEGACY $STEAMDIR moved the just-recreated broken-shape directory into place.
    • rm -rf ~/.steam finished the cycle. Next boot, the wrapper's if [[ ! -f $STEAMDIR/steam.sh ]] was true again (we just deleted it), and the loop restarted.

The Ubuntu image is unaffected; only apps/steam/build-fedora/scripts/ is touched.

Changes

  • steam.sh: only mkdir -p the parent of STEAMDIR_LEGACY. Replace an empty or missing target with a symlink; refuse to clobber a non-empty real directory and emit a warning so already-broken profiles can be inspected manually rather than re-broken.
  • system-services.sh: tighten the migration guard to require (a) legacy is a real directory not a symlink, (b) it actually has steamapps/, (c) the new location does not. Switch from rm -rf $STEAMDIR; mv $STEAMDIR_LEGACY $STEAMDIR to cp -aT + cleanup so a bind-mounted $STEAMDIR survives and we never destructively wipe an already-populated new location.

Behavior matrix

Starting state Before After
Fresh fedora profile broken-shape .steam/steam/Steam symlink, login wiped each restart proper .steam/steam -> .local/share/Steam symlink, login persists
Ubuntu legacy with games in .steam/steam/steamapps migrates once, then loops and wipes on every restart migrates once, idempotent thereafter
Already in the broken loop (both locations populated) continues looping migration skips (target non-empty); wrapper warns and does not re-create the broken nested link
$STEAMDIR bind-mounted to host rm -rf $STEAMDIR + mv would corrupt mount cp -aT preserves mount semantics

Test plan

  • Fresh fedora profile: launch, sign in, install a game, restart container twice — login and game survive, ~/.steam/steam is a symlink.
  • Simulated Ubuntu legacy: pre-seed ~/.steam/steam/steamapps/<game>, launch — game appears in new location, ~/.steam is gone, second restart does not re-migrate.
  • Profile already in broken loop (real ~/.steam/steam dir with games + populated .local/share/Steam): launch — warning logged, no further data shuffling.
  • Bind-mounted ~/.local/share/Steam from host: legacy migration leaves the mount intact.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/games-on-whales/gow/pull/324 **Author:** [@JBailes](https://github.com/JBailes) **Created:** 4/25/2026 **Status:** ✅ Merged **Merged:** 4/29/2026 **Merged by:** [@ABeltramo](https://github.com/ABeltramo) **Base:** `master` ← **Head:** `fix/steam-fedora-migration-loop` --- ### 📝 Commits (1) - [`1439faa`](https://github.com/games-on-whales/gow/commit/1439faa22a4da5ff6b4f874a597ff73d2a922b71) steam-fedora: stop migration loop that wiped login state every boot ### 📊 Changes **2 files changed** (+29 additions, -11 deletions) <details> <summary>View changed files</summary> 📝 `apps/steam/build-fedora/scripts/steam.sh` (+14 -2) 📝 `apps/steam/build-fedora/scripts/system-services.sh` (+15 -9) </details> ### 📄 Description ## Summary Fixes the fedora Steam image bug where every container restart asked for a fresh login and shuffled `steamapps` between locations (reported in Discord by Артём; touches the same area as #323). Two interacting bugs: 1. **`steam.sh` (wrapper)** pre-created `~/.steam/steam` as a real directory, then called `ln -sfn $STEAMDIR $STEAMDIR_LEGACY`. Against an existing real directory, `ln -s` (even with `-fn`) cannot replace it and silently creates the link _inside_ as `~/.steam/steam/Steam`. The legacy path therefore remained a real directory forever. 2. **`system-services.sh` (migration)** guarded only on `[ ! -h $STEAMDIR_LEGACY ]`. Because of (1) that test was always true, so the migration fired every boot: - `rm -rf $STEAMDIR` wiped the previous boot's `.local/share/Steam` (login state, `steam.sh`, any data). - `mv $STEAMDIR_LEGACY $STEAMDIR` moved the just-recreated broken-shape directory into place. - `rm -rf ~/.steam` finished the cycle. Next boot, the wrapper's `if [[ ! -f $STEAMDIR/steam.sh ]]` was true again (we just deleted it), and the loop restarted. The Ubuntu image is unaffected; only `apps/steam/build-fedora/scripts/` is touched. ### Changes - **`steam.sh`**: only `mkdir -p` the _parent_ of `STEAMDIR_LEGACY`. Replace an empty or missing target with a symlink; refuse to clobber a non-empty real directory and emit a warning so already-broken profiles can be inspected manually rather than re-broken. - **`system-services.sh`**: tighten the migration guard to require (a) legacy is a real directory not a symlink, (b) it actually has `steamapps/`, (c) the new location does not. Switch from `rm -rf $STEAMDIR; mv $STEAMDIR_LEGACY $STEAMDIR` to `cp -aT` + cleanup so a bind-mounted `$STEAMDIR` survives and we never destructively wipe an already-populated new location. ### Behavior matrix | Starting state | Before | After | | --- | --- | --- | | Fresh fedora profile | broken-shape `.steam/steam/Steam` symlink, login wiped each restart | proper `.steam/steam -> .local/share/Steam` symlink, login persists | | Ubuntu legacy with games in `.steam/steam/steamapps` | migrates once, then loops and wipes on every restart | migrates once, idempotent thereafter | | Already in the broken loop (both locations populated) | continues looping | migration skips (target non-empty); wrapper warns and does not re-create the broken nested link | | `$STEAMDIR` bind-mounted to host | `rm -rf $STEAMDIR` + `mv` would corrupt mount | `cp -aT` preserves mount semantics | ## Test plan - [ ] Fresh fedora profile: launch, sign in, install a game, restart container twice — login and game survive, `~/.steam/steam` is a symlink. - [ ] Simulated Ubuntu legacy: pre-seed `~/.steam/steam/steamapps/<game>`, launch — game appears in new location, `~/.steam` is gone, second restart does not re-migrate. - [ ] Profile already in broken loop (real `~/.steam/steam` dir with games + populated `.local/share/Steam`): launch — warning logged, no further data shuffling. - [ ] Bind-mounted `~/.local/share/Steam` from host: legacy migration leaves the mount intact. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 12:50:43 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/gow#306
No description provided.