-
-
Notifications
You must be signed in to change notification settings - Fork 15.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 nixos guest missing 3D acceleration #18457
Comments
Did you check if guest additions are correctly installed and enabled? |
Sure, they are installed. I also made the guest nixos module put virtualbox_dri.so to /run/opengl-driver/lib/dri, but that did not help. My X log only says:
I tried with 'modeset' in cmdline too, no difference. |
Ok, I have a dirty patch that makes it work. Basically, libGL.so.1 should point to VBoxOGL.so, instead of the mesa one. Then, acceleration works. But in my machine, Optimus (Intel+NVidia), I fail to make the acceleration go through NVidia and I only get the Intel acceleration. Like this poor guy: http://superuser.com/questions/779070/use-nvidia-gpu-from-virtualbox (but it is another topic). We should think how to add a nixos option that makes the libGL.so.1 override in opengl-drivers/lib |
btw, here is the source from where I got the idea of the symlink: https://bugs.archlinux.org/task/49752 |
I was able to get it to work using the link you provided:
Any ideas how to make this the default using my configuration.nix? thanks! |
I think that #9415 may be somewhat related. |
I'm having the same issue. I can get good output from |
I'd been meaning to submit a PR for this, but unfortunately I'm no longer on VirtualBox. Last time I tried it this expression in my config worked more or less: { pkgs
, config
, ...
}:
let
makePackage = p: p.buildEnv {
name = "mesa+vbox+txc-${p.mesa_drivers.version}";
paths =
let version = "5.1.12";
virtualboxGuestAdditions = p.linuxPackages.virtualboxGuestAdditions.overrideDerivation (oldAttrs: {
/* src = p.fetchurl { */
/* url = "http://download.virtualbox.org/virtualbox/${version}/VBoxGuestAdditions_${version}.iso"; */
/* sha256 = "08a3vycj7yw6ihb3myi9yhag1ivpwdl9m5c33viw66lpmdf2d80k"; */
/* }; */
buildCommand = lib.traceShowVal oldAttrs.buildCommand +
''
ln -s $out/lib/VBoxOGL.so $out/lib/libGL.so
ln -s $out/lib/VBoxOGL.so $out/lib/libGL.so.1
ln -s $out/lib/VBoxOGL.so $out/lib/libGL.so.1.2.0
# TODO: in the next version add EGL?
# patchelf --set-rpath ${lib.makeLibraryPath (with p; with p.xorg; [ "$out" dbus libXcomposite libXdamage libXext libXfixes ])} lib/VBoxEGL.so
# cp -v lib/VBoxEGL.so $out/lib
# ln -s $out/lib/VBoxEGL.so $out/lib/libEGL.so
# ln -s $out/lib/VBoxEGL.so $out/lib/libEGL.so.1
# ln -s $out/lib/VBoxEGL.so $out/lib/libEGL.so.1.2.0
'';
});
in
[ virtualboxGuestAdditions # for the DRI driver
# p.mesa_drivers
# p.mesa_drivers.out # mainly for libGL # (TODO: replace?)
(if config.hardware.opengl.s3tcSupport then p.libtxc_dxtn else p.libtxc_dxtn_s2tc)
];
};
in
{
hardware = {
opengl = {
/* FIXME: See https://github.com/NixOS/nixpkgs/issues/5051#issuecomment-64393958 */
package = makePackage pkgs;
/* extraPackages = [pkgs.linuxPackages.virtualboxGuestAdditions]; */
};
};
} I hope it'll be helpful for someone that wants to submit a proper PR. |
@rehno-lindeque, I am relatively new to nixos, just trying to get it to do what I want for the second time (tried a while ago). When I simply paste your configuration snippet from above in my configuration.nix, |
@cgo: typically one adds |
BTW, setting |
@vcunat @cgo To clarify, the expression above makes use of virtualbox's |
any movement on this? |
This should get fixed by #60985. |
I don't think so. The problem is that the 3D support in VirtualBox additions relies on programs loading But since the Linux 3D support on VirtualBox has a questionable support status and is known to have issues, I would be reluctant to make it enabled automatically even if we support it. |
If virtualbox would support libglvnd, this would have fixed it in a nice way. But unfortunately you're right. Seems adding libglvnd and/or fixing some of the unstable 3d guest support is very much down on Oracles priority list: https://www.virtualbox.org/pipermail/vbox-dev/2017-June/014561.html We should probably add some documentation on how to load |
It seems to be broken upstream too, and fixing it is far down the priority list: https://www.virtualbox.org/pipermail/vbox-dev/2017-June/014561.html Additionally, 3d support seems to rely on VBoxOGL.so being symlinked from libGL.so (which we can't), and Oracle doesn't plan on supporting libglvnd either. (NixOS#18457)
@zarelit as explained in the mail linked in my comment, 3d guest support is pretty much broken in virtualbox upstream too, and fixing that is far down on Oracle's priority list:
On top of that, it's probably not really possible to run it in NixOS either, due to it not supporting libglvnd. I guess this would need to be fixed upstream first. I opened #61944 which changes virtualboxGuestAdditions to not install VBoxOGL.so, with a comment on why. |
@flokli thank you for the clarification on for your work on this! |
just to clarify, there's a working solution for this, but we're not going to make it easy for ideological reasons? did I understand this right? |
@husnoo The reasons are mostly technical, given even upstream considers their driver to be unstable and are thinking loudly about disabling it entirely. This could be made "easy" by passing in the VBoxOGL driver (together with the required I was just assuming there wasn't too much need in supporting that, given nobody stepped up with a PR after a possible solution was sketched in March 2017. I'd be happy to review a PR adding this option, though ;-) |
It seems to be broken upstream too, and fixing it is far down the priority list: https://www.virtualbox.org/pipermail/vbox-dev/2017-June/014561.html Additionally, 3d support seems to rely on VBoxOGL.so being symlinked from libGL.so (which we can't), and Oracle doesn't plan on supporting libglvnd either. (#18457)
In NixOS 16.03 I enable VirtualBox guest additions (virtualization.virtualbox.guest.enable = true) and I properly get Direct Rendering in X.org but it still uses the swrast GL code. In VirtualBox I do enable "3D acceleration" but I guess there should be some userlib in the guest that makes GL go through the vm for the acceleration.
Does anybody know how to get this 3d acceleration?
Thank you.
The text was updated successfully, but these errors were encountered: