Cannot switch to X11 after switching to Wayland

Hi there, welp I got a problem in the first day, ad that is I switched to Wayland and cannot switch back. I also cannot open any Garuda app and when I try, this happens:

❯ garuda-settings-manager
error: XDG_RUNTIME_DIR not set in the environment.
Failed to create wl_display (No such file or directory)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, xcb.

And echo $XDG_SESSION_TYPE shows wayland

So, I tried a couple of things, first to edit the custom.conf file in /etc/gdm/ and uncomented the WaylandEnable=False line but no avail. I tried stopping GDM and all the GNOME processes and starting the ./Xsession file, nothing happened. Please help me out!

  1. Go to TTY3
  2. Login and run
sudo systemctl stop gdm
sudo /usr/lib/gdm-disable-wayland
sudo systemctl start gdm

If these fail, report error messages.

4 Likes

@petsam It still shows Wayland and all my customizations are gone :confused:

Can you describe how you did that switch to Wayland and how you thought you would switch back?
It seems you might have done something wrong.
Check your dot files (.bashrc, .zshrc, etc) for related settings.
The env variable required for session type can be set by system, DM and local user settings.

1 Like

I switched via garuda-assistant
I found a temporary fix tho,

sudo systemctl stop gdm
gnome-session

It is still wayland, but apps work!

Dear friend, this case leads to terror stories with ghosts and I am not a fun. I prefer SciFi movies.
Please, check your real visible data, like journal log and files that source environment variables values.

1 Like

what logs do ya want?

There are 2 files for Wayland. Using file manager search, search for the same custom.conf file. There are 2 different files. Custom.conf and custom.conf.pacnew.

Check and post:

ls -l /usr/share/xsessions/
env | grep -iE "x11|wayland"
grep -siE "x11|wayland" /etc/security/pam_env.conf /etc/environment  ~/\.pam_environment
grep -siE "x11|wayland" ~/\.bashrc ~/\.zshrc ~/\.profile ~/\.xinitrc ~/\.xprofile
2 Likes
❯ ls -l /usr/share/xsessions/
total 24
-rw-r--r-- 1 root root 7874 Dec  3 06:02 gnome-classic.desktop
-rw-r--r-- 1 root root 7829 Sep 27 02:01 gnome.desktop
-rw-r--r-- 1 root root 7914 Sep 27 02:01 gnome-xorg.desktop

❯ env | grep -iE "x11|wayland"
WAYLAND_DISPLAY=wayland-0
MOZ_ENABLE_WAYLAND=1 
QT_QPA_PLATFORM=wayland
XDG_SESSION_TYPE=wayland
XAUTHORITY=/run/user/1000/.mutter-Xwaylandauth.WT2OV0

❯ grep -siE "x11|wayland" /etc/security/pam_env.conf /etc/environment  ~/\.pam_environment
/etc/security/pam_env.conf:#:/usr/bin:/usr/local/bin/X11:/usr/bin/X11
/etc/environment:QT_QPA_PLATFORM=wayland
/etc/environment:MOZ_ENABLE_WAYLAND=1 
/etc/environment:XDG_SESSION_TYPE=wayland

❯ grep -siE "x11|wayland" ~/\.bashrc ~/\.zshrc ~/\.profile ~/\.xinitrc ~/\.xprofile
/home/******/.xinitrc:sysresources=/etc/X11/xinit/.Xresources
/home/******/.xinitrc:sysmodmap=/etc/X11/xinit/.Xmodmap
/home/******/.xinitrc:if [ -d /etc/X11/xinit/xinitrc.d ] ; then
/home/******/.xinitrc:    for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do

Disable (add # at line start) or delete these lines.
Have you added these lines or were there by installation, or a utility (if you know)?

1 Like

I'll try this out when I get time.

Most likely this is done by Garuda Assistant GDM toggle. It adds these to /etc/environment as Wayland doesnt use .profile

If toggling works as expected (revert what was changed by the utility), it's a user error (probably), or we could improve info message in Assistant.
I couldn't find Wayland setting in my system. On KDE, maybe that's why?

Yeah I think @librewish made it show only on GNOME systems to prevent bad use

#!/bin/bash
if [[ -e /etc/gdm/custom.conf ]]; then
	sed -i -e 's|.*WaylandEnable=false|#WaylandEnable=false|g' /etc/gdm/custom.conf
fi 

cp /etc/environment /etc/environment.bak

echo "QT_QPA_PLATFORM=wayland
_JAVA_AWT_WM_NONREPARENTING=1
MOZ_ENABLE_WAYLAND=1 
XDG_SESSION_TYPE=wayland
EDITOR=/usr/bin/micro
BROWSER=firefox
TERM=alacritty
MAIL=geary
QT_QPA_PLATFORMTHEME=qt5ct" >> /etc/environment
#!/bin/bash
if [[ -e /etc/gdm/custom.conf ]]; then
	sed -i -e 's|.*WaylandEnable=false|WaylandEnable=false|g' /etc/gdm/custom.conf
fi 

mv /etc/environment.bak /etc/environment

Should work as expected.

1 Like

My perception is applying user level configuration, when possible, depending on the function.
Also, in case an application/service setting can accomplice desired functionality, prefer that against applying system-wide configuration.
In this case - keep in mind I have no experience on Wayland - I would try to apply wayland session on user account session, using user $HOME config files. Next I would try set (G/SD)DM to provide an option (IIRC using xsessions), so the user may choose the session type at login. If nothing is adequate, I would try a script file in /etc/profile.d/, which can be added/removed/disabled, leaving script sed/greping as an emergency temporary workaround.

1 Like

Umm. Well, after doing it, I can't sign in now. I mean not even from a tty or cockpit. What the hell happened now?

What have you done exactly?

You may always use Garuda ISO booting and change what you did.

1 Like

Oh, don't worry, just Windows Update doing it's thing. I am reinstalling Garuda and removing Windows. Will dualboot something else.

Hi all!
i have the same issue
i have change session on wayland in garuda welcome => garuda assistant
then reboot my desctop, and some configurations of GNOME (dark theme in case) stoped working.
then i have tried to run garuda assistant again, but this app won't work on GNOME-wayland-session.
so i opened this forum-page and comment those three strings in "/etc/environment".
so tnx you guys))