Bug 1921947

Summary: Live installer fails to run on current Rawhide Plasma / KDE: "RuntimeError: Gtk couldn't be initialized."
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: kwinAssignee: Neal Gompa <ngompa13>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 34CC: aleixpol, anaconda-maint-list, bcotton, jgrulich, jonathan, kde-sig, kellin, me, ngompa13, rdieter, robatino, than, vanmeeuwen+fedora, vponcova, wwoods
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: openqa
Fixed In Version: kwin-5.20.90-4.fc34 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-02-12 21:49:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1829022    
Attachments:
Description Flags
Screenshot of Anaconda working with xhost +
none
Diff of the environment variables between GNOME and KDE Plasma none

Description Adam Williamson 2021-01-28 22:37:25 UTC
Trying to run the live installer on current Rawhide KDE images fails with this output:

[liveuser@localhost-live ~]$ liveinst 
Starting installer, one moment...
anaconda 34.20-1.fc34 for Fedora 34 (pre-release) started.
 * installation log files are stored in /tmp during the installation
 * shell is available on TTY2 and in second TMUX pane (ctrl+b, then press 2)
 * when reporting a bug add logs from /tmp as separate text/plain attachments
No protocol specified
No protocol specified
Traceback (most recent call last):
  File "/sbin/anaconda", line 516, in <module>
    display.setup_display(anaconda, opts)
  File "/usr/lib64/python3.9/site-packages/pyanaconda/display.py", line 359, in setup_display
    anaconda.initInterface()
  File "/usr/lib64/python3.9/site-packages/pyanaconda/anaconda.py", line 284, in initInterface
    self._intf = GraphicalUserInterface(None, self.payload,
  File "/usr/lib64/python3.9/site-packages/pyanaconda/ui/gui/__init__.py", line 554, in __init__
    self.mainWindow = MainWindow(fullscreen=fullscreen, decorated=conf.ui.decorated_window)
  File "/usr/lib64/python3.9/site-packages/pyanaconda/ui/gui/__init__.py", line 261, in __init__
    super().__init__()
  File "/usr/lib/python3.9/site-packages/gi/overrides/Gtk.py", line 515, in __init__
    raise RuntimeError(
RuntimeError: Gtk couldn't be initialized. Use Gtk.init_check() if you want to handle this case.

This does not happen on the Workstation image, so it's something to do with the KDE environment (possibly related to its recent switch to Wayland?), but I'm not sure what. CCing rdieter.

Comment 1 Adam Williamson 2021-01-28 22:38:11 UTC
This is a clear violation of https://fedoraproject.org/wiki/Basic_Release_Criteria#Installer_must_run , "The installer must run when launched normally from the release-blocking images."

Comment 3 Adam Williamson 2021-01-29 23:29:10 UTC
So...not really figured this out yet, but got a bit more data anyway.

It broke between 20210124.n.0 and 20210127.n.1 (there are no successful composes between those too), by the looks of things. anaconda didn't change in 01217.n.1, and neither did anything GTK+-y or gobject-y that I can see. What did change is indeed plasma-workspace, from 5.20.90-3 to 5.20.90-5, which included the systemd user sessions change.

The problem seems to be that GTK initialization is failing at the bottom of gi/overrides/Gtk.py , where it does (for GTK+ 3, which is what we're on) `initialized, argv = Gtk.init_check(sys.argv)` . If you add a debug print right there, it shows that `initialized` winds up as False. The console line "No protocol specified" is printed during this check, but I'm not sure if that's significant or not.

I reduced Gtk.py to what should be a simple reproducer, but it *doesn't* reproduce, at least not when run directly:

    import sys

    from gi.repository import GObject
    from gi.module import get_introspection_module


    Gtk = get_introspection_module('Gtk')
    initialized, argv = Gtk.init_check(sys.argv)

    print(initialized)

if I run that directly as liveuser or root, it prints True. So either something else about what Gtk.py does, or what gets done before it, or about running through consolehelper, results in the different outcome, I guess.

Comment 4 Adam Williamson 2021-01-29 23:30:32 UTC
re-assigning to plasma-workspace, at least tentatively.

Comment 5 Neal Gompa 2021-02-04 04:18:19 UTC
Switching off systemd user sessions by renaming /etc/xdg/startkderc to /etc/xdg/startkderc.disabled does not fix this.

I attempted to run Anaconda (by running liveinst in Konsole) and still get the same traceback as I do with systemd user sessions enabled.

Comment 6 Neal Gompa 2021-02-04 04:36:12 UTC
(In reply to Neal Gompa from comment #5)
> Switching off systemd user sessions by renaming /etc/xdg/startkderc to
> /etc/xdg/startkderc.disabled does not fix this.
> 
> I attempted to run Anaconda (by running liveinst in Konsole) and still get
> the same traceback as I do with systemd user sessions enabled.

I forgot to mention, I rebooted between those runs where I disabled or enabled systemd user sessions. Since Anaconda is installed on an installed system, I attempted to run that from Konsole, and that's where I saw the tracebacks.

Comment 7 Rex Dieter 2021-02-04 13:09:52 UTC
I can reproduce this on fedora 33 plasma wayland session as well. plasma x11 session starts ok.

Comment 8 Neal Gompa 2021-02-07 09:50:01 UTC
Created attachment 1755447 [details]
Screenshot of Anaconda working with xhost +

Some *weird* progress...

I was able to get Anaconda to run by doing the following (in Rawhide 20210206.n.0 build):

$ xhost +
$ liveinst

That causes Anaconda to start up correctly and I can run through installation.

Comment 9 Neal Gompa 2021-02-07 11:02:17 UTC
Created attachment 1755462 [details]
Diff of the environment variables between GNOME and KDE Plasma

I took a sample of the environment variables between GNOME and KDE with the same Rawhide compose, and attached the output of the diff between the two.

The main differences I note that might have an impact:

* No XAUTHORITY variable pointed to Xauthority socket
* Different value for DISPLAY

I suspect the lack of Xauthority socket is the failure mode here.

Comment 10 Neal Gompa 2021-02-07 11:08:09 UTC
This is likely caused by Kwin, since it starts the Xwayland bits in the Wayland session...

Comment 11 Rex Dieter 2021-02-07 14:28:21 UTC
When investigating a prior sddm issue, I found it only sets xauthority bar for x sessions.  We could consider setting it unconditionally.

Comment 12 Neal Gompa 2021-02-07 22:14:38 UTC
liveinst-setup does some "xhost" stuff, but it doesn't work: https://github.com/rhinstaller/anaconda/blob/59231a831ef6647fe81d9c6971b98a2ab7d9b520/data/liveinst/liveinst-setup.sh#L11

I tried it manually, and "xhost +si:localuser:root" does not work in Plasma. This is *definitely* because of the difference in Wayland session initialization in Plasma vs GNOME. Even switching to GDM does not fix it.

Comment 13 Neal Gompa 2021-02-07 22:32:28 UTC
I've filed a bug upstream with KDE: https://bugs.kde.org/show_bug.cgi?id=432625

Comment 14 Adam Williamson 2021-02-08 18:23:56 UTC
Thanks for figuring that out, Neal!

Comment 15 Neal Gompa 2021-02-08 18:33:54 UTC
I've cherry-picked a fix proposed upstream into our kwin package[1] and notified upstream that it fixes our issue in my local testing.

I've pushed a build into Koji too: https://koji.fedoraproject.org/koji/buildinfo?buildID=1705067

It should be fixed with the next compose.

[1]: https://src.fedoraproject.org/rpms/kwin/c/f6befa54b9a3202eca123f10e53b6c19d21f0959?branch=rawhide

Comment 16 Ben Cotton 2021-02-09 16:13:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 34 development cycle.
Changing version to 34.

Comment 17 Ben Cotton 2021-02-12 20:36:54 UTC
FEDORA-2021-2a1eb24b14 contains a potential fix. Setting to ON_QA.

Comment 18 Adam Williamson 2021-02-12 21:49:48 UTC
Yes, this is indeed fixed now.