Issue on AMD with opengl-driver-32/lib/dri/radeonsi_dri.so

Still pretty green with NixOS. Switching to 24.05 X86_64 OpenGL works fine on my AMD laptop (for example, RADV Rembrandt) but 32-bit seems corrupted or missing. Both worked before in 23.11 with the same configuration.

Running Steam produces:

MESA-LOADER: failed to open radeonsi: /run/opengl-driver-32/lib/dri/radeonsi_dri.so: undefined symbol: amdgpu_va_get_start_addr (search paths /run/opengl-driver-32/lib/dri, suffix _dri)
MESA-LOADER: failed to open swrast: /run/opengl-driver-32/lib/dri/swrast_dri.so: undefined symbol: amdgpu_va_get_start_addr (search paths /run/opengl-driver-32/lib/dri, suffix _dri)

Which brings me to

ls -la /run/opengl-driver-32/lib/dri/
total 56388
dr-xr-xr-x    1 root     root           536 Jan  1  1970 .
dr-xr-xr-x    1 root     root           760 Jan  1  1970 ..
-r-xr-xr-x    2 root     root      39438068 Jan  1  1970 crocus_dri.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 d3d12_dri.so -> crocus_dri.so
-r-xr-xr-x    2 root     root      18232596 Jan  1  1970 d3d12_drv_video.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 i915_dri.so -> crocus_dri.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 iris_dri.so -> crocus_dri.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 kms_swrast_dri.so -> crocus_dri.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 nouveau_dri.so -> crocus_dri.so
lrwxrwxrwx   25 root     root            18 Jan  1  1970 nouveau_drv_video.so -> d3d12_drv_video.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 r300_dri.so -> crocus_dri.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 r600_dri.so -> crocus_dri.so
lrwxrwxrwx   25 root     root            18 Jan  1  1970 r600_drv_video.so -> d3d12_drv_video.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 radeonsi_dri.so -> crocus_dri.so
lrwxrwxrwx   25 root     root            18 Jan  1  1970 radeonsi_drv_video.so -> d3d12_drv_video.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 swrast_dri.so -> crocus_dri.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 virtio_gpu_dri.so -> crocus_dri.so
lrwxrwxrwx   25 root     root            18 Jan  1  1970 virtio_gpu_drv_video.so -> d3d12_drv_video.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 vmwgfx_dri.so -> crocus_dri.so
lrwxrwxrwx   73 root     root            13 Jan  1  1970 zink_dri.so -> crocus_dri.so

using driversi686Linux.glxinfo I found a driver mismatch

LIBGL_DEBUG=verbose glxinfo -B
name of display: :0
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/phi/.drirc: No such file or directory.
using driver amdgpu for 4
libGL: Can't open configuration file /etc/drirc: No such file or directory.
libGL: Can't open configuration file /home/phi/.drirc: No such file or directory.
pci id for fd 4: 1002:1681, driver radeonsi
MESA-LOADER: dlopen(/run/opengl-driver-32/lib/dri/radeonsi_dri.so)
DRI driver not from this Mesa build ('23.1.9' vs '24.0.7')
failed to load driver: radeonsi
MESA-LOADER: dlopen(/run/opengl-driver-32/lib/dri/swrast_dri.so)
did not find extension DRI_Kopper version 1
DRI driver not from this Mesa build ('23.1.9' vs '24.0.7')
X Error of failed request:  BadValue (integer parameter out of range for operation)
  Major opcode of failed request:  150 (GLX)
  Minor opcode of failed request:  24 (X_GLXCreateNewContext)
  Value in failed request:  0x0
  Serial number of failed request:  46
  Current serial number in output stream:  47

I also attempted to include driversi686Linux.mesa.drivers, but that fails to build

building '/nix/store/qd0gy6hh4f39jp6gylhgjbmv6ax5ykfy-opengl-drivers.drv'...
building '/nix/store/dqb8n7h0pximqxs7yfn91fzn6sy9hmcn-steam-run-usr-target.drv'...
building '/nix/store/lr1zdd498cjlxr73lavskdv1wb5bm0yq-steam-usr-target.drv'...
error: collision between `/nix/store/8x5kjwlvxxzjq3n28r1ibcj4am11jbd6-mesa-24.0.7-drivers/lib/d3d/d3dadapter9.so.1.0.0' and `/nix/store/hggpnywm6l7cfh2ml1ynm50ap9x4f9rn-mesa-24.0.7-drivers/lib/d3d/d3dadapter9.so.1.0.0'
warning: collision between `/nix/store/ci7gpws8432ilc8r557gbbbdkkgfgiqy-glibc-multi-2.39-52-bin/bin/ldconfig' and `/nix/store/6aqf6q0qvmqywc82rhnmny29li0ybbfh-ldconfig/bin/ldconfig'
warning: collision between `/nix/store/7cad4vjnvzrkbnm0vjg3mpxwh0cnnvn7-glibc-multi-2.39-52/lib/locale/locale-archive' and `/nix/store/hmy0ml9nw48c6znk3vn692m1pvk31k54-glibc-locales-2.39-52/lib/locale/locale-archive'
warning: collision between `/nix/store/c2i631h8i5vcs1sqifwxfsazhwrg6wr5-glibc-2.39-52-bin/bin/ldconfig' and `/nix/store/6aqf6q0qvmqywc82rhnmny29li0ybbfh-ldconfig/bin/ldconfig'
warning: collision between `/nix/store/c2i631h8i5vcs1sqifwxfsazhwrg6wr5-glibc-2.39-52-bin/bin/ldd' and `/nix/store/ci7gpws8432ilc8r557gbbbdkkgfgiqy-glibc-multi-2.39-52-bin/bin/ldd'
warning: collision between `/nix/store/k7zgvzp2r31zkg9xqgjim7mbknryv6bs-glibc-2.39-52/lib/locale/locale-archive' and `/nix/store/hmy0ml9nw48c6znk3vn692m1pvk31k54-glibc-locales-2.39-52/lib/locale/locale-archive'
error: builder for '/nix/store/qd0gy6hh4f39jp6gylhgjbmv6ax5ykfy-opengl-drivers.drv' failed with exit code 25
error: 1 dependencies of derivation '/nix/store/yvak4liywlfpppmhnbdqvbgpp1rg9b1l-nixos-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/wbgd71clkw8yg1bhnzz9wjk8898zq2m6-tmpfiles.d.drv' failed to build
error: 1 dependencies of derivation '/nix/store/6mbga6ryfzvd9rmmy0l2hqx63xch4gz8-etc.drv' failed to build
error: 1 dependencies of derivation '/nix/store/97c0685575ajhrh6vfkjljxjas64gnaq-nixos-system-yoga-01-24.05.1695.dd457de7e08c.drv' failed to build

Steps To Reproduce

Steps to reproduce the behavior:

  1. Enable OpenGL as suggest at OpenGL - NixOS Wiki
  2. Add channel for 24.05 and unpack
  3. Rebuild & Reboot
  4. Run steam in terminal

Expected behavior

AMD 32-bit 3D acceleration worked in 23.11, it should too in 24.05

Additional context

{ config, lib, pkgs, ... }:

{
  options.hardware.amdgpu.loadInInitrd = lib.mkEnableOption (lib.mdDoc
    "loading `amdgpu` kernelModule at stage 1. (Add `amdgpu` to `boot.initrd.kernelModules`)"
  ) // {
    default = true;
  };

  config = lib.mkMerge [
    {
      services.xserver.videoDrivers = lib.mkDefault [ "modesetting" ];

      hardware.opengl = {
        driSupport = lib.mkDefault true;
        driSupport32Bit = lib.mkDefault true;
      };
    }
    (lib.mkIf config.hardware.amdgpu.loadInInitrd {
      boot.initrd.kernelModules = [ "amdgpu" ];
    })
  ];
}

Other relevant bits

  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };
  
  programs.steam.enable = true;
  boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "thunderbolt" "uas" "sd_mod" ];
  boot.initrd.kernelModules = [ "amdgpu" ];
  boot.kernelModules = [ "kvm-amd" "amdgpu"];

Metadata

- system: `"x86_64-linux"`
 - host os: `Linux 6.9.5, NixOS, 24.05 (Uakari), 24.05.1695.dd457de7e08c`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.2`
 - channels(root): `"home-manager-24.05.tar.gz, nixos-24.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
1 Like

Manage to resolve this by nuking everything listed under nix-env -q

I might be getting hit by this too. However i have a flake based setup so I am not sure I understand the resolution. Can someone advise?

As far as I understood so far, flakes only put files on your volumes. You still have to apply those in your config. In my case I had multiple version of Steam deployed (system config and user environment). Removing the faulty one from the Nix user environment resolved it.

My issue was ultimately none of these things. So basically i was running into a conflict between QEMU binfmt and steam, be it the flatpak or the nixos module. Its interestinf because this cross architectural emulation feature breaks the sandbox and causes all kinds of weirdness surrounding the graphics subsystem