igneum/relay/playbooks/wsl-setup.ps1
igneum-labs 53f7f55796 Relay: text, files and runnable tasks between the Mac, the PCs and the phone (relay.igneum.network)
New Vercel project igneum-relay from relay/: one function (api/relay.mjs) over Neon tables relay_items and relay_machines,
files in Vercel Blob store igneum-relay (50 MB client uploads, 4 MB through the function), phone-first web page at /r/<token>/
with the site tokens. Mac CLI tools/relay.mjs (feed, read, drop, task, run, watch, inbox, machines, role, name).
Windows clients send.bat/send.ps1 and the igneum-agent (registers hostname, role, GPUs, WSL, nvcc; runs queued PowerShell
scripts, posts results, reboot-continue via scheduled task + RunOnce), bash twins send.sh and agent.sh (verified live),
playbooks for WSL setup, prover setup, prove-block, miner v4, one-click placeholder. make-clients.sh bakes the secrets
into a zip; the repo copies hold placeholders. Screenshots under docs/design/relay.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 10:04:30 +00:00

56 lines
3.5 KiB
PowerShell

# Igneum playbook: WSL2 + Ubuntu 24.04 with a ready `igneum` user, no questions asked. Two passes around one reboot.
# Queue from the Mac: node tools/relay.mjs run PC2 "wsl setup" relay/playbooks/wsl-setup.ps1 --elevated --reboot-continue
# Pass 1: hypervisor on, VirtualMachinePlatform + WSL features, prints RELAY-REBOOT (the agent reboots and re-arms).
# Pass 2: wsl --install Ubuntu-24.04 --no-launch, creates the user igneum (password igneum, sudo without a password),
# makes it the default, checks the GPU is visible inside WSL.
# UNTESTED on a PC as of 4 Oct 2026: written from the wsl.exe and dism.exe documentation; expect a first-run fix.
$ErrorActionPreference = 'Continue'
$distro = 'Ubuntu-24.04'
$pass = 1; if ($env:RELAY_PASS) { $pass = [int]$env:RELAY_PASS }
$markerDir = Join-Path $env:ProgramData 'igneum'; New-Item -ItemType Directory -Force -Path $markerDir | Out-Null
$marker = Join-Path $markerDir 'wsl-setup.pass1'
function Strip([string] $s) { if ($null -eq $s) { return '' }; return ($s -replace "`0", '') }
Write-Host "wsl-setup pass $pass on $env:COMPUTERNAME"
$installed = $false
try { $list = Strip (((& wsl.exe --list --quiet 2>&1) | Out-String)); if ($list -match 'Ubuntu-24\.04') { $installed = $true } } catch {}
if ($pass -le 1 -and -not (Test-Path $marker) -and -not $installed) {
Write-Host 'pass 1: hypervisor + features'
& bcdedit.exe /set hypervisorlaunchtype auto
& dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
& dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
Set-Content -Path $marker -Value (Get-Date -Format o)
Write-Host 'features enabled; a restart is needed before Ubuntu can be installed'
Write-Host 'RELAY-REBOOT'
exit 0
}
Write-Host 'pass 2: WSL kernel, Ubuntu 24.04, the igneum user'
& wsl.exe --update 2>&1 | ForEach-Object { Strip "$_" }
& wsl.exe --set-default-version 2 2>&1 | ForEach-Object { Strip "$_" }
if (-not $installed) {
& wsl.exe --install -d $distro --no-launch 2>&1 | ForEach-Object { Strip "$_" }
Start-Sleep 5
}
$list = Strip (((& wsl.exe --list --verbose 2>&1) | Out-String)); Write-Host $list
if ($list -notmatch 'Ubuntu-24\.04') { Write-Host "ERROR: $distro is not registered after the install"; exit 2 }
$mk = 'id igneum >/dev/null 2>&1 || (useradd -m -s /bin/bash igneum && echo igneum:igneum | chpasswd && usermod -aG sudo igneum); ' +
'echo "igneum ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/igneum && chmod 440 /etc/sudoers.d/igneum; ' +
'printf "[user]\ndefault=igneum\n[boot]\nsystemd=true\n" > /etc/wsl.conf; id igneum'
& wsl.exe -d $distro -u root -- bash -c $mk 2>&1 | ForEach-Object { Strip "$_" }
& wsl.exe --terminate $distro 2>&1 | Out-Null
$wslconfig = Join-Path $env:USERPROFILE '.wslconfig'
if (-not (Test-Path $wslconfig)) {
$ramGb = [math]::Floor((Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB)
$give = [math]::Max(16, [math]::Floor($ramGb * 0.75))
"[wsl2]`nmemory=${give}GB`nswap=16GB`n" | Set-Content -Path $wslconfig -Encoding ascii
Write-Host "wrote $wslconfig (memory=${give}GB of $ramGb GB)"
& wsl.exe --shutdown 2>&1 | Out-Null
}
Write-Host 'check: user, kernel, GPU inside WSL'
& wsl.exe -d $distro -- bash -lc 'id; uname -r; nvidia-smi --query-gpu=name,driver_version --format=csv,noheader 2>/dev/null || ls -l /usr/lib/wsl/lib/libcuda.so.1 2>/dev/null || echo "no GPU visible inside WSL (update the Windows NVIDIA driver, then wsl --update)"' 2>&1 | ForEach-Object { Strip "$_" }
Write-Host 'wsl-setup done'
exit 0