From cdf94c98dccaa7dd888759f50b01534339f5856a Mon Sep 17 00:00:00 2001 From: neil Date: Sun, 24 May 2026 17:35:09 +0200 Subject: [PATCH 1/3] fix for windows --- README.md | 2 ++ anyvm.py | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6a8dea8..68e57ea 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,8 @@ All examples below use `python3 anyvm.py ...`. You can also run `python3 anyvm.p - `--boot-timeout-sec `: Boot timeout in seconds before QEMU is killed and retried once. Default: `600` (10 minutes). - Exception: OpenBSD on `aarch64` defaults to `1200` (20 minutes) because it boots much slower under emulation. + - Exception: when running under TCG (no hardware acceleration -- e.g. Windows runners with chocolatey QEMU, or any host without `/dev/kvm` / HVF / WHPX), the default is bumped to `1800` (30 minutes). TCG is 10-50x slower than KVM, and heavy guests like Solaris or DragonFlyBSD often need more time to boot. + - Both exceptions only apply when `--boot-timeout-sec` is not explicitly passed; an explicit value always wins. - Useful for slow hosts (emulated arches, low-resource CI runners) or for failing fast in tests. - Example: `python3 anyvm.py --os openbsd --boot-timeout-sec 1200` diff --git a/anyvm.py b/anyvm.py index c7ae138..fa0bffb 100644 --- a/anyvm.py +++ b/anyvm.py @@ -2632,7 +2632,11 @@ def print_usage(): --console, -c Run QEMU in foreground (console mode). --builder Specify a specific vmactions builder version tag. --snapshot Enable QEMU snapshot mode (changes are not saved). - --boot-timeout-sec Boot timeout in seconds before QEMU is killed and retried once (default: 600). + --boot-timeout-sec Boot timeout in seconds before QEMU is killed and retried once. + Default: 600. Exceptions (only when this flag is not + explicitly passed): OpenBSD/aarch64 -> 1200; TCG mode + (no KVM/HVF/WHPX) -> 1800, since software emulation + is 10-50x slower than hardware acceleration. --enable-pmu Expose the host PMU (performance counters) to the guest. Disabled by default to avoid intermittent #GP-in-wrmsr crashes seen on some host CPUs (DragonFlyBSD is the @@ -4855,6 +4859,13 @@ def cmd_exists(cmd): except (ValueError, TypeError): pass + # TCG (pure software emulation) is 10-50x slower than KVM/HVF/WHPX, so the + # default 600s boot timeout is often not enough for heavier guests + # (Solaris, DragonFlyBSD, etc.). Bump it unless the user pinned a value. + if not boot_timeout_user_specified and accel == "tcg" and config['boot_timeout_sec'] < 1800: + config['boot_timeout_sec'] = 1800 + debuglog(config['debug'], "TCG (no hardware acceleration): default boot timeout raised to {}s".format(config['boot_timeout_sec'])) + # Disk type selection if config['disktype']: disk_if = config['disktype'] From 058aed3442c2e3e96953d2b5dbc78ba379fbc2e4 Mon Sep 17 00:00:00 2001 From: neil Date: Sun, 24 May 2026 18:34:01 +0200 Subject: [PATCH 2/3] add more timeout for solaris on Windows --- anyvm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/anyvm.py b/anyvm.py index fa0bffb..46b833f 100644 --- a/anyvm.py +++ b/anyvm.py @@ -5402,13 +5402,13 @@ def fail_with_output(reason): global_identity_block = "" if hostid_file: # Apply the VM key to all SSH hosts (requested behavior). - global_identity_block = "Host *\n ConnectTimeout 60\n ConnectionAttempts 3\n ServerAliveInterval 10\n ServerAliveCountMax 3\n IdentityFile {}\n IdentityFile ~/.ssh/id_rsa\n IdentityFile ~/.ssh/id_ed25519\n IdentityFile ~/.ssh/id_ecdsa\n\n".format( + global_identity_block = "Host *\n ConnectTimeout 60\n ConnectionAttempts 3\n ServerAliveInterval 30\n ServerAliveCountMax 6\n IdentityFile {}\n IdentityFile ~/.ssh/id_rsa\n IdentityFile ~/.ssh/id_ed25519\n IdentityFile ~/.ssh/id_ecdsa\n\n".format( hostid_file, ) def build_ssh_host_config(host_aliases): host_spec = " ".join(str(x) for x in host_aliases if x) - host_block = "Host {}\n StrictHostKeyChecking no\n UserKnownHostsFile {}\n ConnectTimeout 60\n ConnectionAttempts 3\n ServerAliveInterval 10\n ServerAliveCountMax 3\n User {}\n HostName 127.0.0.1\n Port {}\n".format( + host_block = "Host {}\n StrictHostKeyChecking no\n UserKnownHostsFile {}\n ConnectTimeout 60\n ConnectionAttempts 3\n ServerAliveInterval 30\n ServerAliveCountMax 6\n User {}\n HostName 127.0.0.1\n Port {}\n".format( host_spec, SSH_KNOWN_HOSTS_NULL, vm_user, From 56c29064ef1668be589bd08b317ba102218e9fd4 Mon Sep 17 00:00:00 2001 From: neil Date: Sun, 24 May 2026 18:53:21 +0200 Subject: [PATCH 3/3] fix log --- anyvm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/anyvm.py b/anyvm.py index 46b833f..e40e562 100644 --- a/anyvm.py +++ b/anyvm.py @@ -199,6 +199,10 @@ def debuglog(enabled, msg): sys.stdout.flush() else: print(line) + # Flush every line so CI logs reflect real time. Without this, + # debuglog output is block-buffered when stdout is a pipe and + # a hang in anyvm.py would lose all in-flight trace messages. + sys.stdout.flush() def is_browser_available(): """Returns True if the current environment can likely open a local browser."""