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

Virtualbox: failed to load libGL.so.1: VERR_FILE_NOT_FOUND #382233

Open
3 tasks done
rolfschr opened this issue Feb 15, 2025 · 0 comments
Open
3 tasks done

Virtualbox: failed to load libGL.so.1: VERR_FILE_NOT_FOUND #382233

rolfschr opened this issue Feb 15, 2025 · 0 comments
Labels
0.kind: bug Something is broken

Comments

@rolfschr
Copy link
Contributor

rolfschr commented Feb 15, 2025

Nixpkgs version

  • Stable (24.11)

Describe the bug

I can't run sway in Virtualbox. I believe the problem is not sway per se, but rather related to 3d acceleration not working. I have been able to run the below configuration.nix successfully (=shows glxgears after boot) with qemu but not with Virtualbox. For Virtualbox, the graphical output is:

Image

VMware: No 3D enabled (0, Success).
libEGL warning: egl: failed to create dri2 screen
00:00:00.040 [ERROR] [wlr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "DRI2: failed to create screen"
VMware: No 3D enabled (0, Success).
libEGL warning: egl: failed to create dri2 screen
00:00:00.046 [ERROR] [wlr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "DRI2: failed to create screen"
VMware: No 3D enabled (0, Success).
libEGL warning: egl: failed to create dri2 screen
00:00:00.053 [ERROR] [wlr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "DRI2: failed to create screen"
00:00:00.053 [ERROR] [wlr] [EGL] command: eglInitialize, error: EGL_NOT_INITIALIZED (0x3001), message: "eglInitialize"
00:00:00.053 [ERROR] [wlr] [render/egl.c:268] Failed to initialize EGL
00:00:00.053 [ERROR] [wlr] [render/egl.c:571] Failed to initialize EGL context
00:00:00.053 [ERROR] [wlr] [render/gles2/renderer.c:499] Could not initialize EGL
00:00:00.053 [ERROR] [wlr] [render/wlr_renderer.c:272] Could not initialize renderer
00:00:00.053 [ERROR] [sway/server.c:236] Failed to create renderer

Looking into the logs from Virtualbox reveals:

00:00:01.899286 VMSVGA3d: failed to load libGL.so.1: VERR_FILE_NOT_FOUND
00:00:01.899292 AssertLogRel /build/VirtualBox-7.1.4/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp(328) int glLdrInit(PPDMDEVINS): pfnRet
00:00:01.899296 glXGetFBConfigAttrib missing
00:00:01.899300 VMSetError: /build/VirtualBox-7.1.4/src/VBox/Devices/Graphics/DevVGA-SVGA3d-glLdr.cpp(328) int glLdrInit(PPDMDEVINS); rc=VERR_VGA_GL_SYMBOL_NOT_FOUND
00:00:01.899302 VMSetError: Missing OpenGL symbol 'glXGetFBConfigAttrib'
00:00:01.899303 
00:00:01.899310 VMSVGA3d: Error loading OpenGL library and resolving necessary functions: VERR_VGA_GL_SYMBOL_NOT_FOUND
00:00:01.899314 VMSVGA3d: 3D support disabled! (vmsvga3dInit -> VERR_VGA_GL_SYMBOL_NOT_FOUND)

I believe this to be the same problem with any combination of virtualisation.virtualbox.host.package = pkgs.virtualbox[Hardened] and/or virtualisation.virtualbox.host.enableHardening = [true|false];

I confirmed that my setup is able to run KDE/Plasma (see configuration.nix below). The libGL error is obviously the same but Plasma is able to launch a graphical user environment. This could of course mean that the problem is not libGL/Virtualbox but sway. I also tested cage with no luck neither (similar error message).

Steps to reproduce

I used this configuration.nix and nix shell nixpkgs/nixos-24.11#nixos-generators --command nixos-generate -f virtualbox -c ./configuration.nix:

{ config, pkgs, self, ... }: {
  # Either ...
  programs.sway = { enable = true; };
  environment.variables = {
    WLR_NO_HARDWARE_CURSORS = 1;
  }; # https://www.reddit.com/r/swaywm/comments/127fsxr/
  services.getty.autologinUser = "root";
  programs.bash.loginShellInit = ''
    if [ "$(tty)" = "/dev/tty1" ]; then
      sway --config ${
        pkgs.writeText "glxgears" ''
          exec ${pkgs.mesa-demos}/bin/glxgears -fullscreen
        ''
      }
    fi
  '';

  # ... or
  # services.displayManager.sddm.enable = true;
  # services.displayManager.sddm.wayland.enable = true;
  # services.desktopManager.plasma6.enable = true;

  virtualisation.virtualbox.guest.enable = true;
}

(~1.6Gb .ova file, 2.8Gb for KDE ...)

Then, import the appliance using File -> Import Appliance. Before launching, open the Settings -> Display -> Enable 3d Acceleartion. Launch the VM, open the Log (Machine -> Show Log...)

Expected behaviour

No error message about a missing libGL.so.1 in the logs from Virtualbox. sway starts up and can show glxgears

Screenshots

see above

Relevant log output

see above

Additional context

No response
Some resources that are relevant IMHO:

[I] rolf@tuxpad /r/opengl-driver> ls /run/opengl-driver/lib/
d3d             libEGL_mesa.so.0      libGLX_mesa.so.0            libVkLayer_MESA_device_select.so  libvulkan_intel_hasvk.so  libvulkan_nouveau.so  libxatracker.so        vdpau
dri             libEGL_mesa.so.0.0.0  libGLX_mesa.so.0.0.0        libVkLayer_MESA_overlay.so        libvulkan_intel.so        libvulkan_radeon.so   libxatracker.so.2
libEGL_mesa.so  libGLX_mesa.so        libVkLayer_INTEL_nullhw.so  libvulkan_dzn.so                  libvulkan_lvp.so          libvulkan_virtio.so   libxatracker.so.2.5.0
[rolf@tuxpad:~]$ cd $(dirname $(realpath $(which VirtualBox)))/../libexec/virtualbox

[rolf@tuxpad:/nix/store/jvk26bpi3gnak495gz30majywvirwcmw-virtualbox-7.1.6a/libexec/virtualbox]$ ldd *so | grep -B 3 libGL.so
VBoxSVGA3D.so:
        linux-vdso.so.1 (0x00007fffd531d000)
        VBoxRT.so => /nix/store/jvk26bpi3gnak495gz30majywvirwcmw-virtualbox-7.1.6a/libexec/virtualbox/./VBoxRT.so (0x00007fa6e4e00000)
        libGL.so.1 => /nix/store/kynlrr98p2c235b00c72b14apn7l8l4y-libglvnd-1.7.0/lib/libGL.so.1 (0x00007fa6e52d5000)

System metadata

[I] rolf@tuxpad ~/s/opengl-virtualbox> nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.6.76, NixOS, 24.11 (Vicuna), 24.11.20250210.44534bc`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.24.12`
 - channels(root): `"nixos-24.05"`
 - channels(rolf): `""`
 - nixpkgs: `/nix/store/z88hhaq46sdqzkm0zas1sn284h7w87k9-source`

Notify maintainers


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

@rolfschr rolfschr added the 0.kind: bug Something is broken label Feb 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

1 participant