Connect my plug to dotnet-runtime slot

I have a simple hello world type dotnet application that uses the framework dependent architecture. I can get the application to execute when I build the application as a self contained application, but I can’t get it run when it depends on the dotnet-runtime-22 snap. The specific error that I get is:

A fatal error occurred, the required library could not be found.

My snapcraft.yaml is:

name: broken
version: "0.1.0"
summary: Broken snap, won't execute
description: |
  Try to build a framework dependent app that uses dotnet-runtime-xx

grade: devel
confinement: strict

base: core18

    command: TagDatabase
      DOTNET_ROOT : $SNAP/dnet

      content: dotnet-runtime-22
      interface : content
      default-provider: dotnet-runtime-22
      target: $SNAP/dnet

    source: ./exec/
    plugin: dump
        - libicu55
        - libunwind8

The plug from my application is connected automatically to the dotnet-runtime-22 slot when the snap is installed, so I think that I have the “default-provider” piece right. I use the --dangerous flag to install the snap.

My understanding is that if I execute “snap run --shell broken”, and then navigate to the $SNAP/dnet directory, the system should have bound the directory from the dotnet snap (slot) to my snap (plug), but I can’t see anything in my directory.

The dotnet slot snap is built using a file like this.

I did take a look into seeing if there were AppArmor or Seccomp issues but it doesn’t look like security is a problem.

Any ideas that you have for things that I could try would be greatly appreciated. I’m quite new to all of this, and Linux in general, so anything at all on how to help debug this would be useful.

Do things improve if you run the following?

sudo /usr/lib/snapd/snap-discard-ns broken

This gets rid of the saved mount namespace for the snap that may have been corrupted as you’ve been experimenting with the package (based on the x24 revision number you’ve reached).

1 Like

That worked! Thanks so much for your help.

Some notes:

  1. I ran the “sudo /usr/lib/snapd/snap-discard-ns broken” command and then uninstalled the broken snap using “sudo snap remove broken”.
  2. I reinstalled the snap, but the automatic connection between my plug and the dotnet slot didn’t work, so my program failed to run. I could see this by issuing a “snap interfaces” command.
  3. I manually connected my plug to the slot and tried to run the program again, and it worked.

Thanks again for your help. I would have never figured that out on my own.

Content plugs/slots for snaps from different publishers will not auto-connect by default, so this is expected behaviour.

It is possible to change this default behaviour through special assertions sent by the store, but it doesn’t look like there is any such assertion for the dotnet-runtime-22 snap’s slot. Normally this is something the snap’s publisher (in this case dotnetcore) would request here on the forum.

Thanks for the clarification. I thought that an automatic connection was occurring, when in fact it was probably just leftover from the previous install, or something else was happening.