-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
VirtualBox: Virtual machines fail to start. #65564
Comments
I've met the same issue with "signal 6". Rebooting does not help. But I can run VM with |
I digged a bit. Virtualbox seems to have problems when loading
I guessed it might be opengl not finding mesa or some x11 libraries, so I tried adding There's more libraries that seem to run I'll try to bisect what broke it, maybe this will help tracking down what caused it. |
I finished bisecting, and found the following commit causing it to break:
I made sure to only mark commits bad that were really failing the virtulabox test with the specific error message posted above by using the following script for #!/usr/bin/env bash
nixBuild() {
DRV=$(nix-instantiate "$@");
nix-build $DRV --builders "" --no-out-link;
S=$?;
if [ $S -ne 0 ]; then
# trigger a git bisect bad if the bad line was found
nix log $DRV | grep -i "has terminated unexpectedly during startup" && exit 42;
# else trigger a skip (some other random build failure)
exit 125;
fi;
# build was successful
exit 0
}
nixBuild nixos/tests/virtualbox.nix -A simple-cli So it's indeed some problems in how qt applications are wrapped cc @ttuegel / #65399 |
Wrapping simply all qt binaries via |
@worldofpeace See the bisect log - I tested with latest master from some hours ago (was at 984851a at this time, so your commit was included) - it didn't fix that failure.
|
Had a look, see what the issue could be. I think the issue is that Here's why I think it's related:
diff --git a/pkgs/applications/virtualization/virtualbox/default.nix b/pkgs/applications/virtualization/virtualbox/default.nix
index 1a6ba5ac527..836c5e5b65a 100644
--- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -183,6 +183,7 @@ in stdenv.mkDerivation {
preFixup = optionalString (!headless) ''
wrapQtApp $out/bin/VirtualBox
+ wrapQtApp $out/libexec/virtualbox/VirtualBoxVM
'';
passthru = {
Once wrapped, the suid wrapper seems to not work as expected
And, just as a test, tried to run the wrapped binary through sudo:
So, there's a bit more to it than simply wrapping it. |
Does simply not wrapping it make it work? If not, why did it work before? |
Anyway, I think that we need to make sure that VirtualBoxVM is not wrapped, and hack it however we need to make it run, e.g. by inserting calls to |
Last part where you ran it with sudo appears to trigger a check in a hardening function which obviously finds our shell wrapper suspicious. @ambrop72 It does appear that in this case a patch may also be needed. |
There recently were changes in how Qt applications are packaged. The change (or an equivalent change) is required to fix an issue with mixed Qt applications in a user's environment. The issue this fixes is way worse (and hard to debug) than the issues it causes in the end. Why did it work before? It worked because Qt would discover libraries (e.g.
It would work, though the patch would need to be dynamic, as the full library paths would need to be used. Adding to Qt's library path is what #44047 was doing to solve the issue. (Though it was doing so at initialization-time, by looking into a "registry" file of paths to add for the derivation.) |
Testing this might be easier when setting |
In case this helps somebody: I added #66725. After using The tests seem to not crash immediately anymore, but the virtual machines still didn't boot up. I did not yet start a machine interactively to investigate. |
This works for me. Thanks! |
@jcumming can you elaborate? You tried to manually run Virtualbox and start a VM through the GUI? Did you enable hardening? |
ping @jcumming |
I got the Virtualbox VM Gui running by wrapping the --- a/pkgs/applications/virtualization/virtualbox/default.nix
+++ b/pkgs/applications/virtualization/virtualbox/default.nix
@@ -183,6 +183,7 @@ in stdenv.mkDerivation {
preFixup = optionalString (!headless) ''
wrapQtApp $out/bin/VirtualBox
+ wrapQtApp $out/libexec/virtualbox/VirtualBoxVM
'';
passthru = { Enabling hardening doesn't work because the wrapper doesn't carry over the correct permissions and probably changes the expected binary path:
|
@B4dM4n Yeah, I also got the qt app to run. But were you able to actually start a VM, too? |
Yes, without hardening the VM GUI starts fine. I also noticed that wrapping |
I've opened pull request #67968 which fixes this. |
Fixes NixOS#65564. When hardening is enabled, we cannot use a wrapper for VirtualBoxVM, so patch the source code to set QT_PLUGIN_PATH as required. (cherry picked from commit b52dfd3)
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/running-an-ova-in-virtualbox/11340/1 |
Describe the bug
On the latest nixos-unstable (b5f5c97), starting any virtual machine gives me error:
To Reproduce
Steps to reproduce the behavior:
Screenshots
Additional context
Seems to have been caused by updating.
Maintainer information:
The text was updated successfully, but these errors were encountered: