Unable to connect content interface for self published content snap

I’m trying to use a content snap for a snap I maintain yuzu. The content snap I’m trying to use is also published and created by me, nightmayr-kf5-qt-5-15-2-core20. The content snap as the name indicates essentially aims to provide Qt5 and KDE libraries for the consumer snap.

I’m having difficulty getting yuzu to connect to the content snap however. When creating my content snap I followed the content declaration the kde-frameworks snap used, but tweaked in terms of the name for my snap:

slots:
    nightmayr-kf5-qt-5-15-2-core20-slot:
        content: nightmayr-kf5-qt-5-15-2-core20-all
        interface: content
        read:
        - "."
    nightmayr-kf-5-85-qt-5-15-core20:
        content: nightmayr-kf-5-85-qt-5-15-core20
        interface: content
        read:
        - "."

On the yuzu snap side, I used the kde-neon extension and took the output of snapcraft expand-extensions and tweaked the plug declaration and name to reference my content snap. yuzu’s plug declaration looks like this:

plugs:
  desktop:
    mount-host-font-cache: false
  icon-themes:
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/icons
  nightmayr-kde-frameworks-5-plug:
    content: nightmayr-kf5-qt-5-15-2-core20-all
    default-provider: nightmayr-kf5-qt-5-15-2-core20
    interface: content
    target: $SNAP/kf5
  sound-themes:
    default-provider: gtk-common-themes
    interface: content
    target: $SNAP/data-dir/sounds

When I try to connect this interface I get an error:

$ snap connect yuzu:nightmayr-kde-frameworks-5-plug 
error: snap "core" has no "content" interface slots

and running the snap:

$ yuzu
ERROR: not connected to the nightmayr-kde-frameworks-5-plug content interface.

with snap connections showing:

$ snap connections yuzu
Interface               Plug                                  Slot                            Notes
audio-playback          yuzu:audio-playback                   :audio-playback                 -
bluez                   yuzu:bluez                            -                               -
browser-support         yuzu:browser-support                  :browser-support                -
content[icon-themes]    yuzu:icon-themes                      gtk-common-themes:icon-themes   -
content                 yuzu:nightmayr-kde-frameworks-5-plug  -                               -

What am I doing wrong here?

yuzu snapcraft.yaml: https://github.com/Nightmayr-snaps/yuzu-snap/blob/73c84df8786cd31f1873fbb0911c035084cf6be1/snap/snapcraft.yaml

content snap snapcraft.yaml: https://github.com/Nightmayr-snaps/nightmayr-kf5-qt-5-15-2-core20-snap/blob/3c4f1257f3fb98033d3cd0fec40adaad5f88de1e/snap/snapcraft.yaml

Thanks in advance

Can you manually connect the plug and slot with snap connect ... ?

Unfortunately this doesn’t work for me:

$ snap connect yuzu:nightmayr-kde-frameworks-5-plug 
error: snap "core" has no "content" interface slots

Some additional info, listing the the content interfaces available I get:

$ snap interface content 
name:    content
summary: allows sharing code and data with other snaps
plugs:
  - yuzu:icon-themes
  - yuzu:nightmayr-kde-frameworks-5-plug
  - yuzu:sound-themes
slots:
  - gtk-common-themes:gtk-2-themes
  - gtk-common-themes:gtk-3-themes
  - gtk-common-themes:icon-themes
  - gtk-common-themes:sound-themes
  - gtk-theme-yaru-mate:gtk-2-themes
  - gtk-theme-yaru-mate:gtk-3-themes
  - icon-theme-yaru-mate:icon-themes
  - nightmayr-kf5-qt-5-15-2-core20:nightmayr-kf-5-85-qt-5-15-core20
  - nightmayr-kf5-qt-5-15-2-core20:nightmayr-kf5-qt-5-15-2-core20-slot

Sorry I meant manually connect the plug to the slot, run:

snap connect yuzu:nightmayr-kde-frameworks-5-plug nightmayr-kf5-qt-5-15-2-core20:nightmayr-kf5-qt-5-15-2-core20-slot

Ah sorry wasn’t aware that was how to manually connect the plug. That managed to get the plug to connect successfully to the slot and allowed yuzu to launch.

Would it be possible to get this to connect automatically for users of the yuzu snap? My understanding was that content snaps belonging to the same publisher are able to auto connect?

Could I get some help in advancing this? The current situation is that manually connecting the plug to the slot works but for end users I need this to auto connect when one of my snaps that makes use of this content snap is installed.

I tried changing the content snap plug declaration to be more in line with the gnome content snap rather than the kde-neon snaps just in case that was where I was messing up, but no difference in terms of auto connect.

slots:
    nightmayr-kf5-qt-5-15-2-core20:
      interface: content
      read:
        - /

Hi, this plug and slot should be auto-connecting AFAICT since they are compatible and both snaps are published by the same publisher, so can you file a bug against snapd with the YAML of both snaps attached? You can file a bug at pad.lv/snapd thanks

I’ve created the bug over at launchpad https://bugs.launchpad.net/snapd/+bug/1951036. As I was writing the bug I realised that this failure to auto connect might have been because I was installing yuzu locally using the --dangerous flag and thus the snap being unaware of the content snap belonging to the same publisher? I pushed yuzu to the beta channel (v810 rev464) but installing it didn’t auto-connect the interface, but also wouldn’t allow me to manually connect as I had done previously:

$ snap connect yuzu:nightmayr-kde-frameworks-5-plug nightmayr-kf5-qt-5-15-2-core20:nightmayr-kf5-qt-5-15-2-core20
error: cannot perform the following tasks:
- Connect yuzu:nightmayr-kde-frameworks-5-plug to nightmayr-kf5-qt-5-15-2-core20:nightmayr-kf5-qt-5-15-2-core20 (connection not allowed by slot rule of interface "content")

Thanks to @ppd for making me aware of yuzu’s plug declaration being incorrect in my latest snapcraft.yaml and lacking the content identifier. Originally I had this when using the declaration copied from the kde-neon extension but the snap was side loaded using --dangerous so I’m assuming this is why the auto-connect didn’t happen originally.

The plug declaration I’ve gone with is:

nightmayr-kf5-qt-5-15-2-core20:
  default-provider: nightmayr-kf5-qt-5-15-2-core20
  interface: content
  target: $SNAP/kf5

alternatively I could’ve opted to use the previous plug name of nightmayr-kde-frameworks-5-plug and used the following:

nightmayr-kde-frameworks-5-plug:
    default-provider: nightmayr-kf5-qt-5-15-2-core20
    interface: content
    target: $SNAP/kf5
    content: nightmayr-kf5-qt-5-15-2-core20

Once again thanks for helping me to get to the bottom of this @ijohnson and @ppd

2 Likes