Fix: GDM does not start GNOME Wayland even if it is selected by default, starts X11 instead

Dont know where to put this but this is a problem I had and fixed so I want to note it down somewhere.

I have Gnome and GDM installed through configuration.nix:

	services.xserver = {
		enable = true;
		desktopManager.gnome.enable = true;
		displayManager.gdm.enable = true;
	};

With this config, whenever I boot my PC, I expect it to log into Gnome Wayland because it was the last session I started. However, Gnome with X11 will start.

If I want it to start Gnome Wayland, I need to click my username in the GDM screen, and open the session selection. It has two entries: “Gnome” and “Gnome (X11)”. I need to click the “Gnome” entry which is already selected (!), close the session selection, then log in. Then Gnome will start with Wayland.

I fixed this by adding services.xserver.desktopManager.default = "gnome"; to my configuration.nix.

This Topic might be related because for me, this also happens since trying out KDE, I believe.

1 Like

confirming that this fixes Gnome Wayland auto-login for me, very nice

Cool, thanks. I have noticed a few times the desktop apparently regressing to X rather than wayland, despite never selecting it and this:

I need to click the “Gnome” entry which is already selected (!)

also being the case for me. I don’t know what triggered it.

I fixed this by adding services.xserver.desktopManager.default = "gnome"

Note there’s a deprecation comment on that entry, it seems to have been renamed to services.xserver.displayManager.defaultSession.

Changing the default like this seems like it still might be fragile, if the cause is unknown, though I will add it anyway since it seems to help.

Is there a way to not install the X11 session at all?

1 Like

The only thing this does in GDM is setting the preferred session to log into in AccountService. This should be equivalent to selecting it manually in the session chooser.

In the worst case, when GNOME Shell detects problems on startup, it will just fall back to X session regardless the value of services.xserver.displayManager.defaultSession.

But then, the only thing services.xserver.displayManager.defaultSession = "gnome" achieves is that Wayland session will be tried every time. There will not be any guarantee of not falling back on XOrg until the underlying issue (e.g. buggy extension, GPU driver issues, Shell bug…) is resolved.

Not really. You could try patching the appropriate packages to remove the xorg session files but GNOME currently does not support building without X server – Mutter support for that has only just been merged – so if the fallback session were to be not found, it would probably break horribly.

1 Like
Hosted by Flying Circus.