diff --git a/scripts/uninstall.ps1 b/scripts/uninstall.ps1 index 16f309f687..eb059c763f 100644 --- a/scripts/uninstall.ps1 +++ b/scripts/uninstall.ps1 @@ -368,7 +368,11 @@ function Uninstall-UnslothStudio { try { $distros = @(((& wsl.exe --list --quiet 2>$null) -join "`n").Replace([char]0, '') -split "`r?`n" | ForEach-Object { $_.Trim() } | Where-Object { $_ }) foreach ($d in $distros) { - & wsl.exe -d $d -u root -- bash -lc 'pkill -9 -f "unsloth studio" 2>/dev/null; pkill -9 -f "llama-server" 2>/dev/null; rm -rf /root/.unsloth /home/*/.unsloth /root/llama-cuda 2>/dev/null; true' 2>$null + # IMPORTANT: rm runs FIRST. `pkill -f ""` matches this very + # bash -lc (its argv contains the pattern) and would SIGKILL the shell + # before a trailing rm could run. So remove files first (guaranteed), + # then best-effort kill: fuser by port (does not self-match) + pkill. + & wsl.exe -d $d -u root -- bash -lc 'rm -rf /root/.unsloth /home/*/.unsloth /root/llama-cuda /root/provision_llama_cuda.sh /root/llama_cuda_build.log 2>/dev/null; fuser -k 8888/tcp 2>/dev/null; pkill -9 -f unsloth_studio 2>/dev/null; pkill -9 -f llama-server 2>/dev/null; true' 2>$null if ($LASTEXITCODE -eq 0) { _Substep "cleaned Unsloth from WSL distro: $d" "Green" } } } catch { } diff --git a/scripts/uninstall.sh b/scripts/uninstall.sh index 699cff9d3c..d7cda3be96 100755 --- a/scripts/uninstall.sh +++ b/scripts/uninstall.sh @@ -209,6 +209,12 @@ _custom_studio_roots | while IFS= read -r _custom_root; do _remove_path "$_custom_root" done _remove_path "$HOME/.unsloth/studio" +# CUDA llama.cpp built by provision_llama_cuda.sh on native-Linux Spark/aarch64 +# (and the fetched provision script). On WSL ~/.unsloth/llama.cpp is a symlink to +# the real build, which install.ps1's uninstall removes; here rm -rf clears the +# native-Linux build dir / the symlink. +_remove_path "$HOME/.unsloth/llama.cpp" +_remove_path "$HOME/.unsloth/provision_llama_cuda.sh" _remove_path "$HOME/.local/share/unsloth" # CLI shim: only the symlink Studio created, never a pip-installed file. _remove_cli_shim