Lost keyboard input to all X client based snaps - permission denied

Hi folks-

Recently I lost my ~/.cache dir. After restore, none of my snaps (X based - no wayland) receive keyboard input under any circumstance. The keyboard does not work with any snap.

When I try to start firefox (for example) I see the following as the last two lines:

[Parent 37267, Main Thread] WARNING: Unable to connect to ibus: Could not connect: Permission denied: 'glib warning', file /build/firefox/parts/firefox/build/toolkit/xre/nsSigHandlers.cpp:167
(firefox:37267): IBUS-WARNING **: 10:20:46.209: Unable to connect to ibus: Could not connect: Permission denied

Environment:
Kubuntu Lunar (23.04)
ibus is running (not sure why since I only use US English)

dpkg -l snapd
<snip>
ii  snapd          2.59.1+23.04ubuntu1.1 amd64        Daemon and tooling that enable snap packages

Researching why, I did find this bug. I checked my apparmor rules and found a firefox specific apparmor rule that should work.

But my keyboard does not work for any x-based snap.

Next I found this thread here on snapcraft.

I have checked the most recent file in ~/.config/ibus/bus/<really long string>-unix-0 and see:

<snip>
IBUS_ADDRESS=unix:path=/home/rcc/.cache/ibus/dbus-qFyfVYah,guid=864fa996ba5a3b6e8107498a64a9cbbe
IBUS_DAEMON_PID=12841

Confirmed ibus is running with that PID. I also understand the socket in question is an “abstract namespace socket” so I did a:

lsof -p 12841 | grep dbus-qFyfVYah

And see 29 instances starting with:

ibus-daem 12841  rcc    6u     unix 0x0000000000000000      0t0  85821 /home/rcc/.cache/ibus/dbus-qFyfVYah type=STREAM (LISTEN)
ibus-daem 12841  rcc   12u     unix 0x0000000000000000      0t0  85827 /home/rcc/.cache/ibus/dbus-qFyfVYah type=STREAM (CONNECTED)
<snip>

Since that matches the IBUS_ADDRESS above, the socket appears to be there (29 of them).

So I am assuming this is a “permissions denied” problem… and since this is not a file based unix socket (or one that is represented in the filesystem that I can easily chmod), how do I fix this?

Any help or pointers would be greatly appreciated. I am heavily “invested” in snaps…

Thanks,
Bob

Sorry to follow-up my own post but…

I logged out of the account I was using above and logged into another local account on the same node.

That account does not have the same problem. All snaps work under that account.

Now thinking it’s either ibus or dbus related… based on the error message.

Looking back at this bug:

Looking at my config -> another local account works fine.

My glib2.0 version is more current than the one from the bug:

dpkg -l libglib2.0-0
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name               Version      Architecture Description
+++-==================-============-============-=================================
ii  libglib2.0-0:amd64 2.76.1-1     amd64        GLib library of C routines

It’s got to be something particular to my account… any help would be appreciated.

Solved!

Submitted Bug #2026758 to the snapd team.

Net net… for the snapd version listed above, NEVER link your ~/.cache dir to another location.

If you do, you will experience the behavior above.