Ibus doesn't work with Skype snap on 20.04

I did some investigation in why the skype snap, both latest and insider channels, doesn’t work with ibus on my Focal box. The problem has annoyed me for quite awhile. Actually it also doesn’t work with fcitx on 19.10 and 20.04 but I didn’t look deep into what’s wrong. Below are my findings after I’ve done a lot of snap try.

First I run the skype binary directly, because it can show the exact errors:

$ /snap/skype/current/usr/share/skypeforlinux/skypeforlinux 
[...]
(skypeforlinux:944077): Gtk-WARNING **: 19:18:26.196: /lib/x86_64-linux-gnu/libibus-1.0.so.5: undefined symbol: g_get_language_names_with_category

(skypeforlinux:944077): Gtk-WARNING **: 19:18:26.196: Loading IM context type 'ibus' failed

There is a version check in ibus that g_get_language_names_with_category is only called if glib >= 2.58: https://github.com/ibus/ibus/blob/master/src/ibusenginesimple.c#L1796

However, glib in Bionic is 2.56 and is used in the snap, this version doesn’t have this symbol. This is an incompatibility between host’s libibus and snap’s glib.

As there is no libibus in the snap, I tried putting Bionic’s libibus shared object into the snap, then I got another error:

$ /snap/skype/current/usr/share/skypeforlinux/skypeforlinux 
[...]

(skypeforlinux:967589): Gtk-WARNING **: 19:44:00.867: /usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-ibus.so: undefined symbol: ibus_input_context_set_client_commit_preedit

(skypeforlinux:967589): Gtk-WARNING **: 19:44:00.867: Loading IM context type 'ibus' failed

So im-ibus immodule on the host is used. I performed the following steps to make ibus fully work:

  1. Copy Bionic’s im-ibus.so to $SNAP/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-ibus.so (it’s absent in the snap)

  2. Make a copy of immodules.cache to $SNAP/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules.cache and edit the paths in the file to point to files in the snap.

  3. In $SNAP/bin/electron-launch, add the following section before the line export HOME=$SNAP_USER_COMMON:

    export GTK_IM_MODULE_FILE=$SNAP/usr/lib/$ARCH/gtk-3.0/3.0.0/immodules.cache
    IBUS_BUS=$SNAP_USER_COMMON/.config/ibus/bus
    [ -d $IBUS_BUS -a ! -L $IBUS_BUS ] && rmdir $IBUS_BUS
    ln -sf $HOME/.config/ibus/bus/ $SNAP_USER_COMMON/.config/ibus/bus

I’m not sure if this is a snapd or snapcraft bug, because everything above can be fixed in the snap itself. May be once the skype snap is confined the problems will go away, but before that happens I wish Skype snap developers can take a look.

3 Likes

Thank you for you work. I can confirm, that it also affects me on fresh Ubuntu 20.04 installation.
I’ve created such topic here https://answers.microsoft.com/en-us/skype/forum/sk_mess-sk_share-sk_linux/ubuntu-2004-white-screen-while-trying-to-send-a/1f7bf7e1-7bb2-4094-affb-8e75f3dfed46?tm=1592233628471 be still no success.

1 Like

Thanks for your input, IMO this problem is due to binary dependency mismatch and the only proper way to fix it is to let IBus itself support architecture-independent D-Bus interface just like Fcitx did IIRC.

This seems similar to this issue:

  • Copy Bionic’s im-ibus.so to $SNAP/usr/lib/x86_64-linux-gnu/gtk-3.0/3.0.0/immodules/im-ibus.so (it’s absent in the snap)

How have you edited files which are part of the snap? I can think of unsquashfsing, updating and creating a new squashfs image or using mount --bind. Both of which a far from being convenient for temporary workarounds.