Fix the Windows VM refusing to start after its first launch - #10338
Open
shilai-li wants to merge 1 commit into
Open
Fix the Windows VM refusing to start after its first launch#10338shilai-li wants to merge 1 commit into
shilai-li wants to merge 1 commit into
Conversation
The VM would install and run once, then fail every subsequent launch with "Failed to start Windows VM!" and no further explanation. prepare_caller_mounts hardens both bind sources to 0700 and then verifies they are exactly 700. The container's Samba layer chmods the shared folder to 2777 so it can serve it to the guest, and that lands on the caller's ~/Windows through the bind. Numeric modes below 010000 leave a directory's setuid and setgid bits untouched, so the hardening step turned 2777 into 2700 rather than 700 and the verification below it then rejected the source the script had just tried to fix. The first launch worked because Samba had not dirtied the folder yet; every launch after it failed. Spell both chmods symbolically with an explicit a-s so the hardening can actually reach the state its own check demands, and say something on the way out of the two silent exits, which is why this presented as a launcher that did nothing at all.
This was referenced Sep 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The Windows VM installs and runs once, then every launch after that fails with:
Launched from the app icon,
windows-vm.desktophasTerminal=false, so even that message goes nowhere — clicking Windows does nothing at all, with no notification and nothing in the journal beyond the scope starting and exiting.Cause
prepare_caller_mountshardens both bind sources to0700and then verifies they are exactly700(bin/omarchy-windows-vm:583):The container's Samba layer chmods the shared folder to
2777so it can serve it to the guest (chmod 2777 "$dir"in/run/samba.shindockurr/windows)./sharedis a bind of the caller's~/Windows, so that setgid bit lands on the host directory.A numeric mode below
010000leaves a directory's setuid and setgid bits untouched. So the hardening step turns2777into2700rather than700, and the check immediately below it then rejects the source the script has just tried to fix. On coreutils 9.11:The first launch works because Samba has not dirtied the folder yet. Every launch after it fails, and it fails before reaching Docker at all, which is why nothing shows up in
docker ps -aor the daemon log.prepare_user_mount_sourceshardens the same two directories on the install path (:1018) and has the same defect.Fix
Spell both chmods
u=rwx,go=,a-sso the hardening can actually reach the state its own check demands.chmod 00700also works, but only because the GNU carve-out keys on the length of the octal string rather than its value — it reads like a typo and invites being "cleaned up" straight back into the bug, so the symbolic form seemed worth the few extra characters.Also give the two silent
return 1exits something to say. The mode check is still worth keeping as defence in depth: it now catches a source on a filesystem that ignoreschmodrather than failing mute.Verification
On an affected machine,
~/Windowsat2700going in, running the privileged bring-up directly:~/Windowsafter/usr/bin/omarchy-windows-vm1(silent, 5s, never reaches Docker)27000700Full launch cycle through the app icon then works repeatedly, where before it succeeded exactly once per fresh install.
test/shellrun before and after: 6 pre-existing failures, identical with and without this change (bar-icon-geometry,bin-style,config,snapper,unowned-system-paths,windows-vm-mount-boundary).Worth a separate look:
windows-vm-mount-boundary-test.shcannot pass on a machine where the VM has been launched since boot. It builds a fake uid-1000 home underunshare --user --mount, but that namespace inherits the real binds at/var/lib/omarchy/windows/mounts/users/1000/*, which point at the actual home, somounted_leaf_matchesrejects them. Mounts inherited into a user namespace are locked, so the test cannot unmount them to isolate itself either. Not touched here.🤖 Generated with Claude Code
https://claude.ai/code/session_01WB1hMW2yRN5tHRsVKon9UG