Bug 473003

Summary: The snap version of NeoChat Stable can't fetch auth info from KWallet due to AppArmor policy
Product: [KDE Neon] neon Reporter: Aaron Rainbolt <arraybolt3>
Component: SnapsAssignee: Scarlett Moore <sgmoore>
Status: RESOLVED FIXED    
Severity: normal CC: Alinajafian81, carl, neon-bugs
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Snap   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Aaron Rainbolt 2023-08-04 15:56:06 UTC
SUMMARY
When using the NeoChat snap, you can log in and chat without problems. However, if you close NeoChat entirely and then relaunch it, it sticks on the "Loading..." screen and displays an AppArmor-related error indicating that it can't request auth information from KWallet.

STEPS TO REPRODUCE
1. Install NeoChat with `sudo snap install neochat`.
2. Launch NeoChat and log into your account.
3. Close NeoChat.
4. Right-click on the NeoChat icon in the system tray (if it's even there - it may just be a blank space like it was on my system) and click "Quit".
5. Open System Monitor and search for NeoChat to make sure it actually has closed. If not, close it from within System Monitor.
6. Launch NeoChat again.
6. 

OBSERVED RESULT
NeoChat displays the "Loading..." screen and never gets past it. A very long AppArmor related error is shown mentioning NeoChat, kwalletd5, and AppArmor policy (I already uninstalled the snap NeoChat and so don't have the exact error here).

EXPECTED RESULT
NeoChat should display the "Loading..." screen for a brief period of time (depending on system and network speed obviously), then display the chats of the logged-in user.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Kubuntu 22.04 LTS
(available in About System)
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
This bug does **not** occur using the Flatpak version of NeoChat.
Comment 1 Scarlett Moore 2023-08-07 16:12:48 UTC
Acknowledged. I am working on solving this issue on another app as well.
Comment 2 Scarlett Moore 2023-08-11 12:38:49 UTC
This is now now fixed in version 23.04.3 in the stable branch in the snap store. Until my autoconnect gets approved you must
sudo snap connect neochat:network-manager-observe :network-manager-observe
sudo snap connect neochat:password-manager-service :password-manager-service

Cheers,
Scarlett
Comment 3 Alinajafian81 2023-09-21 09:10:22 UTC
Hello, Thank you for making this snap package.  I installed 23.04.3 and still I have the exact same issue. Maybe you need to check again?
Comment 4 Alinajafian81 2023-09-21 09:27:29 UTC
I also removed newchat folder from /home/$USER/snap and tried again but the issue still persists.

Here are some info about the new snap:
~$ snap connections neochat
Interface                                 Plug                                 Slot                                                          Notes
accounts-service                          neochat:accounts-service             -                                                             -
audio-playback                            neochat:audio-playback               :audio-playback                                               -
content[icon-themes]                      neochat:icon-themes                  gtk-common-themes:icon-themes                                 -
content[kf5-5-108-qt-5-15-10-core22-all]  neochat:kf5-5-108-qt-5-15-10-core22  kf5-5-108-qt-5-15-10-core22:kf5-5-108-qt-5-15-10-core22-slot  -
content[sound-themes]                     neochat:sound-themes                 gtk-common-themes:sound-themes                                -
dbus                                      -                                    neochat:session-dbus-interface                                -
desktop                                   neochat:desktop                      :desktop                                                      -
desktop-legacy                            neochat:desktop-legacy               :desktop-legacy                                               -
home                                      neochat:home                         :home                                                         -
network                                   neochat:network                      :network                                                      -
network-bind                              neochat:network-bind                 :network-bind                                                 -
network-manager-observe                   neochat:network-manager-observe      -                                                             -
opengl                                    neochat:opengl                       :opengl                                                       -
password-manager-service                  neochat:password-manager-service     -                                                             -
removable-media                           neochat:removable-media              -                                                             -
unity7                                    neochat:unity7                       :unity7                                                       -
wayland                                   neochat:wayland                      :wayland                                                      -
x11                                       neochat:x11                          :x11                                                          -
Comment 5 Alinajafian81 2023-09-21 12:05:03 UTC
OK I tried the workaround and it indeed fixed the issue. running the snap connections again shows that the "slot" section isn't set correctly.

~$ snap connections neochat
Interface                                 Plug                                 Slot                                                          Notes
accounts-service                          neochat:accounts-service             -                                                             -
audio-playback                            neochat:audio-playback               :audio-playback                                               -
content[icon-themes]                      neochat:icon-themes                  gtk-common-themes:icon-themes                                 -
content[kf5-5-108-qt-5-15-10-core22-all]  neochat:kf5-5-108-qt-5-15-10-core22  kf5-5-108-qt-5-15-10-core22:kf5-5-108-qt-5-15-10-core22-slot  -
content[sound-themes]                     neochat:sound-themes                 gtk-common-themes:sound-themes                                -
dbus                                      -                                    neochat:session-dbus-interface                                -
desktop                                   neochat:desktop                      :desktop                                                      -
desktop-legacy                            neochat:desktop-legacy               :desktop-legacy                                               -
home                                      neochat:home                         :home                                                         -
network                                   neochat:network                      :network                                                      -
network-bind                              neochat:network-bind                 :network-bind                                                 -
network-manager-observe                   neochat:network-manager-observe      :network-manager-observe                                      manual
opengl                                    neochat:opengl                       :opengl                                                       -
password-manager-service                  neochat:password-manager-service     :password-manager-service                                     manual
removable-media                           neochat:removable-media              -                                                             -
unity7                                    neochat:unity7                       :unity7                                                       -
wayland                                   neochat:wayland                      :wayland                                                      -
x11                                       neochat:x11                          :x11                                                          -
Comment 6 Scarlett Moore 2023-09-21 12:59:08 UTC
Can you please try 23.08.0 in --candidate
You will still need to 
sudo snap connect neochat:network-manager-observe :network-manager-observe
sudo snap connect neochat:password-manager-service :password-manager-service

As auto-connect was rejected by the store.. :(
Comment 7 Alinajafian81 2023-09-21 13:36:34 UTC
(In reply to Scarlett Moore from comment #6)
> Can you please try 23.08.0 in --candidate
> You will still need to 
> sudo snap connect neochat:network-manager-observe :network-manager-observe
> sudo snap connect neochat:password-manager-service :password-manager-service
> 
> As auto-connect was rejected by the store.. :(

Ok I removed neochat
sudo snap remove --purge neochat
rm -fr /home/$USER/snap/neochat/

then installed candidate
sudo snap install --channel=candidate

and it won't even launch :(
this is the output:
~$ snap run neochat
libEGL warning: egl: failed to create dri2 screen
QQmlApplicationEngine failed to load component
qrc:/main.qml:20:5: Type RoomList.Page unavailable
qrc:/RoomList/Page.qml:99:9: Type NeoChat.SpaceDrawer unavailable
qrc:/SpaceDrawer.qml:10:1: module "org.kde.kirigamiaddons.delegates" is not installed


Here is the output of snap connections without using workaround commands (which still has empty slots) :

~$ snap connections neochat
Interface                                 Plug                                 Slot                                                          Notes
accounts-service                          neochat:accounts-service             -                                                             -
audio-playback                            neochat:audio-playback               :audio-playback                                               -
content[icon-themes]                      neochat:icon-themes                  gtk-common-themes:icon-themes                                 -
content[kf5-5-108-qt-5-15-10-core22-all]  neochat:kf5-5-108-qt-5-15-10-core22  kf5-5-108-qt-5-15-10-core22:kf5-5-108-qt-5-15-10-core22-slot  -
content[sound-themes]                     neochat:sound-themes                 gtk-common-themes:sound-themes                                -
dbus                                      -                                    neochat:session-dbus-interface                                -
desktop                                   neochat:desktop                      :desktop                                                      -
desktop-legacy                            neochat:desktop-legacy               :desktop-legacy                                               -
home                                      neochat:home                         :home                                                         -
network                                   neochat:network                      :network                                                      -
network-bind                              neochat:network-bind                 :network-bind                                                 -
network-manager-observe                   neochat:network-manager-observe      -                                                             -
opengl                                    neochat:opengl                       :opengl                                                       -
password-manager-service                  neochat:password-manager-service     -                                                             -
removable-media                           neochat:removable-media              -                                                             -
unity7                                    neochat:unity7                       :unity7                                                       -
wayland                                   neochat:wayland                      :wayland                                                      -
x11                                       neochat:x11                          :x11                                                          -
Comment 8 Carl Schwan 2023-09-24 11:54:43 UTC
> qrc:/SpaceDrawer.qml:10:1: module "org.kde.kirigamiaddons.delegates" is not installed

This means the latest version of kirigami addons is not installed
Comment 9 Scarlett Moore 2023-09-24 13:09:15 UTC
Rebuilding
Comment 10 Alinajafian81 2023-09-24 14:52:01 UTC
Hello Again. I tested the new version. Nothing changed: app refused to work again. snap connections are the same as before.

~$ snap list neochat
Name     Version  Rev  Tracking          Publisher  Notes
neochat  23.08.0  48   latest/candidate  kde✓       -

~$ neochat --version
libEGL warning: egl: failed to create dri2 screen
neochat 23.08.1

~$ neochat 
libEGL warning: egl: failed to create dri2 screen
QQmlApplicationEngine failed to load component
qrc:/main.qml:20:5: Type RoomList.Page unavailable
qrc:/RoomList/Page.qml:99:9: Type NeoChat.SpaceDrawer unavailable
qrc:/SpaceDrawer.qml:10:1: module "org.kde.kirigamiaddons.delegates" is not installed


~$ snap connections neochat 
Interface                                 Plug                                 Slot                                                          Notes
accounts-service                          neochat:accounts-service             -                                                             -
audio-playback                            neochat:audio-playback               :audio-playback                                               -
content[icon-themes]                      neochat:icon-themes                  gtk-common-themes:icon-themes                                 -
content[kf5-5-108-qt-5-15-10-core22-all]  neochat:kf5-5-108-qt-5-15-10-core22  kf5-5-108-qt-5-15-10-core22:kf5-5-108-qt-5-15-10-core22-slot  -
content[sound-themes]                     neochat:sound-themes                 gtk-common-themes:sound-themes                                -
dbus                                      -                                    neochat:session-dbus-interface                                -
desktop                                   neochat:desktop                      :desktop                                                      -
desktop-legacy                            neochat:desktop-legacy               :desktop-legacy                                               -
home                                      neochat:home                         :home                                                         -
network                                   neochat:network                      :network                                                      -
network-bind                              neochat:network-bind                 :network-bind                                                 -
network-manager-observe                   neochat:network-manager-observe      -                                                             -
opengl                                    neochat:opengl                       :opengl                                                       -
password-manager-service                  neochat:password-manager-service     -                                                             -
removable-media                           neochat:removable-media              -                                                             -
unity7                                    neochat:unity7                       :unity7                                                       -
wayland                                   neochat:wayland                      :wayland                                                      -
x11                                       neochat:x11                          :x11                                                          -
Comment 11 Scarlett Moore 2023-09-25 11:44:29 UTC
There were a few missing qml modules. Please try todays.
Comment 12 Alinajafian81 2023-09-26 07:32:17 UTC
It just gives me the empty tray icon and a ghost window which is just a wayland icon in the taskbar.

~$ neochat
libEGL warning: egl: failed to create dri2 screen
kf.kirigami: Failed to find a Kirigami platform plugin
kf.windowsystem: Could not find any platform plugin
Comment 13 Scarlett Moore 2023-11-03 14:00:58 UTC
The original bug with neochat hanging upon relaunch is now fixed. It uses libsecret with gnome-keychain bundled. If you wish to use it with kwallet you must still manually snap connect neochat:password-manager-service :password-manager-service. Please update to 23.08.2 in the store. Thanks!
Comment 14 Alinajafian81 2023-11-03 15:50:30 UTC
(In reply to Scarlett Moore from comment #13)
> The original bug with neochat hanging upon relaunch is now fixed. It uses
> libsecret with gnome-keychain bundled. If you wish to use it with kwallet
> you must still manually snap connect neochat:password-manager-service
> :password-manager-service. Please update to 23.08.2 in the store. Thanks!

I just fully re-installed this it does pop up but i still have the original issue. close it, the next time it cant access to my account.
Comment 15 Scarlett Moore 2023-11-03 16:25:33 UTC
Confirmed. It works on two of my kde neon systems, but I just installed it on my chromebook and it fails. Still. I am running out of ideas.
Comment 16 Scarlett Moore 2023-11-03 16:45:03 UTC
Ok.. so on my non working system. I was able to get it to work. I removed the snap. Installed gnome-keyring via apt. Installed the snap.
snap run neochat set up account it then prompted me to save in the keyring. Now neochat relaunch works. This would be portals working. Make sure you have xdg-desktop-portals-kde installed. Seems bundling gnome-keyring isn't enough. I have to sort out running it ( or kwallet ) as a service. Will add to TO-DO list for next release.