Bug 2324342 - XDG_SESSION_TYPE maybe missing or incorrectly set to “wayland”
Summary: XDG_SESSION_TYPE maybe missing or incorrectly set to “wayland”
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: imsettings
Version: 41
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Akira TAGOH
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2024-11-07 10:48 UTC by Mike FABIAN
Modified: 2024-12-27 01:25 UTC (History)
5 users (show)

Fixed In Version: imsettings-1.8.10-1.fc42 imsettings-1.8.10-1.fc41 imsettings-1.8.10-1.fc40
Clone Of:
Environment:
Last Closed: 2024-12-17 13:19:51 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker FC-1349 0 None None None 2024-11-14 03:09:01 UTC

Description Mike FABIAN 2024-11-07 10:48:48 UTC
On Fedora 41, when I  have XFCE installed, reboot the virtual machine and log into XFCE and then check what XDG variables ibus-daemon has in the environmenţ I get this:

mfabian@f41:~$ ps aux | grep ibus-daemon
mfabian     3312  0.0  0.3 684256 13508 ?        Sl   11:12   0:00 /usr/bin/ibus-daemon -r --xim
mfabian     3996  0.0  0.0 230336  2324 pts/0    S+   11:16   0:00 grep --color=auto ibus-daemon
mfabian@f41:~$ cat /proc/3312/environ | tr '\0' '\n' | grep XDG 
XDG_DATA_DIRS=/home/mfabian/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
XDG_RUNTIME_DIR=/run/user/1000
XDG_CURRENT_DESKTOP=XFCE
mfabian@f41:~$ 

Note that XDG_SESSION_TYPE=x11 is missing!

When I reboot again and log into Gnome (Wayland), I get:

mfabian@f41:~$ ps aux | grep ibus-daemon
mfabian     2109  2.1  0.3 610508 12972 ?        Ssl  11:19   0:00 /usr/bin/ibus-daemon --panel disable
mfabian     2950  0.0  0.0 230336  2440 pts/0    S+   11:19   0:00 grep --color=auto ibus-daemon
mfabian@f41:~$ cat /proc/2109/environ | tr '\0' '\n' | grep XDG 
XDG_MENU_PREFIX=gnome-
XDG_SESSION_DESKTOP=gnome
XDG_SESSION_TYPE=wayland
XDG_CURRENT_DESKTOP=GNOME
XDG_SESSION_CLASS=user
XDG_RUNTIME_DIR=/run/user/1000
XDG_DATA_DIRS=/home/mfabian/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/
mfabian@f41:~$ 

Here XDG_SESSION_TYPE=wayland is correctly set. Why is that missing in the XFCE session?

What is even worse: if one logs out of the Gnome Wayland session again and then back into XFCE (I cannot do this with gdm because of https://bugzilla.redhat.com/show_bug.cgi?id=2237652  but for some people this bug does not seem to happen, I used lightdm as a workaround that lets me log out from Gnome and login to XFCE without a reboot). When coming from Gnome Wayland and logging into XFCE without a reboot inbetween, one gets:

mfabian@f41:~$ ps aux | grep ibus-daemon
mfabian    24381  0.1  0.3 610524 13200 ?        Sl   04:17   0:00 /usr/bin/ibus-daemon -r --xim
mfabian    25308  0.0  0.0 230336  2308 pts/2    S+   04:25   0:00 grep --color=auto ibus-daemon
mfabian@f41:~$ cat /proc/24381/environ | tr '\0' '\n' | grep XDG_
XDG_DATA_DIRS=/home/mfabian/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_CACHE_HOME=/home/mfabian/.cache
XDG_CONFIG_DIRS=/etc/xdg
XDG_CONFIG_HOME=/home/mfabian/.config
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/mfabian
XDG_MENU_PREFIX=xfce-
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=gnome
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session1
XDG_SESSION_TYPE=wayland
XDG_CURRENT_DESKTOP=XFCE

So now this is messed up, XDG_SESSION_TYPE=wayland is still there, XDG_SESSION_DESKTOP=gnome is stil there, only XDG_CURRENT_DESKTOP=XFCE shows that it is XFCE which is actually used.

When typing env | grep XDG in the fully started XFCE session, all XDG variables are set correctly. And after restarting ibus with ibus-daemon -drx , ibus-daemon also has the correct XDG environment variables. So they are only wrong when ibus-daemon is first started.

This causes the problem reported in https://github.com/mike-fabian/ibus-typing-booster/issues/561 because XDG_SESSION_TYPE=wayland may still be in the environment of ibus-daemon when a Gnome Wayland session was used before and that causes weird problems in ibus-typing-booster.

https://github.com/mike-fabian/ibus-typing-booster/issues/561

Reproducible: Always

Comment 1 Mike FABIAN 2024-11-07 11:10:41 UTC
I did not manually start ibus, just start the session and ibus started automatically. Probably because of ~/.config/imsettings/xinputrc  Somehow it seems to start too early, before the XDG variables are correctly set. Or the XDG variables are set to late ...

imsettings is installed and the log file contents are:

mfabian@f41:~$ rpm -q imsettings
imsettings-1.8.9-2.fc41.x86_64
mfabian@f41:~$ less ~/.cache/imsettings/log
[        27.501065]: GLib-GIO[6208]: DEBUG: _g_io_module_get_default: Found default implementation dconf (DConfSettingsBacken
d) for 'gsettings-backend'
[        27.501510]: GLib-GIO[6208]: DEBUG: Using cross-namespace EXTERNAL authentication (this will deadlock if server is GD
Bus < 2.73.3)
imsettings information
==========================
XINPUTRC: /home/mfabian/.config/imsettings/xinputrc
          File: /home/mfabian/.config/imsettings/xinputrc -> /etc/X11/xinit/xinput.d/ibus.conf
          Size: 33              Blocks: 8          IO Block: 4096   symbolic link
        Device: 0,50    Inode: 8932        Links: 1
        Access: (0777/lrwxrwxrwx)  Uid: ( 1000/ mfabian)   Gid: ( 1000/ mfabian)
        Context: unconfined_u:object_r:config_home_t:s0
        Access: 2024-11-06 12:11:59.023615313 +0100
        Modify: 2024-10-28 19:59:52.342644651 +0100
        Change: 2024-10-28 19:59:52.342644651 +0100
         Birth: 2024-10-28 19:59:52.342644651 +0100
Is DBus enabled: yes
Is imsettings enabled: yes
Is GTK+ supported: no
Is Qt supported: no
Is Action needed: yes
DESKTOP: XFCE
GUESS_DESKTOP: $XDG_CURRENT_DESKTOP
DISABLE_IMSETTINGS: 
IMSETTINGS_DISABLE_DESKTOP_CHECK: 
DBUS_SESSION_BUS_ADDRESS: unix:path=/run/user/1000/bus
GTK_IM_MODULE: ibus
QT_IM_MODULE: ibus
XMODIFIERS: @im=ibus
IMSETTINGS_MODULE: IBus
IMSETTINGS_INTEGRATE_DESKTOP: yes
IMSETTINGS_DISABLE_SYS_XINPUTRC: no
IMSETTINGS_DISABLE_USER_XINPUTRC: no
IMSETTINGS_IGNORE_SESSION: KDE-wayland


[        28.609198]: IMSettings-Daemon[6208]: WARNING **: Child process exited with code 1
[        28.621743]: IMSettings-Daemon[6208]: INFO: X Display is available
[        29.504001]: IMSettings-Daemon[6208]: INFO: Attempting to switch IM to IBus [lang=en_US.UTF-8, desktop=XFCE, update=f
alse]

[        29.872747]: IMSettings-Daemon[6208]: WARNING **: Child process exited with code 1
[        29.873196]: IMSettings-Daemon[6208]: INFO:   no need to invoke any auxiliary process for IBus
[        29.873217]: IMSettings-Daemon[6208]: INFO:   Starting the main process for IBus [lang:en_US.UTF-8]
[        29.875730]: IMSettings-Daemon[6208]: INFO:   Started IBus: [process: /usr/bin/ibus-daemon -r --xim, lang: en_US.UTF-
8, pid: 7456, id: 31, time: 2024-11-07T11:32:29.875712+01
[        29.875835]: IMSettings-GSettings backend[6208]: INFO: Setting up ibus:xim as gtk+ immodule
[        30.259198]: IBus[7456]: ibus-m17n-Message: 11:32:30.255: skipped m17n:ko:han2 since its rank is lower than 0

[        30.259466]: IBus[7456]: ibus-m17n-Message: 11:32:30.259: skipped m17n:ko:romaja since its rank is lower than 0

Comment 2 Mike FABIAN 2024-11-07 11:11:34 UTC
The environment of imsettigns-daemon is:

mfabian@f41:~$ ps aux | grep imsettings-daemon
mfabian     6208  0.0  0.2 535056  9000 ?        Ssl  11:32   0:00 /usr/libexec/imsettings-daemon
mfabian     8099  0.0  0.0 230468  2356 pts/0    S+   11:59   0:00 grep --color=auto imsettings-daemon
mfabian@f41:~$ cat /proc/6208/environ | tr '\0' '\n' | grep XDG 
XDG_DATA_DIRS=/home/mfabian/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
XDG_RUNTIME_DIR=/run/user/1000
XDG_CACHE_HOME=/home/mfabian/.cache
XDG_CONFIG_DIRS=/etc/xdg
XDG_CONFIG_HOME=/home/mfabian/.config
XDG_CURRENT_DESKTOP=GNOME
XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/mfabian
XDG_MENU_PREFIX=gnome-
XDG_SEAT_PATH=/org/freedesktop/DisplayManager/Seat0
XDG_SESSION_CLASS=user
XDG_SESSION_DESKTOP=gnome
XDG_SESSION_PATH=/org/freedesktop/DisplayManager/Session0
XDG_SESSION_TYPE=wayland
mfabian@f41:~$ 

Which is wrong because it is not a Gnome Wayland session anymore.
That was the previous session, now XFCE is running.

Comment 3 Mike FABIAN 2024-11-07 11:12:59 UTC
To be able to test this at all I had to use lightdm instead of gdm because of https://bugzilla.redhat.com/show_bug.cgi?id=2237652
So I did:

mfabian@f41:~$ sudo dnf install lightdm lightdm-gtk
Updating and loading repositories:
Repositories loaded.
Package "lightdm-1.32.0-11.fc41.x86_64" is already installed.
Package "lightdm-gtk-2.0.8-10.fc41.x86_64" is already installed.

Nothing to do.
mfabian@f41:~$ sudo systemctl disable gdm --now
Removed '/etc/systemd/system/display-manager.service'.
mfabian@f41:~$ sudo systemctl enable lightdm --now

and then did the above tests.

Comment 4 Mike FABIAN 2024-12-17 09:57:04 UTC
I tested with imsettings-1.8.9-2.1.fc41.x86_64 from https://copr.fedorainfracloud.org/coprs/tagoh/imsettings/ and it fixes the problem. 

imsettings-daemon still has XDG_SESSION_TYPE=wayland in its environment after switching from Gnome Wayland to XFCE, but it passes the correct value XDG_SESSION_TYPE=x11 to ibus-daemon which fixes the problem.

Comment 5 Fedora Update System 2024-12-17 13:14:53 UTC
FEDORA-2024-22d0bf4968 (imsettings-1.8.10-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-22d0bf4968

Comment 6 Fedora Update System 2024-12-17 13:19:51 UTC
FEDORA-2024-22d0bf4968 (imsettings-1.8.10-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 7 Fedora Update System 2024-12-17 14:54:33 UTC
FEDORA-2024-9c1899392e (imsettings-1.8.10-1.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-9c1899392e

Comment 8 Fedora Update System 2024-12-17 14:54:33 UTC
FEDORA-2024-ad5fb2660e (imsettings-1.8.10-1.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-ad5fb2660e

Comment 9 Fedora Update System 2024-12-19 03:57:00 UTC
FEDORA-2024-ad5fb2660e has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-ad5fb2660e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-ad5fb2660e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2024-12-19 05:31:00 UTC
FEDORA-2024-9c1899392e has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-9c1899392e`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-9c1899392e

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2024-12-27 01:21:23 UTC
FEDORA-2024-ad5fb2660e (imsettings-1.8.10-1.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 12 Fedora Update System 2024-12-27 01:25:01 UTC
FEDORA-2024-9c1899392e (imsettings-1.8.10-1.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.