Content Interface does not mount files

Bug #1849845 reported by James Jesudason
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
snapd
Fix Released
High
Zygmunt Krynicki

Bug Description

From one of our customers:

As described in our last meeting we have serious problems using the content plugin.

Scenario:
We use the content interface to mount a folder from multiple Snaps into one central snap.
The central snap is providing a Plug as described in yaml:
  package-assets:
    interface: content
    content: package-assets
    target: $SNAP_DATA/package-assets

All other snaps provide a Slot as following:
  package-assets:
    interface: content
    content: package-assets
    read:
      - $SNAP_DATA/package-assets

After installation and connecting the interface works fine. mounting a directory $SNAP_DATA/package-assets-n/ in the central snap.

After a restart of the device interfaces still show connected. And the corresponindg $SNAP_DATA/package-assets folder is available, but the content is empty.

Seems like it has something to do with Apparmor, see logs attached

Revision history for this message
James Jesudason (jamesj) wrote :
Revision history for this message
James Jesudason (jamesj) wrote :

Attached is a snippet from the log. I have a full log if needed.

Zygmunt Krynicki (zyga)
Changed in snapd:
status: New → In Progress
assignee: nobody → Zygmunt Krynicki (zyga)
importance: Undecided → High
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Reproduced.

Looking for the cause now.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I understand the cause now. Looking for a solution.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I have a workaround and I will work with the release manager to get this into 2.42.1

Changed in snapd:
milestone: none → 2.42
Zygmunt Krynicki (zyga)
Changed in snapd:
milestone: 2.42 → 2.42.1
Revision history for this message
Loïc Minier (lool) wrote :

Thanks for the quick turnaround for a fix :-) Would you mind updating this bug when a snapd is available in edge and/or beta channels for testing? I understand that an edge build will likely happen in the next couple of days once the pull request is reviewed and merged, and that a beta/stable update would be more in the ~1/2 weeks time frame.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

This is fixed by the following pull request https://github.com/snapcore/snapd/pull/7677

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

@Loic: sure, I'll send the update as soon as this is in edge.

For a priority request we can also publish the patch in a branch and that can be done extremely rapidly. We can have the fix available in several hours.

Revision history for this message
Jochen Scheib (sjo2lo) wrote :

Hi,
regarding your PR. You mentioned that it is a misuse of direct mode and that there is a spool mode for use cases like this. Can you provide information about the spool mode?

Thanks.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

@Jochen the spool mode is not documented in the proper place (snapcraft.io/docs) but it is documented on the forum in the feature discussion thread here: https://forum.snapcraft.io/t/improvements-in-the-content-interface/2387

The main difference is that the syntax changes so that slots have a "source" attribute that can have both read and write attributes with lists of paths.

slots:
  content:
    source:
      read: [$SNAP/foo]
      write: [$SNAP_DATA/bar]

The plug side syntax is the same as before.

Connecting such slot to a plug changes the semantics in one way, in the direct mode the plug target directory is used *directly* as the mount target. For example with this plug

plugs:
  content:
    target: $SNAP_DATA/here

A single direct slot defining a single directory to read or write would just get mounted over "here". In the new spool mode the directory "here" is not mounted over. Instead each element defined by all the connected slots are mounted as distinct entries inside. For example, if the slot and plug defined in this comment were connected the resulting directory tree would look like this:

$SNAP_DATA/here/foo # bind mount to other side snap's $SNAP/foo
$SNAP_DATA/here/bar # bind mount to other side snap's $SNAP_DATA/bar

The spool mode is better because you can then enumerate "here" and know what is connected reliably.

Revision history for this message
Jochen Scheib (sjo2lo) wrote :

Thanks for the fast response.

Zygmunt Krynicki (zyga)
Changed in snapd:
status: In Progress → Fix Committed
Zygmunt Krynicki (zyga)
Changed in snapd:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.