NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.48k stars 12.98k forks source link

Mesa: failed to load iris driver due to glibc #216361

Open ghost opened 1 year ago

ghost commented 1 year ago

Describe the bug

When running multiple programs like Element, Google Chrome, or trying to play something on Bottles, I get the following:


libEGL warning: MESA-LOADER: failed to open iris: /nix/store/qbgfsaviwqi2p6jr7an1g2754sv3xqhn-gcc-11.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /nix/store/yvcnhajqbwcq35vpnsm1waw557dxcn5v-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)

[182991:0214/140950.926111:ERROR:gl_display.cc(508)] EGL Driver message (Critical) eglInitialize: DRI3: failed to load driver
libEGL warning: MESA-LOADER: failed to open swrast: /nix/store/qbgfsaviwqi2p6jr7an1g2754sv3xqhn-gcc-11.3.0-lib/lib/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /nix/store/yvcnhajqbwcq35vpnsm1waw557dxcn5v-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)

As a result, chrome/ium stuff relies on the cpu for rendering, and games straight up don't work.

Expected behavior

The driver is loaded correctly and all works fine.

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Add any other context about the problem here.

Notify maintainers

@primeos @vcunat

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.10-zen1, NixOS, 23.05 (Stoat), 23.05pre454549.545c7a31e5d`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.2`
 - channels(root): `"nixos"`
 - channels(m911t): `"home-manager"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
ghost commented 1 year ago

Also, I'm not sure if this also affects Steam, but I think it does because games still use llvmpipe instead of the actual gpu driver.

vcunat commented 1 year ago

I believe this usually happens when you mix significantly different nixpkgs versions. For the OS (and thus /run/opengl-driver/) and for the program that you execute.

ghost commented 1 year ago

root's channel was just nixos-unstable and my user just has home-manager's master. How could this happen? I don't have anything fancy beyond that.

vcunat commented 1 year ago

Well, yesterday on nixpkgs master we did a major upgrade of the default gcc (and thus libstdc++), so even a few commits apart can do that.

EDIT: such major changes can't happen when following stable nixpkgs, for example.

ghost commented 1 year ago

ah, so perhaps I got bit by that. Coincidentally I'm moving back to nixos stable and h-m stable so I can game. I doubt I'll actually need the latest and greatest, so I'll be fine. I guess this can be closed, then?

primeos commented 1 year ago

Hm, the /nix/store/yvcnhajqbwcq35vpnsm1waw557dxcn5v-llvm-15.0.7-lib/lib/libLLVM-15.so -> /nix/store/qbgfsaviwqi2p6jr7an1g2754sv3xqhn-gcc-11.3.0-lib/lib/libstdc++.so.6 case seems a bit concerning - could potentially be a new/additional issue/regression (I didn't look into it though). Nvm, seems like we already hit this case (with different versions) in the past: https://github.com/NixOS/nixpkgs/issues/95806#issuecomment-677387382

Seems like yet another instance of https://github.com/NixOS/nixpkgs/issues/95808.

vcunat commented 1 year ago

Yes, just libstdc++ instead of glibc. We've had it with some wayland lib, too, IIRC.

vcunat commented 1 year ago

You probably built part of the app with one gcc version (and thus libstdc++ version) and part with another one.

gilice commented 1 year ago

You were right! kind of. I was using an overlay that was based on an older nixpkgs. I had to rebase that on the current master and now it works.

ghost commented 1 year ago

So I had switched to stable nixos, and today I updated the system (still stable) and I'm getting hit by this

No, something similar, because steam out of nowhere can't open proton games.

pongo1231 commented 1 year ago

Had the same issue but only with Steam games which try to access OpenGL drivers, running OGL games outside Steam worked fine. Tried both stable and unstable, but what fixed it for me was to switch to the "previous" beta branch for the Steam Linux Runtime. Not sure what the culprit was.

ghost commented 1 year ago

i reinstalled nixos (still using stable) and proton works now.

anund commented 1 year ago

Hmm is this the same problem as https://github.com/NixOS/nixpkgs/issues/218238? The fix there was adding a dependency on gcc.

evils commented 1 year ago

i ran into this on my occasionally used laptop, steam-run prusa-slicer seems like a viable workaround

sg-qwt commented 1 year ago

Hit the same issue running mpv on laptop, steam-run mpv works fine, but what's the proper fix for this?

libEGL warning: MESA-LOADER: failed to open iris: /nix/store/8bmp6r3a0xfha3wj36phlc47clh9w81l-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/5k9x8dnwiq0h5czikpax6rbal547k24z-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)

libEGL warning: MESA-LOADER: failed to open swrast: /nix/store/8bmp6r3a0xfha3wj36phlc47clh9w81l-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/5k9x8dnwiq0h5czikpax6rbal547k24z-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)

libEGL warning: MESA-LOADER: failed to open iris: /nix/store/8bmp6r3a0xfha3wj36phlc47clh9w81l-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/5k9x8dnwiq0h5czikpax6rbal547k24z-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)

libEGL warning: MESA-LOADER: failed to open swrast: /nix/store/8bmp6r3a0xfha3wj36phlc47clh9w81l-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/5k9x8dnwiq0h5czikpax6rbal547k24z-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)
vcunat commented 1 year ago

I think most people are running into this "just" because they're using a (sufficiently) different commit for their NixOS and their steam. (or forgot to pull 32-bit drivers into OS, but I think that causes different message)

A "proper" fix, i.e. making even mismatching version work seems even getting further away. Upstream mesa is going towards more strict version matching than before.

ppenguin commented 1 year ago

Just as an additional "workaround" (for posterity):

When I needed an unstable wlroots lib to solve this issue, I started by just setting hardware.opengl.package = unstable.mesa.drivers and using an unstable kernel with amdgpu (on an otherwise mostly "stable" system).

I thought I had gotten away with any issues after additionally getting alacritty also from unstable, but found additional indirect dependencies of packages not working later.

My (temporary) solution now is overlaying all opengl related deps from nixpkgs-unstable onto nixpkgs (stable), at the (significant!) cost of having to compile a large part of my installation (due to deviations from binary caches) for every nixos-rebuild.

{
    nixpkgs.overlays = [
        (_: _: { # !!! overlay to force full deps on unstable opengl
            mesa = unstable.mesa;
            intel-media-driver = unstable.intel-media-driver;
            vaapiIntel = unstable.vaapiIntel;
            vaapiVdpau = unstable.vaapiVdpau;
            libvdpau-va-gl = unstable.libvdpau-va-gl;
            virglrenderer = unstable.virglrenderer;
            xdg-desktop-portal-wlr = unstable.xdg-desktop-portal-wlr;
            qemu = unstable.qemu;
        })
    ];

    hardware.opengl = {
        enable = true;
        # package = mesa.drivers;
        driSupport = true; # for wine with openGL
        driSupport32Bit = true; # for wine with openGL
        extraPackages = with pkgs; [
            intel-media-driver # LIBVA_DRIVER_NAME=iHD
            vaapiIntel         # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
            vaapiVdpau
            libvdpau-va-gl
        ];
    };
}

EDIT

It appears the (time) cost of the compiling is so high (you also need to recompile things like openoffice and wine (the latter seems obvious in hindsight)), that I'd say in most cases it isn't worth it and would warrant accepting either everything unstable or "most" stable (at least keep opengl as the lowest common denominator and avoid using packages that require more recent versions of it)

hughobrien commented 1 year ago

For other passers-by, I wanted an older version of a package from nixpkgs, so I had just that overridden. However it conflicted with the system/current mesa also.

libEGL warning: MESA-LOADER: failed to open radeonsi: /nix/store/hsk71z8admvgykn7vzjy11dfnar9f4r1-glibc-2.35-163/lib/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/jvj19d7vrlxdyfw8vw4ad4h9inwsp1wz-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)

Based on @ppenguin 's suggestion above it was simply a matter of pinning the opengl version to the same source. Likely this will break the current opengl programs but it's easy enough for me to switch back.

...
let oldpkgs = import /data/nixpkgs { };
...
environment.systemPackages = with pkgs; [ oldpkgs.oldthing ];
...
hardware.opengl = {
      package = oldpkgs.mesa.drivers;
...
vcunat commented 1 year ago

I suppose that for such use cases it might be better to use approaches like nixGL: https://github.com/guibou/nixGL

NightEule5 commented 3 months ago

I had a similar issue where my whole system fell back to rendering with llvmpipe, reinstalling didn't fix it for me. I commented out the opengl part of my config, rebuilt, rebooted, and that fixed it. It still works when I then re-enable it.

Maybe some package (Firefox?) implicitly installs another version of the media acceleration drivers, so installing them explicitly leads to the "two different versions installed" error. I'm really not sure why it continues to work when re-enabled, maybe Nix doesn't reinstall them

Edit: the culprit was actually this:

services.xserver.deviceSection = ''
  Option "AccelMethod" "uxa"
  Option "DRI" "iris"
'';

Which I had disabled along with the OpenGL configuration while troubleshooting. I think the first "AccelMethod" is the trigger, which I set because tabbing out of games was causing artifacting and that seemed to fix it.