3

I have been using Ubuntu 24.04 on Wayland for quite some time now but yesterday I failed to login via Wayland, only xorg works.

I ran journalctl -b and found this related log:

[email protected] - GNOME Shell on Wayland was skipped because of an unmet condition check (ConditionEnvironment=XDG_SESSION_TYPE=wayland).

My system:

                          ./+o+-       hasan@hasan-Nitro-AN515-43
                  yyyyy- -yyyyyy+      OS: Ubuntu 24.04 noble
               ://+//////-yyyyyyo      Kernel: x86_64 Linux 6.8.0-39-generic
           .++ .:/++++++/-.+sss/`      Uptime: 23m
         .:++o:  /++++++++/:--:/-      Packages: 2337
        o:+o+:++.`..```.-/oo+++++/     Shell: zsh 5.9
       .:+o:+o/.          `+sssoo+/    Resolution: 1920x1080
  .++/+:+oo+o:`             /sssooo.   DE: GNOME 46.0.1
 /+++//+:`oo+o               /::--:.   WM: Mutter
 \+/+o+++`o++o               ++////.   WM Theme: 
  .++.o+++oo+:`             /dddhhh.   GTK Theme: Yaru-magenta-dark [GTK2/3]
       .+.o+oo:.          `oddhhhh+    Icon Theme: Yaru-magenta
        \+.++o+o``-````.:ohdhhhhh+     Font: Ubuntu Sans 11
         `:o+++ `ohhhhhhhhyo++os:      Disk: 82G / 234G (37%)
           .o:`.syhhhhhhh/.oo++o`      CPU: AMD Ryzen 7 3750H with Radeon Vega Mobile Gfx @ 8x 2.3GHz
               /osyyyyyyo++ooo+++/     GPU: NVIDIA GeForce GTX 1650
                   ````` +oo+++o\:     RAM: 4198MiB / 13911MiB
                          `oo++.   

I found related Reddit that deals with the problem on Arch

1
  • What does your last sentence mean?
    – David DE
    Commented Aug 13 at 8:42

2 Answers 2

2

According to SystemD docs (emphasis added):

Processes started by the service manager are executed with an environment variable block assembled from multiple sources. Processes started by the system service manager generally do not inherit environment variables set for the service manager itself (but this may be altered via PassEnvironment=), but processes started by the user service manager instances generally do inherit all environment variables set for the service manager itself.

For each invoked process the list of environment variables set is compiled from the following sources:

  • Variables globally configured for the service manager, using the DefaultEnvironment= setting in systemd-system.conf(5), [...SNIP...]

  • Variables defined by the service manager itself (see the list below).

[...SNIP...]

The list of variables defined by the service manager only includes the following:

  • $PATH
  • $LANG
  • $USER, $LOGNAME, $HOME, $SHELL
  • $INVOCATION_ID
  • $XDG_RUNTIME_DIR
  • $RUNTIME_DIRECTORY, $STATE_DIRECTORY, $CACHE_DIRECTORY, $LOGS_DIRECTORY, $CONFIGURATION_DIRECTORY
  • $CREDENTIALS_DIRECTORY
  • $MAINPID
  • $MANAGERPID
  • $LISTEN_FDS, $LISTEN_PID, $LISTEN_FDNAMES
  • $NOTIFY_SOCKET
  • $WATCHDOG_PID, $WATCHDOG_USEC
  • $SYSTEMD_EXEC_PID
  • $TERM
  • $LOG_NAMESPACE
  • $JOURNAL_STREAM
  • $SERVICE_RESULT
  • $EXIT_CODE, $EXIT_STATUS
  • $MONITOR_SERVICE_RESULT, $MONITOR_EXIT_CODE, $MONITOR_EXIT_STATUS, $MONITOR_INVOCATION_ID, $MONITOR_UNIT
  • $PIDFILE
  • $REMOTE_ADDR, $REMOTE_PORT
  • $TRIGGER_UNIT, $TRIGGER_PATH, $TRIGGER_TIMER_REALTIME_USEC, $TRIGGER_TIMER_MONOTONIC_USEC
  • $MEMORY_PRESSURE_WATCH, $MEMORY_PRESSURE_WRITE
  • $FDSTORE

Notably, this list does not include XDG_SESSION_TYPE, which it appears that the Gnome Shell user unit is trying to use in ConditionEnvironment=XDG_SESSION_TYPE=wayland.

You will probably need to import this variable into the SystemD session. The systemctl --user import-environment command should be able to import environment variables into the user service manager's environment. You will need to run this command in a place where the environment variable $XDG_SESSION_TYPE is set. Usually it should be set at some point by the display or session manager that launches your desktop environment, or else inside the initialization of that desktop environment itself (for example: Sway does this on Arch Linux).

In your specific case for Gnome, I think this is gnome-session which used to be able to execute a login shell (e.g. running ~/.profile, ~/.bash_profile, etc..) However, this may have changed given the discussion of phasing out the login shell functionality.

EDIT: Digging further into this^1, it seems that this previous login shell functionality has been reimplemented instead using SystemD's support for environment.d drop-in files, as well as systemd.environment-generators. There is also a backwards-compatibility feature wherein the SystemD package includes a symlink to the older /etc/environment file, named: /usr/lib/environment.d/99-environment.conf. This /etc/environment file is still apparently owned and used by the core/pam package on ArchLinux, for example. In theory, the newer environment.d and generators are probably the best place for any SystemD-based distro, such as Ubuntu, to be using for this type of thing. However, in practice, it may not be well-known or utilized enough by current distros and Wayland graphical session packages.

In any case, you'll need to find a way to set the XDG_SESSION_TYPE variable appropriately so it can be used by the SystemD user service manager. One method would be to execute the following in an environment where XDG_SESSION_TYPE has been set to wayland by the session login process:

systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP

To test it manually from the tty console, you might be able to manually set these and run:

export XDG_SESSION_TYPE=wayland
export XDG_CURRENT_DESKTOP=ubuntu:GNOME
systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP
systemctl --user start [email protected]

# You can watch logs on another tty with:
journalctl -xen100 --user-unit  -f

Optionally, you can switch to another tty (Ctrl + Alt + F2) and start the journalctl command first to get the log following started. Then, switch back (Ctrl + Alt + F1) and run the rest of the export and systemctl commands to import environment vars and trigger the user service unit. Finally, switch back (Ctrl + Alt + F2) to check the resulting logs. Note: The initial tty number may be different depending on the version of Ubuntu you're running (e.g. it used to be F7 for graphical sessions, but I think that may have changed back to F1).

1

There is a number of things to check for this to work.

First, make sure that your display manager (like GDM) is correctly set to use Wayland. You can check this by looking into the GDM configuration file.

sudo nano /etc/gdm3/custom.conf 

Look for the line that says #WaylandEnable=false. If it is uncommented (i.e., without the #), it means Wayland is disabled. You can comment it out (by adding # at the beginning) or set it to WaylandEnable=true. Save the file and restart the service:

sudo systemctl restart gdm

Check whether the environment variable XDG_SESSION_TYPE is being set to "wayland" when you attempt to log in.

You can check this by logging into Xorg, opening a terminal, and running:

echo $XDG_SESSION_TYPE

Still ain't working? Look in the logs:

journalctl -xe | grep -i gdm

and

journalctl -xe | grep -i wayland

It could also be related with your user, so create another user and try to start a session as that user.

If all that fails, then perhaps you should have started by reinstalling it, but you may still do it:

sudo apt install --reinstall gnome-shell gdm3

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .