omarchy icon indicating copy to clipboard operation
omarchy copied to clipboard

omarchy windows vm launch: RDP connects before Windows has booted, then auto-stops the VM

Open rogerfsh opened this issue 2 weeks ago • 2 comments

What happened

On a cold start, omarchy windows vm launch reports the VM ready and starts xfreerdp3 about one second later. The connection fails with Connection reset by peer. Without -k, the launcher then runs its auto-stop step, which shuts the VM down and prompts for authorization a second time. Every retry repeats this: one prompt to start, one to stop, and the VM never becomes usable. To the user it looks like "it keeps asking for my password and won't start."

Cause

__priv_up_wait in omarchy-windows-vm (around line 924) treats this line in the container log as "ready":

grep -qi "windows started successfully"

dockurr/windows prints that line when QEMU has launched and handed off to the UEFI boot manager. It does not mean the guest has booted or that its RDP service is listening. The launcher then goes straight to xfreerdp3 /v:127.0.0.1:3389. Docker's port forward accepts the connection, but nothing inside the guest answers yet, so the connection is reset.

Expected

launch waits until the guest actually accepts RDP on 3389 (with a sensible timeout) before starting xfreerdp3. If the connection still fails, it does not silently stop the VM and prompt again.

Actual log

Container log (the "started successfully" line appears, and the guest is still booting):

❯ Booting Windows using QEMU v11.1.0...
BdsDxe: starting Boot0005 "Windows Boot Manager" ...
❯ Windows started successfully, visit http://127.0.0.1:8006/ to view the screen...

xfreerdp3, roughly 1s after container start:

[ERROR][com.freerdp.core.transport] - [transport_read_layer]: BIO_read returned a system error 104: Connection reset by peer
[ERROR][com.freerdp.core] - [transport_read_layer]: ERRCONNECT_CONNECT_TRANSPORT_FAILED [0x0002000D]
[ERROR][com.freerdp.core] - [freerdp_connect]: freerdp_post_connect failed

Re-running omarchy windows vm launch -k after waiting about a minute (once the web console at 127.0.0.1:8006 showed the desktop) connects normally. The VM was never broken. The launcher just didn't wait for it.

Suggested fix

After the log check in __priv_up_wait, or in launch_windows before xfreerdp3, poll until RDP answers, for example:

for _ in $(seq 1 90); do
  timeout 2 bash -c 'exec 3<>/dev/tcp/127.0.0.1/3389 && head -c1 <&3' 2>/dev/null && break
  sleep 2
done

A plain TCP connect isn't enough, because Docker's proxy accepts it immediately. Reading at least one byte (or doing an RDP X.224 negotiation) is what shows the guest is answering. The launcher could also show "Waiting for Windows to boot…" while it polls, so the delay is visible.

Optionally, if xfreerdp3 exits non-zero within a few seconds of starting, skip the auto-stop and tell the user the VM is still running.

System details

  • Omarchy 4.5.0-3
  • Intel Core Ultra 9 275HX, 31 GB RAM
  • freerdp 2:3.32.2-1
  • dockurr/windows v6.05, QEMU v11.1.0
  • /storage on btrfs (the container warns about this; it may slow cold boots, but the race exists regardless)

Related, possibly separate

One run also failed with ERROR: Timeout while waiting for QEMU to boot the machine, terminating.... That may be the btrfs/CoW disk issue and not the launcher, so I'm not claiming it is part of this bug.

rogerfsh avatar Nov 12 '26 16:11 rogerfsh

I read the report and checked the current Windows VM launch path. I classified it as a bug, but the configured classification model, deepseek-v4p1-flash, returned no classification, so classification remains incomplete. No worker reproduction or fix was attempted; this is waiting for classification to complete before verification can proceed.

GPT-6 in Codex reviewed the report (effort setting not exposed). No second model completed a review of this issue. A separate availability check succeeded for Opus 5.5 High and muse-wonder at high effort; those probes did not review this report.

omarchybot avatar Nov 19 '26 03:11 omarchybot

Closing as a duplicate of #10150, which already tracks the same cold-start sequence: the boot log passes the readiness check, FreeRDP connects before the guest answers, and the failed connection triggers VM shutdown. The second authorization prompt follows that shutdown path. The earlier issue remains open and also has reports from Omarchy 4.5.0-3.

I compared both reports, their comments, and the current quattro launch path. No Windows guest or runtime tests were run for this duplicate check. Checked by GPT-6 in Codex (effort setting not exposed); Opus 5.5 High and muse-wonder via pi, thinking high, agreed that this is the same report. Independence is not guaranteed.

Thanks, @rogerfsh. Investigation continues in #10150. This can be reopened if there is a distinct failure that the earlier issue does not cover.

omarchybot avatar Nov 23 '26 11:11 omarchybot