Requesting classic confinement: sharik

Hi,

I would like to request classic confinement for the sharik snap.

Sharik is an open-source, cross-platform application for sharing files within a local network.

Classical confinement is required for the app because it needs to access users’ files directly.

The app is written in Flutter and Golang

Thanks,
Mark

Welcome to the community @marchellodev!

Strictly confined Snaps can access users’ files with the home and the removable-media interfaces. home is auto-connected by default and you can request auto-connection for removable-media.

Another possibility is to use XDG Desktop Portals, but I’m not sure if Flutter supports that. @kenvandine, do you know if Flutter supports portals?

PS: To avoid confusion: I’m not an official reviewer, just a community member.

I use linux’s native file selecting dialog. Flutter doesn’t support it, as far as I know, but I’m using hover.build for desktop support

So does this mean I don’t need the classic confinement and I will be just fine with the standard one?

Sorry, I didn’t have much experience with snap

Yes, if you add these interfaces to the “plugs” of your application, it will be able to access user files, even without classic confinement. You’ll probably also need the network interface for network access. See Adding interfaces for more information on how to use these interfaces in your snap.

Note that users will still need to manually give your app permission to access files on removable media like USB sticks. They do this using one of the settings GUIs or by running snap connect sharik:removable-media. If you want access to removable-media by default, you should create a new post to request auto-connection. See the removable-media docs page for more information on which apps will be allowed auto-connection to removable-media.

Wow, thank you very much.

I did all of that and even published the app, but now when i try to run it I get this error /snap/sharik-app/4/sharik: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory

Did I miss something or are there some problems with the app?

Strict confinement means snaps run in insolation and so cannot access things like shared libraries etc from the host system - in this case you need to ensure the snap includes all shared libraries etc that it requires itself - this can be done easily via the stage-packages directly to include relevant packages from the Ubuntu archive as appropriate.

Thank you a lot.

I added stages and opengl support, but I can’t get rid of this error: creating glfw window: APIUnavailable: EGL: Failed to get EGL display: Success
Here is my snapcraft.yaml

Do you guys know how to fix this?

By the way, when I’m switching to the classic confinement, everything just works

You’ve included the GLib Snapcraft Desktop Helper part, this helps set up a substantial amount of a functional Snapcraft environment. However to fully make use of it, you need to run the desktop-launch wrapper prior to your app itself. The easiest way is to simply prepend it to the binary you want to run, so command: {{.executableName}} becomes command: desktop-launch {{.executableName}}, assuming of course the placeholder is actually updated.

Alternatively, use the command-chain functionality to run it prior to your app, so you’d need:

apps:
  {{.packageName}}:
  command-chain: 
      - bin/desktop-launch

The second one is how the Snapcraft extensions do it. The first is how you more commonly see it for Snapcraft Desktop Helper parts. Both do basically the same thing but there’s a slight preference for the second format as it ensures the desktop-launch script would run if you ever did snap run --shell $app for example.

Thank you, it works!

It seems this request is solved. @marchellodev, feel free to reopen this request if needed. Thanks!

Yep, thank you @James-Carroll, @galgalesh and @alexmurray, you made it work!

2 Likes