Repository navigation
fork fleet: Windows starter for a desk pool (D9) - #229
scuttletoby wants to merge 7 commits into
Conversation
374ba43 to
9336f15
Compare
f061484 to
e554ddf
Compare
start-desk.ps1 sets up a WSL2 distro for the desk kit from Windows PowerShell 5.1: a memory and swap cap in .wslconfig, NAT, the WSL2 walls' settings inside the distro, the packages, the machine file, then the desk kit's bootstrap from one release commit, a logon task that keeps the distro running, and a PASS/FAIL check. -Uninstall removes it. Every step skips what is already right; WSL restarts only on a change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
9336f15 to
04a398d
Compare
e554ddf to
3a91ca2
Compare
|
Review round 1 at 3a91ca2 (lens229, correctness and safety): SAFE WITH NITS. Fix round to follow. Holds: asks before changing anything; Repo/Sha/Distro pattern-checked;
|
- .wslconfig is read and written as UTF-8 without a BOM (never ASCII), by a temp file and a rename, with a dated backup; only [wsl2] keys are judged - the restart decision reads the live state (PID 1, interop, wsl.conf newer than boot, memory, networking mode, .wslconfig newer than the boot) - a distro the starter did not make is named and must be typed to take over - MemoryGB above the PC's RAM less 2 GB is refused - exit 1 on a failed check; -Uninstall needs no -Repo/-Sha; UNC paths work Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… flag (D9) The text check that no ASCII encoding is left matched the comment that explains the bug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fix round 1 (commits 3e3e314, a884923; D8's round 1 merged in; head a884923). Tests:
Fails before the fix: the new test file against the round-0 starter: the three MUST tests above fail (1 failure, 2 errors), and the asks-first test. a884923 rewords a comment that the no-ASCII text check matched. PR body updated. Still draft. |
|
Re-check lens 229 r1 at a884923: SAFE WITH NITS Earlier findings: 1 ASCII New:
|
… marks) (D9) - wsl --install with --version 2; a WSL 1 distro (wsl -l -v) is refused before the question and before any restart, a new one is checked after the install. - -MachineFile and -FleetConfig are tested before the first question; -Sha is matched case-sensitively; a PC too small for the default cap gets its own message. - A Windows-side mark for an owed wsl --shutdown (written before .wslconfig changes, removed after the shutdown: uptime skips sleep) and for a distro this script is installing (no takeover question after a stop); a failed first start names wsl --unregister. - A live check for Windows drives mounted under /mnt. - -Uninstall stops the logon task before removing it and names the first .wslconfig.bak-*. - The live tests put a wslinfo that answers nat first on PATH. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Fix round 2 at e88ff71 (merge of D8 round 2, then one commit) Lens 229 r1:
State question: runs again (marks absent after a full run; WSL 2 check reads only), stops half-way (owed-restart mark before the write, install mark before Red-check: the new test file against the round-1 starter: 4 fail (WSL 1, inputs first, marks and uninstall order, mounted drive). Head: windows.test.py 16 OK (2 skipped, no pwsh); install.test.py 33 OK. |
Row D9 of the desktop pool plan: a Windows starter that turns a Windows PC into a desk pool desktop through one WSL2 distro, and runs the D8 setup pack inside it. Stacked on #225 (D8).
Why
A Windows desktop needs a few steps on the Windows side before the desk kit can run: a WSL2 distro, a memory cap so CI never takes the whole PC, NAT, and the distro settings the WSL2 walls require. Without a script these steps are easy to get wrong, and the walls then refuse the machine.
fork-kit/desk/windows/start-desk.ps1runs in a normal (not administrator) Windows PowerShell 5.1 window. It:-FleetConfigexist and refuses a WSL 1 distro of that name (wsl -l -v); a distro of that name it did not make isnamed in the prompt, and its name must be typed to take it over (its
wsl.confis replaced)-Distro, defaultfork-desk, Ubuntu 24.04,wsl --install ... --version 2, checked after)[wsl2]memory cap in.wslconfig(-MemoryGB; the default is three quarters of the RAM, at most theRAM less 6 GB, never under 4 GB; a value that leaves Windows under 2 GB is refused), plus swap, NAT and DNS
tunnelling. It reads and writes the file as UTF-8 without a BOM (never ASCII), through a temp file and a rename,
keeps a dated copy of the old file, and keys it does not set stay as they were.
resolv.confof its own, and WSL's binfmt handler maskedwsl --shutdown, and only when the live state differs: PID 1 is not systemd, Windows interop is stillthere, Windows drives are mounted,
wsl.confor.wslconfigis newer than the distro's boot, the memory cap ornetworking mode in force is not the one asked for, or a
.wslconfigchange still owes its shutdown (a mark in%LOCALAPPDATA%\fork-desk, written before the change and removed after the shutdown: WSL's uptime skips sleep)-FleetConfig), and runs the desk kit's bootstrap from one release commitdesk-install checkand its own PASS/FAIL lines, and exits 1 when any fails-Uninstall(no-Repo/-Shaneeded) runsdesk-install uninstallin the distro, stops and removes the logon task, and names the first.wslconfig.bak-*. It leaves the distro and.wslconfigin place.What happens when this runs again, stops half-way, or meets existing, old or empty state?
.wslconfigand the distro settings are rewritten only on a change. WSL is shut down only when the live state is not yet right. D8's installer is idempotent. A test runs the in-distro part twice and the second run changes nothing.wsl.confand the copied-in files are written toX.newand then renamed, so a stop never leaves a half file. A stop between removing WSL'sresolv.conflink and writing the new file leaves noresolv.conf, and the next run writes it. A new run redoes whatever is not yet right. A stop beforewsl --shutdownis seen by the next run from the live state (interop still there,wsl.confnewer than the boot) or from the owed-restart mark, so that run shuts WSL down. A stop insidewsl --installleaves a mark, so the next run asks no takeover question; a broken registration fails its first start with awsl --unregisterhint..wslconfigkeeps its other keys, and a dated copy is kept. An existing distro of the same name that the starter did not make is named and taken over only when its name is typed. Aresolv.confthe distro already owns is kept (tested). A foreign desk install inside the distro is refused by D8.-Uninstallrunsdesk-install uninstallonly when the distro exists and the installer is there, and removing a logon task that is not there is not an error.General vs project
General. No project, person or machine is named. The repo, release sha, machine file and fleet config are all arguments.
Upstream fit
Only the fork-only
fork-kit/desk/folder and the fork CI test list change. Nothing in upstream T3 changes.Tests
fork-kit/desk/tests/windows.test.py(listed in.github/fork-ci-tests.txt) runs without Windows:the in-distro part runs on a fake root, and the real WSL2 walls (
fork-fleet-walls/wsl2) then pass. A second run changes nothing.an empty distro
a
resolv.confof its own is keptWindows PowerShell 5.1 can read the script: ASCII only, no tabs, brackets balanced. With
pwshon PATH, it is also parsed for real.it asks before any change
text piped into the distro ends in a comment line, so the CR that PowerShell adds is harmless, and there are no quotes inside native arguments
the kit it runs is this repository's
fork-kit/desk/bootstrap.shround 1: the
.wslconfigmerge keeps every other key and non-ASCII letter (run underpwshwhen it is on PATH,skipped otherwise), a text check that no ASCII encoding is left, the live-state restart decision (its shell part
run on fake
/procstates), and a distro it did not make is named and must be typedround 2: WSL 1 refused before the question and any restart and a new distro installed as WSL 2 (text order), the
inputs checked before the question and
-Shacase-sensitive, the restart and install marks (text order), a mountedWindows drive restarts (shell part on a fake
/proc/mounts), and thewsl -l -vparser (underpwsh, skippedotherwise). The live tests put a
wslinfothat answersnatfirst on PATH.Local run (Python 3.12, no pwsh here, so the pwsh steps were skipped):
python3 -I -B -W error::ResourceWarning fork-kit/desk/tests/windows.test.py: 16 tests, OK (2 skipped: thepwshruns);install.test.py33 OK after D8's round 2 merged in.Not covered by a test: nothing fakes
wsl.exefor the PowerShell flow itself (nopwshhere), so the order of thetakeover, the marks and the shutdown is checked as text only.
Red-checks
Each rule was broken in a copy, one at a time, and the named test failed (all 4 red):
wsl.conf->test_the_wsl2_walls_pass_after_it_and_a_second_run_changes_nothingresolv.confof the owner's own overwritten ->test_a_resolv_conf_of_its_own_is_kepttest_the_wsl2_walls_pass_after_it_and_a_second_run_changes_nothingRound 1: the new test file run against the round-0 starter: the three MUST tests fail (
.wslconfigencoding, thelive-state restart decision, the takeover prompt), plus
test_it_asks_before_it_changes_anything(it now looks forthe merge call). The
pwshmerge test was skipped here and runs in CI.Round 2: the new test file run against the round-1 starter: 4 fail (WSL 1 /
--version 2, inputs before thequestion, the marks and uninstall order, a mounted Windows drive).
🤖 Generated with Claude Code