Content interface connection issues

Sorry but I’m following things happening as much as I can but not everybody has your knowledge of the snapd details, I’m not familiar with snap-update-ns and while I probably read some of the forum topics I didn’t connect those to the bug report. It would really help if the snappy team would triage bugs reports and give some feedback of what is happening on launchpad/reply on the list rather than expecting the reporters to keep up with on all the details of what the snappy team is doing.

Where can I find 2.26.14? xenial-proposed only has 2.26.10.
I tried 2.27.1 from artful-proposed but gnome-calculator abort on start with that version, that seems a different issue/a regression but it blocks me from verifying the fix.

Right, sorry about that. There has been some stress created by the fact that we (desktop) sometime feel like we are raising issues we believe are important (like that one) but then we don’t manage to get any conversation going with the snappy team (no reply to our emails on the list or triaging of the bugs we report) and later on the problems come back our way and are used to argue that desktop/snap is having quality issues.
That’s probably something worth discussing and trying to resolve but here is not the right place so apologies for showing some of that frustration in my reply

@seb128 Apologies accepted, and I also apologize for not giving attention to all issues as promptly as we’d both have liked. We’ve had too many trips and holidays in the past two months or so, and that also helped taking our attention elsewhere. I’m still not done catching up on everything that was left behind over that period, but that should be done soon.

In the future, for anything relevant you want attention on, please raise the issue here in the forum. This is where we have the most eyes on, and where we spend good part of our days discussing issues, so even if you have a bug open in Launchpad, please raise awareness here as well.

I will work on this next (sorry, the release work took extra time)

1 Like

Ok, sorry for taking forever.

I was testing a relatively recent snapd from edge:

$ snap --version
snap    2.27.1+git322.46fa975~ubuntu16.04.1
snapd   2.27.1+git322.46fa975~ubuntu16.04.1
series  16
ubuntu  16.04
kernel  4.10.0-32-generic

I tried the handbrake-jz snap and immediately ran into the issue. Ironically it is not related to the order of starting snaps at all. Let me bring in some facts before I get to the point.

This is the application snap:

$ cat /snap/handbrake-jz/current/meta/snap.yaml 
apps:
  ghb:
    command: command-ghb.wrapper
    plugs:
    - unity7
    - home
    - gsettings
    - mount-observe
    - network
    - process-control
architectures:
- amd64
confinement: strict
description: |
  HandBrake is a tool for converting video from nearly any format to a
  selection of modern, widely supported codecs.
epoch: 2
grade: stable
name: handbrake-jz
plugs:
  gnome-3-24-platform:
    default-provider: gnome-3-24:gnome-3-24-platform
    interface: content
    target: $SNAP/gnome-platform
summary: HandBrake is a tool for convertion video to.
version: 1.0.7-1

This is the shared content snap:

$ cat /snap/gnome-3-24/current/meta/snap.yaml 
architectures:
- amd64
confinement: strict
description: "This snap includes a GNOME 3.24 stack (the base libraries and desktop\
  \ \nintegration components) and shares it through the content interface. \nIt's\
  \ built using the Ubuntu xenial backport binaries.\n"
grade: stable
name: gnome-3-24
slots:
  gnome-3-24-platform:
    interface: content
    read:
    - /
summary: Shared GNOME 3.24 Ubuntu stack
version: 3.24

Interestingly installing both does not result in any attempts to connect. Note that the content attribute is absent from both the plug and the slot but this is okay as by default the plug/slot name is used as the content attribute.

This renders the following situation:

plug: handbrake-jz:gnome-3-24-platform
slot: gnome-3-24:gnome-3-24-platform

The interface is set to auto-connect if the base declaration or snap assertions allow this to happen, let’s have a look at those then.

The base declaration:

  content:
    allow-installation:
      slot-snap-type:
        - app
        - gadget
    allow-connection:
      plug-attributes:
        content: $SLOT(content)
    allow-auto-connection:
      plug-publisher-id:
        - $SLOT_PUBLISHER_ID
      plug-attributes:
        content: $SLOT(content)

Here we see that the plug’s content attribute must be the same as the content attribute of the slot. We also see a restriction that the publisher of both plug and slot snaps must be the same. Under those rules the interfaces would not auto-connect as the publishers are canonical and jz.

Looking at snap declarations I don’t see anything changing this. I therefore conclude that those snaps will not auto-connect today.

Let’s proceed to connect them manually now:

$ sudo snap connect handbrake-jz:gnome-3-24-platform gnome-3-24:gnome-3-24-platform

Inspecting the mount namespace I created earlier (by running handbrake-jz) I see that it was modified according to the new connection:

$ sudo nsenter -m/run/snapd/ns/handbrake-jz.mnt
# cat /proc/self/mountinfo | grep gnome-platform
1216 1131 7:40 / /snap/handbrake-jz/12/gnome-platform ro,nodev,relatime master:224 - squashfs /dev/loop40 ro

Attempting to start the snap now doesn’t mention the absent platform snap:

zyga@fyke:~/go/src/github.com/snapcore/snapd/interfaces/builtin$ handbrake-jz.ghb 

(process:18379): Gtk-WARNING **: Locale not supported by C library.
	Using the fallback 'C' locale.

(ghb:18379): GLib-GIO-ERROR **: No GSettings schemas are installed on the system
Pułapka debuggera/breakpoint (zrzut pamięci)

The snap crashes though.

Trying this with gnome-calculator snap I get the expected behaviour:

zyga@fyke:~/snapd/interfaces/builtin$ /snap/bin/gnome-calculator 
You need to connect this snap to the gnome platform snap.

You can do this with those commands:
snap install --edge gnome-3-24
snap connect gnome-calculator:gnome-3-24-platform gnome-3-24:gnome-3-24-platform

(the '3-24' number defines the platform version and might change)

The calculator does not start out-of-the-box.

zyga@fyke:~/snapd/interfaces/builtin$ sudo snap connect gnome-calculator:gnome-3-24-platform gnome-3-24:gnome-3-24-platform 

zyga@fyke:~/snapd/interfaces/builtin$ /snap/bin/gnome-calculator 

(gnome-calculator:19949): Gtk-WARNING **: Locale not supported by C library.
	Using the fallback 'C' locale.
Gtk-Message: Failed to load module "canberra-gtk-module"
Gtk-Message: Failed to load module "canberra-gtk-module"

The calculator starts correctly.

zyga@fyke:~/snapd/interfaces/builtin$ sudo snap disconnect gnome-calculator:gnome-3-24-platform gnome-3-24:gnome-3-24-platform 
zyga@fyke:~/snapd/interfaces/builtin$ /snap/bin/gnome-calculator 
You need to connect this snap to the gnome platform snap.

You can do this with those commands:
snap install --edge gnome-3-24
snap connect gnome-calculator:gnome-3-24-platform gnome-3-24:gnome-3-24-platform

(the '3-24' number defines the platform version and might change)

The calculator no longer starts.

I quickly tested 2.26.14 and … found this feature not to exist there. I confused my git archaeology apparently as this feature (or really a fix for a missing feature) was not released yet. It for sure exists in 2.27.x but not in 2.26.x.

Looking at git more I see the feature was merged after 2.26 was forked off as a release branch.

So there we have it, 2.27.2 was just released. Once it finds it way to distributions this issue should be addressed.

1 Like