Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UEFI VM options #525

Merged
merged 1 commit into from
Jan 22, 2025
Merged

Conversation

dag-erling
Copy link
Contributor

@dag-erling dag-erling commented Sep 8, 2023

Currently, vm::run initializes _opts to -AHP, then, in the UEFI case calls vm::uefi which, instead of appending to _opts, sets it to -Hwl bootrom,.... This means UEFI VMs are started without -A, which was never a good idea but which causes them to fail to boot with recent versions of edk2-bhyve (see https://bugs.freebsd.org/273560).

The main purpose of this PR is to change vm::uefi to append to _opts so -A is not lost and UEFI VMs boot correctly.

In addition, it moves the -w option from UEFI-only to default, and deduplicates the -H option.

lib/vm-run Outdated Show resolved Hide resolved
lib/vm-run Show resolved Hide resolved
- When configuring UEFI, don't overwrite previous options.
- When configuring UEFI, don't repeat -H.
- Move -w from UEFI options to default options.
@stratacast
Copy link

This PR is essential to make Linux VMs work in FreeBSD 13.2-RELEASE-p3 with edk2-bhyve-g202308. Without this, my Linux VMs would fail to finish booting entirely.

@hjf
Copy link

hjf commented Sep 17, 2023

fwiw, I've applied this patch manually and my linux VM still refuses to start. The configuration is:

loader="uefi"
graphics="no"
xhci_mouse="no"
cpu=1
memory="512M"

(edited out disk and networking)

when trying to start it I get:

vm exit[0]
        reason          SVM
        rip             0x000000001fb54b60
        inst_length     2
        exitcode        0x7b
        exitinfo1       0x511021d
        exitinfo2       0x1fb54b62        

@cederom
Copy link

cederom commented Jan 13, 2024

Probably the same problem here (1.5.0/uefi/13.2-RELEASE-p8). It worked until recent update to 13.2-RELEASE-p8. Now machine starts for a moment then exits with error 4 or 134. debug="yes" does not give anything more in the log.

@@ -109,7 +109,7 @@ vm::run(){
fi

# default bhyve options
_opts="-AHP"
_opts="-AHPw"

# ignore access to unimplemented Model Specific Registers?
config::yesno "ignore_msr" && _opts="${_opts}w"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add -w on line 112, then adding it on line 115 does nothing.

@ronaldevers
Copy link

Unless I've confused myself it was adding bhyve_options="-A" that fixed my Ubuntu guest. I'm installing an Ubuntu 24.04 guest. If I do it in UEFI mode with VNC, then the Ubuntu installer crashes usually around the mirror test. It does not crash in grub mode and it also does not crash in UEFI mode when adding the -A. Thanks @dag-erling for this hint and thanks @vermaden (https://vermaden.wordpress.com/2023/08/18/freebsd-bhyve-virtualization/) for pointing me here!

@bileslav
Copy link

@mateuszkwiatkowski, hi, sorry for the noise, but why hasn't this PR been merged yet?

@mateuszkwiatkowski
Copy link
Collaborator

Hi! I'm sorry, somehow I have missed it. Merging it now.

@mateuszkwiatkowski mateuszkwiatkowski merged commit 10a8b81 into churchers:master Jan 22, 2025
@ke5C2Fin
Copy link

ke5C2Fin commented Jan 22, 2025

Should the w on line 115 be removed now that w is part of _opts?
the conditional on line 115 should actually be removed I think

_opts="-AHPw"
config::yesno "ignore_msr" && _opts="${_opts}w"

We just turn -AHPw into -AHPww

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants