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

Changing from 22.11 to 23.05 has broken libGL #237938

Closed
LiquidZulu opened this issue Jun 15, 2023 · 11 comments
Closed

Changing from 22.11 to 23.05 has broken libGL #237938

LiquidZulu opened this issue Jun 15, 2023 · 11 comments
Labels
0.kind: bug Something is broken

Comments

@LiquidZulu
Copy link

Describe the bug

Upon trying to launch kitty after updating my NixOS I get the following error:

libGL error: MESA-LOADER: failed to open nouveau: /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/5zzbdhg945bafahn0x9xwsx8rm1f615d-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)
libGL error: failed to load driver: nouveau
libGL error: MESA-LOADER: failed to open nouveau: /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/5zzbdhg945bafahn0x9xwsx8rm1f615d-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)
libGL error: failed to load driver: nouveau
libGL error: MESA-LOADER: failed to open swrast: /nix/store/9xfad3b5z4y00mzmk2wnn4900q0qmxns-glibc-2.35-224/lib/libc.so.6: version `GLIBC_2.36' not found (required by /nix/store/5zzbdhg945bafahn0x9xwsx8rm1f615d-llvm-15.0.7-lib/lib/libLLVM-15.so) (search paths /run/opengl-driver/lib/dri, suffix _dri)
libGL error: failed to load driver: swrast
[166 14:28:31.404933] [glfw error 65543]: GLX: Failed to create context: GLXBadFBConfig
[166 14:28:31.404961] Failed to create GLFW temp window! This usually happens because of old/broken OpenGL drivers. kitty requires working OpenGL 3.3 drivers.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Have a working kitty on 22.11
  2. Update to 23.05
  3. Try to start kitty

Expected behavior

kitty launching without issue.

Additional context

NixGL

The above error is indicating that OpenGL is out of date, or perhaps there is some mismatch which occurred when switching channels. Elsewhere (reddit thread, github issue), NixGL has been suggested as a solution, and seemingly works for some people. However, NixGL seems to be designed specifically to solve a similar issue which appears when using Nix on non-NixOS, which is not applicable to my case.

Nouveau drivers

Also mentioned as a potential solution (here and here) is to use nouveau drivers, but this did not work for me, I changed the below configuration:

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

{
  # See https://nixos.wiki/wiki/Nvidia
  services.xserver.videoDrivers = [
    "nvidia" # https://github.com/NixOS/nixpkgs/issues/80936#issuecomment-1003784682
  ];
  hardware.opengl.enable = true;

  # Optionally, you may need to select the appropriate driver version for your specific GPU.
  hardware.nvidia.package = config.boot.kernelPackages.nvidiaPackages.stable;

  # nvidia-drm.modeset=1 is required for some wayland compositors, e.g. sway
  hardware.nvidia.modesetting.enable = true;
}

to use services.xserver.videoDrivers = [ "nouveau" ]; to no avail

I don't know how to run glxinfo

This comment asks OP to run nix run nixpkgs.glxinfo -c glxinfo | grep OpenGL to diagnose what looks to be a similar problem, but when I try this I get error: unrecognised flag '-c'.

Alacritty is also broken

I am getting the same error when I try to start alacritty (through nix-shell -p alacritty)

Notify maintainers

@tex @rvolosatovs @Luflosi @adamcstephens

Metadata

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

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.33, NixOS, 23.05 (Stoat), 23.05.20230614.ddf4688`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.15.1`
 - channels(root): `"nixos-22.11"`
 - channels(liquidzulu): `"nixos-23.05"`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`
@LiquidZulu LiquidZulu added the 0.kind: bug Something is broken label Jun 15, 2023
@adamcstephens
Copy link
Contributor

 - channels(root): `"nixos-22.11"`

Your system is not fully updated to 23.05, only your user channel is. Please update root's channel and rebuild/switch your system.

@LiquidZulu
Copy link
Author

Ah, that would explain it. How do I go about doing this? I am using a flake for my system config and ripgrep shows only stateVersion as 22.11 (which by my understanding should not be changed).
image

@adamcstephens
Copy link
Contributor

If you're using a flake for your configuration, then the channels from the nix-info output don't matter. Your version comes from the flake inputs and is stored in flake.lock. (The stateVersion's are based on initial setup values and don't/shouldn't change for versions)

Is your config in a public repo?

@LiquidZulu
Copy link
Author

LiquidZulu commented Jun 15, 2023

Indeed it is: https://github.com/LiquidZulu/.nixcfg

I have been updating the lock files (edit: nix flake update ~/.nixcfg) prior to rebuilding (edit: sudo nixos-rebuild switch --flake ~/.nixcfg) but perhaps I have made a mistake elsewhere

@ic4-y
Copy link

ic4-y commented Jun 15, 2023

I assume there must be a mistake somewhere. I had the same error with alacritty, but my flake is separating home-manager config and system config. I had updated the system, but not rebuilt my home-manager config (which includes alacritty). After doing this, the problem went away.

@LiquidZulu
Copy link
Author

Ah, I will see if my flake is doing anything similar to that (I didn't write it for the most part). @Lord-Valen any ideas?

@Artturin
Copy link
Member

Artturin commented Jun 15, 2023

This is due to using mismatched revisions

you have stable and unstable so could be causing your issue depending on where you're using them

Remove unneeded channels or pin them in your config when using flakes

@LiquidZulu
Copy link
Author

I commented out the unstable branch and the issue persists, if that is what you are meaning: LiquidZulu/.nixcfg@bfb29b3

@Artturin
Copy link
Member

Artturin commented Jun 16, 2023

Make sure you dont have any nix-env or nix profile packages for root or for user

And remove the channels or pin to flake rev

@LiquidZulu
Copy link
Author

Ah, that fixed it, thank you. It also fixed a completely unrelated issue I have been having from the same cause. I removed all of the nix profile packages and it is working now.

@greenm01
Copy link

I was having this same issue with several opengl apps. As suggested in this thread, I did the following on my home-manager flake in ~/.config/home-manager

nix flake update
home-manager switch

Boom, problem solved! Thanks!

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

5 participants