Content interface connection issues

@kalikiana That message is being emitted by the snap itself, so it’s hard to tell from our end what it’s really complaining about. It’s probably misjudging an issue it is finding and thinking that the interface isn’t connected.

@jzimm Is that snap yours, by any chance?

Yes, that’s my snap. I don’t know if there is anything I can do from the package side to get it autoconnected, AFAIK at the moment it has to be done manually. It’s very irritating, I know :frowning:

the message about gnome-platform is from the desktop-helper script from gnome-platform[1] which checks whether ${SNAP}/gnome-platform has been mounted, i.e. isn’t the empty folder that ships in the consumer snap.

[1] https://github.com/ubuntu/snapcraft-desktop-helpers/blob/master/gtk/runtime-exports

@jzimm The issue above is that after being connected it’s still complaining. What sort of logic is it using to detect when it is connected or not? Can you debug this a bit with @kalikiana?

Thanks in advance…

Update: If that’s the desktop-helper script and before your application is called, we’ll get the person maintaining the script to figure this out. Sorry for the trouble there.

@lucyllewy @willcooke Do you know who maintains the “desktop-helper” script? Can we get the person to have a look at the case above?

there are four contributors to that specific section of the desktop-launcher:

@kenvandine, @didrocks, @seb128, and @Trevinho. Is it Ken’s baby?

There’s a launchpad issue tracking the auto connection of interfaces after a snap has been previously run at https://bugs.launchpad.net/ubuntu-app-platform/+bug/1645731

1 Like

I’ll try to reproduce and investigate this now.

The issue isn’t in the desktop-launcher. This one just ls <mount-point> on start to check if the platform snap is connected or not. I’ve reported that particular issue via multiple channels upstream, but I can’t find the bug anymore, so maybe it has been wrongly closed?

This can be easily reproduced by the snapd team, so that you can debug it:

$ snap install gnome-3-24
$ snap install gnome-calculator
$ snap run 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)
$ snap connect gnome-calculator:gnome-3-24-platform gnome-3-24:gnome-3-24-platform
$ snap run 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)
$ snap run --shell gnome-calculator 
ls $SNAP/gnome-platform/

-> as you can see the destination directory is still empty, despite the connection after first run. @niemeyer @zyga-snapd, do you need any other information from us to get this fixed?

1 Like

No this is fine for now.

The issue is a reported snapd problem, see

Jamie added it as a “priority to the Snappy Team’s roadmap” in january
and it was raised as a problem several time on the mailing list without
a reply. The bug also didn’t get any activity until this week where Zyga
closed it without apparently even testing if the issue was resolved…

Anyway, yes, would be nice if the snappy team could finally look at that
issue, it has been an ongoing problem for us for a while

1 Like

@seb128 The snapd team has been looking at that issue for good part of the last year, and you can search here in the forum for snap-update-ns and enjoy quite a bit of information around it. Also, in the bug you refer to you’ll see @zyga-snapd responding a few days ago saying:

Zygmunt Krynicki (zyga) wrote on 2017-08-07: #10
This should be fixed now. Can you please try with snapd 2.26.14 (just use stable channel) and report back if it is a problem for you?

So let’s please calm down and try to have a more productive and friendly conversation.

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