Steps to reproduce: 1. Launch some virtualbox VMs 2. sudo acpiconf -s 3 3. Resume Expected behavior: System continue to run. Actual behavior: Black screen, system doesn't respond to any hotkeys. Impossible to reboot a system by typing commands blindly or create a kernel dump using Ctr+Alt+F1, Ctr+Alt+Escape. Hardware: Fujitsu Lifebook E733 uname -a: ``` FreeBSD e733 11.0-RC3 FreeBSD 11.0-RC3 #0 r305786: Wed Sep 14 02:19:25 UTC 2016 root@releng2.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 ``` Naturally it could be a bug in virtualbox driver or port, not FreeBSD kernel itself.
``` $ pkg info | grep virtualbox virtualbox-ose-5.0.26 General-purpose full virtualizer for x86 hardware virtualbox-ose-kmod-5.0.26_1 VirtualBox kernel module for FreeBSD ```
*** Bug 253963 has been marked as a duplicate of this bug. ***
I also consistently see a panic upon resume with 13.0-RELEASE and virtualbox-ose-6.1.34. This only happens when a VM is running.
Hello! Someone mentioned turning off exclusive use of hardware virtualization in a freebsd-hackers discussion about running VirtualBox and bhyve side by side (https://lists.freebsd.org/archives/freebsd-hackers/2022-June/001299.html). I had a hunch that this setting might also affect this issue, turned it off (vboxmanage setproperty hwvirtexclusive off), and now I can suspend/resume the host with running VMs. So this seems to be a good workaround, and also might narrow down the issue.
(In reply to Tamas Szakaly from comment #4) Far out... Just verified that this works for FreeBSD 13.1-RELEASE and virtualbox-ose-6.1.34. Thanks!
Maybe the port could be patched so hwvirtexclusive is off by default?
Duplicate of bug 155964? > 155964 – OS hangs completely when suspend/resume with > active emulators/virtualbox-ose VirtualBox guest window
Is this still an issue? I haven't had this problem anymore in recent FreeBSD releases.
(In reply to Jason W. Bacon from comment #8) It is. Replicated twice today vith 6.1.50_5 running under 14.1-release-p6.
(In reply to fabio.comolli from comment #9) ... and replying to myself: I also confirm that "vboxmanage setproperty hwvirtexclusive off" makes suspend / resume (with a Virtualbox VM open, of course) work.
To patch in a workaround, I think we would need to insert vboxmanage setproperty hwvirtexclusive off before a VM is started by any method. There are multiple ways to launch a VM from the command line (VirtualBox, VboxHeadless, VBoxManage startvm, etc.) I wonder if they all lead to a single point in the code where the VM process is started, or if the start code is replicated in multiple places. This will require a little digging...
As an alternative, I may have found the place where this is initialized in src/VBox/Main/src-server/SystemPropertiesImpl.cpp. Maybe just adding FreeBSD to the OS list here (and an appropriate comment explaining why) would do the trick. /* On Windows, OS X and Solaris, HW virtualization use isn't exclusive * by default so that VT-x or AMD-V can be shared with other * hypervisors without requiring user intervention. * NB: See also SystemProperties constructor in settings.h */ #if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) m->fExclusiveHwVirt = false; #else m->fExclusiveHwVirt = true; #endif
(In reply to Jason W. Bacon from comment #12) Not going to be that easy. I reinstalled from source with the patch below, and it did not help. System panicked immediately on resume. --- src/VBox/Main/src-server/SystemPropertiesImpl.cpp.orig 2024-01-11 12:25:27 UTC +++ src/VBox/Main/src-server/SystemPropertiesImpl.cpp @@ -105,8 +105,9 @@ HRESULT SystemProperties::init(VirtualBox *aParent) * by default so that VT-x or AMD-V can be shared with other * hypervisors without requiring user intervention. * NB: See also SystemProperties constructor in settings.h + * FreeBSD systems panic on sleep/resume with exclusive enabled. */ -#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) +#if defined(RT_OS_DARWIN) || defined(RT_OS_WINDOWS) || defined(RT_OS_SOLARIS) || defined(RT_OS_FREEBSD) m->fExclusiveHwVirt = false; #else m->fExclusiveHwVirt = true;