You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I cloned the repo, cd'ed into examples/basic and tried cargo run bios. That run and exited in about 3 seconds.
Next, I tried cargo run uefi and it sat there spinning on the CPU for 6 minutes before I killed it.
So, QEMU works on my box, but examples/basic doesn't seem to work with uefi out of the box for me.
I got no output on the console (ie. the serial port) during the run. Judging on the bios run, it seems like the bootloader should probably be printing stuff, so I don't know if that helps narrow down what could be blocked spinning.
I'm not sure what other information to include. Let me know what would help.
$ time cargo r uefi
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.05s
Running `target/debug/basic uefi`
QEMU: Terminated
real 6m24.164s
user 6m22.835s
sys 0m0.384s
$
I can't reproduce this. Can you try with the latest nightly compiler? Using the latest nightly version is currently broken, so you might need the fixes from #563.
Actually, I continued debugging and investigating and I guess I've figured it out. The issue is that without KVM, ovmf in QEMU is so slow that even 6 minutes is not enough to get to the kernel code. When I add cmd.arg("-enable-kvm"); just before the spawn call in examples/basic/src/main.rs it works.
In case it matters, here's the version of qemu I have:
$ qemu-system-x86_64 --version
QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.30)
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
I don't know if adding -enable-kvm is reasonable to do in general since not everyone may be in the kvm group (I was not before this). If not, maybe the docs can mention kvm and the fact that it can look hung if it's not enabled?
I get an error if I try -machine accel=tag so I'm assuming you meant -machine accel=tcg.
For me, with no modification or with -machine accel=tcg it doesn't print anything and spins. Presumably if I wait long enough it might print something.
With -machine accel=kvm I get the same speed as I got with -enable-kvm. Under 2 seconds.
So, I guess maybe it's a version difference? I don't know a lot about the internals of qemu. My kernel is 6.17.9-76061709-generic if that matters. (This is a Pop!OS 22.04 machine, but largely that's the same as Ubuntu 22.04.)
The hang seem to be intentional by OVMF because QEMU has a bug: https://edk2.groups.io/g/devel/topic/patch_v3_2_2/96374974. If possible, try updating QEMU, otherwise try -fw_cfg name=opt/org.tianocore/X-Cpuhp-Bugcheck-Override,string=yes.
Activity
Freax13 commentedon May 10, 2026
I can't reproduce this. Can you try with the latest nightly compiler? Using the latest nightly version is currently broken, so you might need the fixes from #563.
chrisdsloan commentedon May 10, 2026
Actually, I continued debugging and investigating and I guess I've figured it out. The issue is that without KVM, ovmf in QEMU is so slow that even 6 minutes is not enough to get to the kernel code. When I add
cmd.arg("-enable-kvm");just before the spawn call inexamples/basic/src/main.rsit works.In case it matters, here's the version of qemu I have:
I don't know if adding
-enable-kvmis reasonable to do in general since not everyone may be in thekvmgroup (I was not before this). If not, maybe the docs can mentionkvmand the fact that it can look hung if it's not enabled?Freax13 commentedon May 10, 2026
Hmm, that's odd it shouldn't be that slow. The basic example completes in under 2 seconds on my machine. I'm using QEMU 10.2.2.
chrisdsloan commentedon May 10, 2026
Is there a chance that qemu 10 is enabling kvm by default or something? Because with kvm, it completes in 1.7 seconds for me.
Freax13 commentedon May 10, 2026
I don't think so.
Output without any modifications:
real 0m1.664s
user 0m1.574s
sys 0m0.082s
Output with
-machine accel=tcg:real 0m1.685s
user 0m1.616s
sys 0m0.063s
Output with
-machine accel=kvm:real 0m1.434s
user 0m0.958s
sys 0m0.564s
chrisdsloan commentedon May 10, 2026
I get an error if I try
-machine accel=tagso I'm assuming you meant-machine accel=tcg.For me, with no modification or with
-machine accel=tcgit doesn't print anything and spins. Presumably if I wait long enough it might print something.With
-machine accel=kvmI get the same speed as I got with-enable-kvm. Under 2 seconds.So, I guess maybe it's a version difference? I don't know a lot about the internals of qemu. My kernel is
6.17.9-76061709-genericif that matters. (This is a Pop!OS 22.04 machine, but largely that's the same as Ubuntu 22.04.)Freax13 commentedon May 10, 2026
Yup, I meant
-machine accel=tcg🙈.I can reproduce the issue with QEMU 6.2.0. I'm looking into it.
Freax13 commentedon May 10, 2026
The hang seem to be intentional by OVMF because QEMU has a bug: https://edk2.groups.io/g/devel/topic/patch_v3_2_2/96374974. If possible, try updating QEMU, otherwise try
-fw_cfg name=opt/org.tianocore/X-Cpuhp-Bugcheck-Override,string=yes.chrisdsloan commentedon May 24, 2026
Sorry for disappearing. I upgraded to:
Now it works with and without the
-enable-kvmargument.(In case anyone is curious, I installed qemu from here: https://launchpad.net/~canonical-server/+archive/ubuntu/server-backports .)
Thanks for the help!
(Should I close this issue? Or do you want to have it open for any reason?)
Freax13 commentedon May 24, 2026
No worries. Considering this isn't something we can fix in the bootloader (OVMF hangs way before the bootloader starts executing), let's close this.