Bug 485494

Summary: fcitx5 qt6 library cause desktop failed to start, their maintainer suggests rebuilding the package against new qt
Product: [KDE Neon] neon Reporter: hyperrecursion
Component: Packages Testing EditionAssignee: Carlos De Maine <carlosd.kde>
Status: RESOLVED FIXED    
Severity: crash CC: cgdlut, hyperrecursion, jr, leonard, neon-bugs, songhda, trulyliu, wengxt
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description hyperrecursion 2024-04-13 16:24:53 UTC
SUMMARY
My KDE desktop crashed every time the system starts, after updating packages a few days ago.
The desktop is blank black nothing left, but surprisingly I can still use gestures to enter the interface of switching multiple desktops, and I can launch applications via search bar. But only several non-native-windowed applications like edge & android studio can be launched(very slowly).
After tracing ```journalctl``` I found that a Sgmentation Fault is thrown by libFcitx5Qt6DBusAddons.so.5.1.5 on desktop's starting. This happens on every system boot.

I don't know which package of fcitx caused the bug, but when I removed all deb packages with "fcitx" in their names and autoremove, the desktop works well again. (Actually I don't have much time to locate the package by tests of install/uninstall packages)

I reported the bug to fcitx/fcitx5-qt github repo [issue #59](https://github.com/fcitx/fcitx5-qt/issues/59), and their maintainer says "Please report to neon and ask them to rebuild against new qt." So I turn to report here.

STEPS TO REPRODUCE
1. install some of these packages via ```pkcon```: fcitx5 fcitx5-material-color fcitx5-chinese-addons
2. run pkcon update (at this time I send this report)
3. reboot

OBSERVED RESULT
KDE desktop crashed every time the system starts, and the desktop is blank black nothing left, but still can use gestures to enter the interface of switching multiple desktops, and can launch applications via search bar. But only several non-native-windowed applications, like edge & android studio, can be launched successfully (with a long delay).

EXPECTED RESULT
Desktop works normally

SOFTWARE/OS VERSIONS
Linux/KDE Plasma:
(available in About System)
KDE Plasma Version: 6.0.3
KDE Frameworks Version: 6.0.0
Qt Version: 6.7.0

ADDITIONAL INFORMATION

part of journalctl log:

```
4月 12 05:00:56 DysonSwarm kernel: ksplashqml[1085]: segfault at 5dc700000010 ip 0000734c1822e6c5 sp 00007fff4688bbf0 error 4 in libFcitx5Qt6DBusAddons.so.5.1.5[734c1820e000+37000] likely on CPU 1 (core 0, socket 0)
4月 12 05:00:56 DysonSwarm kernel: Code: 00 00 80 78 12 00 75 04 0f b6 70 13 e9 b4 ff ff ff 0f 1f 40 00 f3 0f 1e fa 41 57 41 56 41 55 41 54 55 53 48 81 ec a8 00 00 00 <48> 8b 5f 10 64 48 8b 04 25 28 00 00 00 48 89 84 24 98 00 00 00 31
4月 12 05:00:56 DysonSwarm systemd[1000]: plasma-ksplash.service: Main process exited, code=killed, status=11/SEGV
4月 12 05:00:56 DysonSwarm systemd[1000]: plasma-ksplash.service: Failed with result 'signal'.
4月 12 05:00:56 DysonSwarm systemd[1000]: Failed to start Splash screen shown during boot.
4月 12 05:00:56 DysonSwarm kwin_wayland[1078]: kf.windowsystem: static bool KX11Extras::mapViewport() may only be used on X11
4月 12 05:00:56 DysonSwarm kwin_wayland_wrapper[1290]: The XKEYBOARD keymap compiler (xkbcomp) reports:
4月 12 05:00:56 DysonSwarm kwin_wayland_wrapper[1290]: > Warning:          Unsupported maximum keycode 708, clipping.
4月 12 05:00:56 DysonSwarm kwin_wayland_wrapper[1290]: >                   X11 cannot support keycodes above 255.
4月 12 05:00:56 DysonSwarm kwin_wayland_wrapper[1290]: Errors from xkbcomp are not fatal to the X server
4月 12 05:00:56 DysonSwarm kcminit[1291]: Initializing  "/usr/lib/x86_64-linux-gnu/qt6/plugins/plasma/kcms/systemsettings/kcm_fonts.so"
4月 12 05:00:56 DysonSwarm kcminit[1291]: Initializing  "/usr/lib/x86_64-linux-gnu/qt6/plugins/plasma/kcms/systemsettings/kcm_style.so"
4月 12 05:00:56 DysonSwarm kernel: kcminit_startup[1088]: segfault at 5e8c00000010 ip 0000786ed86606c5 sp 00007ffdbff5ad70 error 4 in libFcitx5Qt6DBusAddons.so.5.1.5[786ed8640000+37000] likely on CPU 7 (core 12, socket 0)
4月 12 05:00:56 DysonSwarm kernel: Code: 00 00 80 78 12 00 75 04 0f b6 70 13 e9 b4 ff ff ff 0f 1f 40 00 f3 0f 1e fa 41 57 41 56 41 55 41 54 55 53 48 81 ec a8 00 00 00 <48> 8b 5f 10 64 48 8b 04 25 28 00 00 00 48 89 84 24 98 00 00 00 31
4月 12 05:00:56 DysonSwarm systemd[1000]: Started KDE Config Module Initialization.
4月 12 05:00:56 DysonSwarm kernel: kcminit[1291]: segfault at 62ea00000010 ip 00007b07f80836c5 sp 00007ffd3371cb70 error 4 in libFcitx5Qt6DBusAddons.so.5.1.5[7b07f8063000+37000] likely on CPU 0 (core 0, socket 0)
4月 12 05:00:56 DysonSwarm kernel: Code: 00 00 80 78 12 00 75 04 0f b6 70 13 e9 b4 ff ff ff 0f 1f 40 00 f3 0f 1e fa 41 57 41 56 41 55 41 54 55 53 48 81 ec a8 00 00 00 <48> 8b 5f 10 64 48 8b 04 25 28 00 00 00 48 89 84 24 98 00 00 00 31
4月 12 05:00:56 DysonSwarm systemd[1000]: Starting KDE Session Management Server...
4月 12 05:00:56 DysonSwarm systemd[1]: systemd-rfkill.service: Deactivated successfully.
4月 12 05:00:56 DysonSwarm systemd[1000]: Started Unlock kwallet from pam credentials.
4月 12 05:00:56 DysonSwarm systemd[1000]: Starting KDE Daemon 6...
4月 12 05:00:56 DysonSwarm systemd[1000]: Started KDE Daemon 6.
4月 12 05:00:56 DysonSwarm kernel: ksmserver[1306]: segfault at 59f400000010 ip 00007939a97d06c5 sp 00007ffc7d382ca0 error 4 in libFcitx5Qt6DBusAddons.so.5.1.5[7939a97b0000+37000] likely on CPU 7 (core 12, socket 0)
4月 12 05:00:56 DysonSwarm kernel: Code: 00 00 80 78 12 00 75 04 0f b6 70 13 e9 b4 ff ff ff 0f 1f 40 00 f3 0f 1e fa 41 57 41 56 41 55 41 54 55 53 48 81 ec a8 00 00 00 <48> 8b 5f 10 64 48 8b 04 25 28 00 00 00 48 89 84 24 98 00 00 00 31
4月 12 05:00:56 DysonSwarm systemd[1000]: Starting KDE Configuration Module Initialization (Phase 1)...
4月 12 05:00:56 DysonSwarm systemd[1000]: plasma-ksmserver.service: Main process exited, code=killed, status=11/SEGV
4月 12 05:00:56 DysonSwarm systemd[1000]: plasma-ksmserver.service: Failed with result 'signal'.
4月 12 05:00:56 DysonSwarm systemd[1000]: Failed to start KDE Session Management Server.
4月 12 05:00:56 DysonSwarm systemd[1000]: Dependency failed for KDE Plasma Workspace Core.
4月 12 05:00:56 DysonSwarm systemd[1000]: Dependency failed for KDE Plasma Workspace.
4月 12 05:00:56 DysonSwarm systemd[1000]: Dependency failed for plasma-workspace-wayland.target.
4月 12 05:00:56 DysonSwarm dbus-daemon[1029]: [session uid=1000 pid=1029] Activating via systemd: service name='ca.desrt.dconf' unit='dconf.service' requested by ':1.31' (uid=1000 pid=1308 comm="/usr/bin/kded6 " label="unconfined")
4月 12 05:00:56 DysonSwarm systemd[1000]: plasma-workspace-wayland.target: Job plasma-workspace-wayland.target/start failed with result 'dependency'.
4月 12 05:00:56 DysonSwarm systemd[1000]: plasma-workspace.target: Job plasma-workspace.target/start failed with result 'dependency'.
4月 12 05:00:56 DysonSwarm systemd[1000]: plasma-core.target: Job plasma-core.target/start failed with result 'dependency'.
```
4月 = April
Comment 1 cgdlut 2024-04-15 07:09:28 UTC
Same problem encountered, please help to fix this problem.
Comment 2 hd2021 2024-04-21 14:47:01 UTC
Same problem here. 

In short after you installing fcitx5* in the lastest KDE Neon, you might get a black screen after you entered the log in password upon rebooting or logging out. While you still can switch to tty through ctrl+alt+f3, but unable to log into the plasma desktop.
Comment 3 Leonard Lausen 2024-04-21 16:25:01 UTC
It seems this issue is introduced in fcitx-config-qt 5.1.4-0xneon+22.04+jammy+release+build3 whereas the older 5.1.3-1+22.04+jammy+release+build1 works fine. Is there an archive of the prior packages available? For example, something similar to https://snapshot.debian.org/ for Debian?
Comment 4 trulyliu 2024-04-22 05:44:44 UTC
Same issue here.
Comment 5 trulyliu 2024-04-22 08:16:34 UTC
As a temporary solution, ctrl+alt+f3 to switch to tty.
install ibus, and use im-config to switch to ibus IME.
reboot.
 plasma-desktop will display normally afterwards.
Comment 6 Weng Xuetian 2024-04-23 06:21:25 UTC
Fcitx dev here, I downloaded https://files.kde.org/neon/images/testing/20240423-0253/neon-testing-20240423-0253.iso and installed it in qemu. 

So indeed, any program that loads fcitx5's im module would crash immediately. But with my experience on archlinux, it should be fine with either Qt6.6 or Qt 6.7.

So I just try this on kwrite, QT_DEBUG_PLUGINS=1 QT_IM_MODULE=fcitx kwrite
And it shows following lines:
```
{
    "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
    "MetaData": {
        "Keys": [
            "fcitx",
            "fcitx5"
        ]
    },
    "archlevel": 1,
    "className": "QFcitx5PlatformInputContextPlugin",
    "debug": false,
    "version": 394752
}
```
Comparing to other plugins, they are showing "395008".
394752 is 0x60600, and 395008 is 0x60700, which is the Qt version (major<<16|minor<<8|patch).

It clearly indicates that the qt6 part with in fcitx5-qt is built against Qt 6.6, not the Qt 6.7. For qpa platform plugin it's unfortunate that it need to be rebuilt against any Qt minor update.

I also tried to rebuild with neon's deb source. Problem also go away, so it seems that a rebuild should fix the issue.

For users who hit this issue but still want to use fcitx5, if you ARE planning using wayland, you can:
1. Go to TTY (Ctrl+Alt+F(1,2,3...)
2. Run "im-config -n none", this will disable im-config profile and all the environment variable like QT_IM_MODULE to be set. This is actually OK if you're gonna use wayland.
3. Now you should be able to login, you can go to Systemsettings->Virtual keyboard-> select fcitx5 there. You should be able to use fcitx5 input method as long as application is running under wayland. 

For more details on other thing to setup, check https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland#KDE_Plasma
Comment 7 trulyliu 2024-04-23 07:04:20 UTC
@Weng Xuetian
Which package should be rebuilt? Could you give a simple instruction?
Comment 8 hyperrecursion 2024-04-23 22:36:42 UTC
(In reply to Weng Xuetian from comment #6)
> Fcitx dev here, I downloaded
> https://files.kde.org/neon/images/testing/20240423-0253/neon-testing-
> 20240423-0253.iso and installed it in qemu. 
> 
> So indeed, any program that loads fcitx5's im module would crash
> immediately. But with my experience on archlinux, it should be fine with
> either Qt6.6 or Qt 6.7.
> 
> So I just try this on kwrite, QT_DEBUG_PLUGINS=1 QT_IM_MODULE=fcitx kwrite
> And it shows following lines:
> ```
> {
>     "IID": "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1",
>     "MetaData": {
>         "Keys": [
>             "fcitx",
>             "fcitx5"
>         ]
>     },
>     "archlevel": 1,
>     "className": "QFcitx5PlatformInputContextPlugin",
>     "debug": false,
>     "version": 394752
> }
> ```
> Comparing to other plugins, they are showing "395008".
> 394752 is 0x60600, and 395008 is 0x60700, which is the Qt version
> (major<<16|minor<<8|patch).
> 
> It clearly indicates that the qt6 part with in fcitx5-qt is built against Qt
> 6.6, not the Qt 6.7. For qpa platform plugin it's unfortunate that it need
> to be rebuilt against any Qt minor update.
> 
> I also tried to rebuild with neon's deb source. Problem also go away, so it
> seems that a rebuild should fix the issue.
> 
> For users who hit this issue but still want to use fcitx5, if you ARE
> planning using wayland, you can:
> 1. Go to TTY (Ctrl+Alt+F(1,2,3...)
> 2. Run "im-config -n none", this will disable im-config profile and all the
> environment variable like QT_IM_MODULE to be set. This is actually OK if
> you're gonna use wayland.
> 3. Now you should be able to login, you can go to Systemsettings->Virtual
> keyboard-> select fcitx5 there. You should be able to use fcitx5 input
> method as long as application is running under wayland. 
> 
> For more details on other thing to setup, check
> https://fcitx-im.org/wiki/Using_Fcitx_5_on_Wayland#KDE_Plasma

Many thanks Orz
Comment 9 Weng Xuetian 2024-04-24 02:17:16 UTC
(In reply to trulyliu from comment #7)
> @Weng Xuetian
> Which package should be rebuilt? Could you give a simple instruction?

apt source fcitx5-qt and use dpkg-buildpackage, you probably want to look up how to build it and you'll also hit some deb lint error...

I'm not so sure how neon build the new version of package without https://invent.kde.org/neon/backports-jammy/fcitx5-qt updated with debian upstream.. but it might be a good idea to sync with upstream debian/ in the next update..
Comment 10 trulyliu 2024-04-24 08:43:08 UTC
(In reply to Weng Xuetian from comment #9)
> (In reply to trulyliu from comment #7)
> > @Weng Xuetian
> > Which package should be rebuilt? Could you give a simple instruction?
> 
> apt source fcitx5-qt and use dpkg-buildpackage, you probably want to look up
> how to build it and you'll also hit some deb lint error...
> 
> I'm not so sure how neon build the new version of package without
> https://invent.kde.org/neon/backports-jammy/fcitx5-qt updated with debian
> upstream.. but it might be a good idea to sync with upstream debian/ in the
> next update..


Thanks.

I successfully built these packages with some small modifications of files under debian dir.
After installing these packages,  and uninstalling fcitx-frontend-qt5 and fcitx-frontend-qt6,
The plasma-desktop doesn't crash anymore, and fcitx5 works perfectly.

I put these packages on github. 
https://github.com/trulyliu/neon-fictx5-qt/tree/main/deb
Comment 11 hd2021 2024-04-25 11:26:17 UTC
(In reply to trulyliu from comment #10)
> (In reply to Weng Xuetian from comment #9)
> > (In reply to trulyliu from comment #7)
> > > @Weng Xuetian
> > > Which package should be rebuilt? Could you give a simple instruction?
> > 
> > apt source fcitx5-qt and use dpkg-buildpackage, you probably want to look up
> > how to build it and you'll also hit some deb lint error...
> > 
> > I'm not so sure how neon build the new version of package without
> > https://invent.kde.org/neon/backports-jammy/fcitx5-qt updated with debian
> > upstream.. but it might be a good idea to sync with upstream debian/ in the
> > next update..
> 
> 
> Thanks.
> 
> I successfully built these packages with some small modifications of files
> under debian dir.
> After installing these packages,  and uninstalling fcitx-frontend-qt5 and
> fcitx-frontend-qt6,
> The plasma-desktop doesn't crash anymore, and fcitx5 works perfectly.
> 
> I put these packages on github. 
> https://github.com/trulyliu/neon-fictx5-qt/tree/main/deb

Good job, Wait for your files to be merged into the official repository.
Comment 12 Carlos De Maine 2024-04-27 12:13:42 UTC
sorry for the delay.  this has now been rebuilt and is in the archives