Programs installed in Snap format do not detect the keyboard

Bug #1863255 reported by Diego Germán Gonzalez on 2020-02-14
62
This bug affects 13 people
Affects Status Importance Assigned to Milestone
snapd
Undecided
Unassigned
snapd (Ubuntu)
High
Unassigned

Bug Description

I installed 3 programs in Snap format
1 with the software center (Spotify)
2 using the terminal Thunderbird, Superproductivity
In the case of installation from the terminal, keyboard strokes are not detected

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: snapd 2.43~pre1+20.04
ProcVersionSignature: Ubuntu 5.4.0-14.17-generic 5.4.18
Uname: Linux 5.4.0-14-generic x86_64
NonfreeKernelModules: nvidia_modeset nvidia
ApportVersion: 2.20.11-0ubuntu16
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Fri Feb 14 11:18:58 2020
InstallationDate: Installed on 2020-02-14 (0 days ago)
InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Alpha amd64 (20200212)
SourcePackage: snapd
UpgradeStatus: No upgrade log present (probably fresh install)

I deleted the Superproductivity installation and the files from the Snap folder. I installed from the software center. It still doesn't work.

Zygmunt Krynicki (zyga) wrote :

I don't think this is related to CLI vs GUI but I did notice this today on my Focal system. I think it's a bug in the input stack. I will chase after this with assistance from the desktop team next week.

Changed in snapd (Ubuntu):
status: New → Confirmed
importance: Undecided → High

I confirm that the installation form has nothing to do with it. In Spotify only the username is supported but not the password

Paul White (paulw2u) wrote :

See also bug 1863412 re chromium

This bug affects all snap applications.

Alex Murray (alexmurray) wrote :

This looks to be due to snaps being denied connection to the ibus socket:

[ 791.681769] audit: type=1400 audit(1581897497.906:247): apparmor="DENIED" operation="connect" profile="snap.firefox.firefox" pid=27136 comm="pool" family="unix" sock_type="stream" protocol=0 requested_mask="send receive connect" denied_mask="send connect" addr=none peer_addr="@/home/amurray/.cache/ibus/dbus-Rb6gdmxA" peer="unconfined"
[ 1167.843758] audit: type=1400 audit(1581897874.072:266): apparmor="DENIED" operation="connect" profile="snap.chromium.chromium" pid=36315 comm="pool" family="unix" sock_type="stream" protocol=0 requested_mask="send receive connect" denied_mask="send connect" addr=none peer_addr="@/home/amurray/.cache/ibus/dbus-Rb6gdmxA" peer="unconfined"
[ 1615.070841] audit: type=1400 audit(1581898321.304:274): apparmor="DENIED" operation="connect" profile="snap.gnome-calculator.gnome-calculator" pid=63151 comm="pool" family="unix" sock_type="stream" protocol=0 requested_mask="send receive connect" denied_mask="send connect" addr=none peer_addr="@/home/amurray/.cache/ibus/dbus-Rb6gdmxA" peer="unconfined"

Alex Murray (alexmurray) wrote :

So ibus was recently updated in focal and this moves the ibus socket path from /tmp to the users home directory - the existing desktop_legacy interface species the ibus socket path in /tmp still:

# allow communicating with ibus-daemon (this allows sniffing key events)
unix (connect, receive, send)
    type=stream
    peer=(addr="@/tmp/ibus/dbus-*"),

So this needs to have something like the following added:

unix (connect, receive, send)
     type=stream
     peer=(addr="@/home/*/.cache/ibus/dbus-*"),

to the desktop-legacy interface (OR ibus is reverted to move the socket back to /tmp however from a security point-of-view I think it is better to have the ibus socket address in the user's home directory).

I don't think there is a way to use the @{HOME} variable in this rule hence the /home/*/ above

Alex Murray (alexmurray) wrote :

I've submitted a PR to snapd to add this new path https://github.com/snapcore/snapd/pull/8141

Alex Murray (alexmurray) wrote :

Ah and now I see Jamie has already submitted a better PR - https://github.com/snapcore/snapd/pull/8139 - so please track that instead :)

Changed in snapd (Ubuntu):
status: Confirmed → In Progress
Zygmunt Krynicki (zyga) wrote :

This was merged and released directly to Focal. The next release of snapd will include this fix in general.

Changed in snapd:
status: New → Fix Released
Changed in snapd (Ubuntu):
status: In Progress → Fix Released
Changed in snapd:
status: Fix Released → Fix Committed
Ian Johnson (anonymouse67) wrote :

Note that if you are on focal, you may still not get this fix if you have the edge channel of the core/snapd snaps installed, as snapd will re-exec into that channel, and the edge channel currently is lagging behind the debian package of snapd. We expect the edge channel to be properly rebuilt soon, but in the meantime you can switch channels for the core/snapd snap to stable and you will get the fix from the debian package in focal.

Kain Centeno (tenshinoneko) wrote :

Started just having this issue yesterday for chromium and discord installed as a snap after running an update (on focal)

Reporting it as it's almost 2 months since the last comment not sure if maybe something got reverted on last update.

Olivier Tilloy (osomon) wrote :

The last ibus update is 4 days old, and it should be unrelated, so this is probably a different issue.
Can you check the output of "journalctl -f | grep DEN" while running those snaps, and attach it here?

Kain Centeno (tenshinoneko) wrote :
Download full text (19.6 KiB)

kain@kain-Blade-Stealth:~$ journalctl -f | grep DEN
Apr 03 18:55:27 kain-Blade-Stealth audit[5702]: AVC apparmor="DENIED" operation="ptrace" profile="snap.discord.discord" pid=5702 comm="Discord" requested_mask="read" denied_mask="read" peer="unconfined"
Apr 03 18:55:27 kain-Blade-Stealth audit[5702]: AVC apparmor="DENIED" operation="ptrace" profile="snap.discord.discord" pid=5702 comm="Discord" requested_mask="read" denied_mask="read" peer="unconfined"
Apr 03 18:55:27 kain-Blade-Stealth audit[5702]: AVC apparmor="DENIED" operation="open" profile="snap.discord.discord" name="/proc/5211/cmdline" pid=5702 comm="Discord" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
Apr 03 18:55:27 kain-Blade-Stealth audit[5702]: AVC apparmor="DENIED" operation="ptrace" profile="snap.discord.discord" pid=5702 comm="Discord" requested_mask="read" denied_mask="read" peer="unconfined"
Apr 03 18:55:27 kain-Blade-Stealth audit[5702]: AVC apparmor="DENIED" operation="ptrace" profile="snap.discord.discord" pid=5702 comm="Discord" requested_mask="read" denied_mask="read" peer="unconfined"
Apr 03 18:55:27 kain-Blade-Stealth audit[5702]: AVC apparmor="DENIED" operation="ptrace" profile="snap.discord.discord" pid=5702 comm="Discord" requested_mask="read" denied_mask="read" peer="unconfined"
Apr 03 18:55:27 kain-Blade-Stealth audit[5702]: AVC apparmor="DENIED" operation="ptrace" profile="snap.discord.discord" pid=5702 comm="Discord" requested_mask="read" denied_mask="read" peer="unconfined"
Apr 03 18:55:46 kain-Blade-Stealth dbus-daemon[2491]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/org/freedesktop/secrets" interface="org.freedesktop.DBus.Properties" member="GetAll" mask="send" name="org.freedesktop.secrets" pid=6345 label="snap.chromium.chromium" peer_pid=2485 peer_label="unconfined"
Apr 03 18:55:46 kain-Blade-Stealth audit[1511]: USER_AVC pid=1511 uid=103 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=6236 label="snap.chromium.chromium" peer_pid=1508 peer_label="unconfined"
Apr 03 18:55:46 kain-Blade-Stealth kernel: audit: type=1107 audit(1585965346.810:1580): pid=1511 uid=103 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=6236 label="snap.chromium.chromium" peer_pid=1508 peer_label="unconfined"
Apr 03 18:55:47 kain-Blade-Stealth dbus-daemon[2491]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/com/canonical/dbusmenu" interface="org.freedesktop.DBus.Properties" member="GetAll" name=":1.25" mask="receive" pid=6236 label="snap.chromium.chromium" peer_pid=2575 peer_label="unconfined"
Apr 03 18:55:47 kain-Blade-Stealth dbus-daemon[2491]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/com/canonical/dbusmenu" interface="com.canonical.dbusmenu" member="AboutToShow" name=":1.25" mask="receive" pid=6236 label="snap.chromium.chromium" peer_pid=2575 peer_label="unconfined"
Apr 0...

Kain Centeno (tenshinoneko) wrote :

I was able to fix this by changing the input method settings.

When first opening it, I see a window saying:

Current configuration for the input method:
 * Active configuration: default (normally missing)
 * Normal automatic choice: ibus (normally ibus or fcitx or uim)
 * Override rule:
 * Current override choice: (en_US)
 * Current automatic choice: ibus
 * Number of valid choices: 2 (normally 1)
The override rule is defined in /etc/default/im-config.
The configuration set by im-config is activated by re-starting X.
Explicit selection is not required to enable the automatic configuration if the active one is default/auto/cjkv/missing.
  Available input methods: ibus xim
Unless you really need them all, please make sure to install only one input method tool.

I hit Okay.
Then another window pops up saying:
Do you explicitly select the user configuration?
Select No, if you do not wish to update it(recommended)
select yes, if you wish to update it.

I select "yes"

On the new window I see that "default" is select. (use auto mode set /etc/default/im-config)

I went to that file and cat it, the result below:
# Default im-config mode (see im-config(8))

OLDIFS="$IFS"
IFS=':'
desktop=
for val in $XDG_CURRENT_DESKTOP; do
    for d in 'GNOME' 'MATE' 'UKUI' 'Unity'; do
        [ "$d" = "$val" ] && { desktop="$d"; break 2; }
    done
done
IFS="$OLDIFS"

if [ -n "$desktop" ]; then
    # Start best input method unless overridden below
    IM_CONFIG_DEFAULT_MODE=auto
else
    # Start best input method only if CJKV environment and not overridden below
    IM_CONFIG_DEFAULT_MODE=cjkv
fi

# Set locale dependent preferred IM over standard auto mode
if [ "$desktop" != 'GNOME' ]; then
    IM_CONFIG_PREFERRED_RULE="zh_CN,fcitx:zh_TW,fcitx:zh_HK,fcitx:zh_SG,fcitx:ja_JP,fcitx:ko_KR,fcitx:vi_VN,fcitx"
fi

# User and system wide configuration is normally done via im-config program.
# The above IM_CONFIG_PREFERRED_RULE sets locale dependent preferred IM
# override rule. If you wish to use uim over ibus just for ja_JP,
# add :ja_JP,uim at the end of the above list.

# Trace commands for debug
# (This may cause problem configuration file generated under console mode)
#IM_CONFIG_SETMODE="-x"

# Verbose output for debug (uncomment following)
#IM_CONFIG_VERBOSE="true"

-------------

If i change the input method to "auto" (activate IM with @-mark for most locales) the keyboard works again on all snaps

I hope the information I provided helps somehow

Kain Centeno (tenshinoneko) wrote :

sorry i forgot to also mention that i have chinese and japanese ibus. For some reason now my icon on the top right is gone too

Download full text (3.2 KiB)

Hi. I'm getting a similar issue but it's related with the context menu from the tray icon. I'm the maintainer of prospect-mail but I also see this issue in https://super-productivity.com/ snap app.

This is the message:

abr 20 10:34:31 ubuntu-focal audit[584]: USER_AVC pid=584 uid=103 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=31670 label="snap.prospect-mail.prospect-mail"
                                          exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'
abr 20 10:34:31 ubuntu-focal kernel: audit: type=1107 audit(1587396871.632:95874): pid=584 uid=103 auid=4294967295 ses=4294967295 msg='apparmor="DENIED" operation="dbus_method_call" bus="system" path="/" interface="org.freedesktop.DBus.ObjectManager" member="GetManagedObjects" mask="send" name="org.bluez" pid=31670 label="snap.prospect-mail.prospect-mail"
                                      exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'
abr 20 10:34:32 ubuntu-focal dbus-daemon[2380]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/com/canonical/dbusmenu" interface="org.freedesktop.DBus.Properties" member="GetAll" name=":1.14" mask="receive" pid=31670 label="snap.prospect-mail.prospect-mail" peer_pid=2846 peer_label="unconfined"
abr 20 10:34:32 ubuntu-focal dbus-daemon[2380]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/com/canonical/dbusmenu" interface="com.canonical.dbusmenu" member="AboutToShow" name=":1.14" mask="receive" pid=31670 label="snap.prospect-mail.prospect-mail" peer_pid=2846 peer_label="unconfined"
abr 20 10:34:32 ubuntu-focal dbus-daemon[2380]: apparmor="DENIED" operation="dbus_method_call" bus="session" path="/com/canonical/dbusmenu" interface="com.canonical.dbusmenu" member="GetLayout" name=":1.14" mask="receive" pid=31670 label="snap.prospect-mail.prospect-mail" peer_pid=2846 peer_label="unconfined"
abr 20 10:34:32 ubuntu-focal <email address hidden>[2846]: Impossible to send about-to-show to menu: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.14" (uid=1000 pid=2846 comm="/usr/bin/gnome-shell " label="unconfined") interface="com.canonical.dbusmenu" member="AboutToShow" error name="(unset)" requested_reply="0" destination=":1.783" (uid=1000 pid=31670 comm="/snap/prospect-mail/x1/prospect-mail --no-sandbox " label="snap.prospect-mail.prospect-mail (enforce)")
abr 20 10:34:32 ubuntu-focal <email address hidden>[2846]: While reading menu layout on proxy ':1.783: Gio.DBusError: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.14" (uid=1000 pid=2846 comm="/usr/bin/gnome-shell " label="unconfined") interface="com.canonical.dbusmenu" member="GetLayout" error name="(unset)" requested_reply="0" destination=":1.783" (uid=1000 pid=31670 comm="/snap/prospe...

Read more...

Jamie Strandboge (jdstrand) wrote :

Julian, I suspect your snap needs to 'plugs: [ unity7 ]' (which is what allows using dbusmenu) and that you need to 'snap connect prospect-mail:unity7'. If the interface is already connected, please fil a new bug and include the policy denials from journalctl corresponding to when the functionality wasn't working.

Zygmunt Krynicki (zyga) wrote :

This issue was fixed in snapd 2.43 which was since released to the stable channel. Marking as such.

Changed in snapd:
milestone: none → 2.43
status: Fix Committed → Fix Released
milestone: 2.43 → 2.44
Zygmunt Krynicki (zyga) wrote :

On closer look it seems that the patch was included in 2.44.

Chris S. (r-chris-2) wrote :

I'm on snap 2.47 and chromium does not respond to the keyboard. It is version:
Version 86.0.4240.75 (Official Build) snap (64-bit)

System info:
Ubuntu 20.04.1 LTS (64-bit)
GNOME 3.36.3 with Wayland

Why am I on Wayland...? Not sure! I thought I stuck with X... Maybe that's part of the problem.

Let me know if there are any other specs that would help.

In addition, I have noted many corrupt icons since switching to the snap package. For example, the close button in the upper right that should display as a simple X has some weird shaped whale looking icon attached to the left side of it. When I go to save a file, the system icons I have selected are not display, instead corrupted icons or no icons display. I'm not sure if this is related to the keyboard issue, but they both occurred after upgrading to snap.

Olivier Tilloy (osomon) wrote :

Chris, could you please attach the output of the following command:

    snap connections chromium

For the issue with corrupt icons, please file a separate bug at https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+filebug. Thanks!

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Duplicates of this bug

Other bug subscribers