Sway fails startup after 23.05 -> 23.11 update

Hi all,
after updating my nixos and home-manager from 23.05 to 23.11 sway fails to start.
I’ve tried anything I found here and on GitHub, but it seems I’ve missed something…
Therefore any help is greatly appreciated!

The sway error is:

00:00:00.016 [ERROR] [wlr] [render/egl.c:204] EGL_EXT_platform_base not supported
00:00:00.016 [ERROR] [wlr] [render/egl.c:506] Failed to create EGL context
00:00:00.016 [ERROR] [wlr] [render/gles2/renderer.c:679] Could not initialize EGL
00:00:00.016 [ERROR] [wlr] [render/wlr_renderer.c:333] Could not initialize renderer
00:00:00.016 [ERROR] [wlr] [backend/drm/renderer.c:27] Failed to create renderer
00:00:00.016 [ERROR] [wlr] [backend/drm/backend.c:256] Failed to initialize renderer
00:00:00.016 [ERROR] [wlr] [backend/backend.c:228] Failed to create DRM backend
00:00:00.016 [ERROR] [wlr] [render/egl.c:204] EGL_EXT_platform_base not supported
00:00:00.017 [ERROR] [wlr] [render/egl.c:506] Failed to create EGL context
00:00:00.017 [ERROR] [wlr] [render/gles2/renderer.c:679] Could not initialize EGL
00:00:00.017 [ERROR] [wlr] [render/wlr_renderer.c:333] Could not initialize renderer
00:00:00.017 [ERROR] [sway/server.c:79] Failed to create renderer

I’m currently aiming to only use the intel GPU of my Dell XPS:

$ nix-shell -p pciutils --run "lspci -nn | grep VGA"
0000:00:02.0 VGA compatible controller [0300]: Intel Corporation Alder Lake-P Integrated Graphics Controller [8086:46a6] (rev 0c)
0000:01:00.0 VGA compatible controller [0300]: NVIDIA Corporation GA106M [GeForce RTX 3060 Mobile / Max-Q] [10de:2520] (rev a1)

I’m updating from 23.05 to 23.11 using:

sudo nix-channel --add https://channels.nixos.org/nixos-23.11 nixos
sudo nix-channel --add https://github.com/nix-community/home-manager/archive/release-23.11.tar.gz home-manager
sudo nix-channel --update
sudo nixos-rebuild switch --upgrade
reboot

My relevant nixos config is:

  boot.initrd.kernelModules = [ "dm-snapshot" "i915" ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  environment.variables = {
    VDPAU_DRIVER = lib.mkIf config.hardware.opengl.enable (lib.mkDefault "va_gl");
  };

  hardware.opengl.extraPackages = with pkgs; [
    (if (lib.versionOlder (lib.versions.majorMinor lib.version) "23.11") then vaapiIntel else intel-vaapi-driver)
    libvdpau-va-gl
    intel-media-driver
  ];

  hardware.opengl = {
    enable = true;
    driSupport = true;
    driSupport32Bit = true;
  };

  programs.sway.enable = true;
  xdg.portal.wlr.enable = true;

  security.polkit.enable = true;
  security.pam.loginLimits = [
    { domain = "@users"; item = "rtprio"; type = "-"; value = 1; }
  ];
  services.fwupd.enable = true;

And my relevant home-manager config is:

    wayland.windowManager.sway = {
      enable = true;
      ...
    };

As mentioned above, any help is greatly appreciated! If any further information would be helpful, please just ask.

Thanks & regards;g0hl1n

Just a quick question, why do you have Sway both in your home-manager config and your system config?

Other than that: do you have similar issues with other stuff running on Wayland ?

2 Likes

Thanks for your reply.

The duplicated sway is most likely an artifact of my many tries to fix the problem. Thanks for the catch! I removed it and it still shows the same behavior… Works on 23.05… doesnt on 23.11…

Ive just tried to run a plain weston on 23.11 and it did work. Thanks for that pointer. Do you have any idea what the exact problem could be that breaks sway but doesnt affect weston?

thanks and regards. g0hl1n

For all I can say, it might be an issue in Sway itself. Did you check their GitHub (if they are on Github?) or any outstanding issues?

Sway refuse to take any nvidia-related issues because nvidia are doing an nvidia making it hard for them to debug anything.

The latest nvidia driver is incredibly broken on wayland, you need to use the production one: Update to Nixos 23.11 by TLATER · Pull Request #301 · TLATER/dotfiles · GitHub

Share your channels and stuff with nix-shell -p nix-info --run "nix-info -m" while you’re at it, I had this same issue when I was messing with mixing unstable/23.11, though I think I resolved it by switching to the production driver.

Weston is not a wlroots compositor, and this ultimately boils down to wlroots calling an API that the nvidia driver doesn’t support (anymore? nvidia driver seems to have made this disappear, misbehave or otherwise change, but it’s not FOSS so it’s hard to know why or what changed). Iirc when I dug into this it looks like the next wlroots release will handle this issue more gracefully, not specifically for nvidia, but I couldn’t get sway to compile against a newer wlroots to confirm (it’s pinned to 0.16 for the moment, dunno why).

1 Like

this ultimately boils down to wlroots calling an API that the nvidia driver doesn’t support

So that is really helpful info right there! Appears we found our (preliminary) answer what causes this.

So I guess downgrading the Nvidia drivers for the time being might be a workaround? At least until sway gets compiled against a newer wlroots version?

Yep, that’s what I mean by the “production” driver - the link just points to how I use the production driver currently.

Thanks for your detailed response. I will try to test the nvidia production driver in the next days.

Nonetheless I was currently aiming for using the intel gpu as mentioned above. And according to my knowledge I have enabled the intel gpu only with the provided nix config. Do you have any ideas on why the intel gpu is not working?

Thanks & regards;rl

Oh, sorry, I completely skimmed past that once I saw an nvidia gpu and assumed you were doing the usual prime offload thing!

At a glance, your config looks correct. I know others have run into this trying to use home-manager+sway in the past since they did not then enable hardware.opengl, which would have similar symptoms. Are you sure your system has hardware.opengl enabled properly? Have you rebooted since?

Any chance you could use the NixOS module to enable sway just for the sake of argument? You can still configure sway with home-manager if you use the NixOS module to install sway.

Sorry for the late response, was a busy time…

I finally took another try on this problem and tried to install sway via the NixOS module. But unfortunately this results in the same error for 23.11. (Testing it on 23.05 worked).

Yes I just double checked my hardware.opengl config:

hardware.opengl = {
  enable = true;
  driSupport = true;
  driSupport32Bit = true;
};

Later today I will try setting up the nvidia driver as described above (instead of the intel one).

Any help or further pointers are greatly appreciated :wink: