Classic confinement request: scrcpy-buddy

I understand that strict confinement is generally preferred over classic.

I’ve tried the existing interfaces to make the snap to work under strict confinement.

Note that snappy-debug can be used to identify possible required interfaces. See snapcraft .io/docs/debug-snaps for more information.

Why ‘classic’

Technical Justification:

scrcpy-buddy is a GUI frontend wrapper for system-installed developer tools (ADB and scrcpy). This architecture requires classic confinement for the following technical reasons:

  1. Execution of User-Installed System Binaries: The snap must execute arbitrary commands from the host system’s /usr/bin directory (specifically adb and scrcpy). These tools are installed by users via their distribution’s package manager and are not provided by the snap. Strict confinement prevents access to these system binaries outside the snap’s runtime environment.

  2. Access to Host System Resources: Both ADB and scrcpy require access to system resources outside the snap’s confined environment, including:

    • USB device access for Android debugging (typically in /dev)
    • System-wide library paths that scrcpy depends on
    • Network interfaces for wireless ADB connections
  3. Design Philosophy - Transparency and User Control: Unlike bundled solutions, this snap intentionally serves as a thin GUI layer over system tools. This design provides several user benefits:

    • Users receive scrcpy and ADB updates immediately through their system package manager
    • No confusion about whether the snap modifies or forks the original tools
    • Users maintain control over their development environment tooling versions
    • Reduced snap size and build complexity

Thank you for your consideration.

This request has been added to the queue for review by the @reviewers team.

Note that scrcpy itself already has a working snap distribution and is in strict confinement(I am the publisher of that snap). More reasoning will be required on why scrcpy-buddy can’t do the same.

It’s not about ‘scrcpy-buddy’ not being able to do the same.

I have explained my intention of why I chose not to do it in the 3rd point: focusing on transparency and user control

…which isn’t a supported category according to Process for reviewing classic confinement snaps :

Unsupported

  • access to arbitrary files on the system because the application isn’t designed with confinement in mind
  • access to arbitrary files on the system due to developer/user inertia

This makes the Snap Store highly unlikely to grant classic confinement. I suggest developing a solution that disables runtime customization features, yet remains functional for most users within the strict confinement paradigm.

You can still distribute a classic snap via other channels (like GitHub Releases) if the benefits outweigh the maintenance overhead.

Disclaimer: Not a Snap Store reviewer, information above is merely my opinion.

A way to do so without re-inventing too many wheels is to expose the runtime of the scrcpy snap to scrcpy-buddy via the content interface, along with some runtime environment adjustments this should allow the application to make use of it as if it is installed natively.

A prerequisite for that to happen is that the runtime provider and consumer snap must use the same base snap, which is already met (core24).

I can work with you to make the necessary changes at my part.

Hi @shripal17!

Classic confinement is reserved for specific categories, as @Lin-Buo-Ren noted. Because scrcpy-buddy doesn’t meet those criteria, we are unable to grant the request (#reject).

2 Likes

Thanks @Lin-Buo-Ren I must admit, I am a complete noob with snap. I didn’t even get adb-support to work properly with strict confinement. I suppose it was because I was running shell commands, and not communicating directly with the adb daemon. :thinking:

So if you are still open for it, you will have to be patient with me, while I try to understand and make it work with the scrcpy snap :sweat_smile:

2 Likes

I’m happy to inform you that I have made a content snap which makes incorporating scrcpy into scrcpy-based snaps easier.

See the following webpage for more information:

https://gitlab.com/brlin/scrcpy-runtime-snaps

1 Like

That looks awesome! Thanks, I will try it out soon :crossed_fingers:

1 Like

Good news. With your documentation, now adb works well with strict confinement.

Bad news: I can’t find the scrcpy executable. From the README, I suppose it should be at ${SNAP}/scrcpy-runtime/usr/local/bin.

I tried unsquashing the snap, and using snap try. I couldn’t find the scrcpy-runtime folder: neither in the squashfs-root, nor in /snap/scrcpy-buddy/x1 ($SNAP) from the running app. :thinking:

Here is the snapcraft: scrcpy_buddy/snap/snapcraft.yaml at feature/strict_snap · Codertainment/scrcpy_buddy · GitHub

Try adding this part to your Snapcraft project file:

parts:
  lp-bug-2016358-workaround:
    plugin: nil
    override-prime: |
      craftctl default
      mkdir -p "${CRAFT_PRIME}/scrcpy-runtime"

The content of the content snap should be mounted to $SNAP/scrcpy-runtime during runtime.

Still doesn’t work :confused:

Now the directory scrcpy-runtime is created, but it’s empty

Try running:

sudo snap connect scrcpy-buddy:scrcpy-runtime-2404 scrcpy-runtime-2404:scrcpy-runtime-2404

then try again.

By default content interfaces are not auto-connected if the publisher of the provider and consumer snap is different. You’ll need to request auto-connection for that to happen.

Also already tried that, didn’t work. :confused:

I also tried by installing the scrcpy-runtime snap in my machine.

You need to flip the confinement state back to strict for many of those features to work.

That’s the first thing I did, please see the snapcraft file: scrcpy_buddy/snap/snapcraft.yaml at feature/strict_snap · Codertainment/scrcpy_buddy · GitHub

1 Like

I managed to reproduce your problem. You need to drop the scrcpy-runtime-2404 entry in the apps.scrcpy-buddy.plugs stanza of your Snapcraft project file. It is not needed and, for whatever reason, it is interfering the content snap mounting.

You’ll also need to integrate the FFmpeg content snap as it is a dependency of the scrcpy-runtime content snap, see Runtime | snapcrafters/ffmpeg-2404-sdk: Content snap for ffmpeg on how to do so. See scrcpy-snap/snap/snapcraft.yaml at content-snap · brlin-tw/scrcpy-snap for the implementation details.

1 Like

Unfortunately, it still doesn’t work.

I have pushed the latest snapcraft: scrcpy_buddy/snap/snapcraft.yaml at feature/strict_snap · Codertainment/scrcpy_buddy · GitHub

Here is what I am doing:

  1. clean with snapcraft clean

  2. snapcraft pack -v

  3. sudo snap remove ffmpeg-2404

  4. sudo snap remove scrcpy-runtime-2404

  5. sudo snap install scrcpy-buddy_1.0.0_amd64.snap --dangerous

  6. snap connections scrcpy-buddy
    Interface               Plug                              Slot                            Notes
    adb-support             scrcpy-buddy:adb-support          -                               -
    alsa                    scrcpy-buddy:alsa                 -                               -
    audio-playback          scrcpy-buddy:audio-playback       :audio-playback                 -
    camera                  scrcpy-buddy:camera               -                               -
    content[ffmpeg-2404]    scrcpy-buddy:ffmpeg-2404          ffmpeg-2404:ffmpeg-2404         -
    content[gnome-46-2404]  scrcpy-buddy:gnome-46-2404        gnome-46-2404:gnome-46-2404     -
    content[gpu-2404]       scrcpy-buddy:gpu-2404             mesa-2404:gpu-2404              -
    content[gtk-3-themes]   scrcpy-buddy:gtk-3-themes         gtk-common-themes:gtk-3-themes  -
    content[gtk-3-themes]   scrcpy-buddy:gtk-3-themes         gtk-theme-breeze:gtk-3-themes   -
    content[icon-themes]    scrcpy-buddy:icon-themes          gtk-common-themes:icon-themes   -
    content[icon-themes]    scrcpy-buddy:icon-themes          icon-theme-breeze:icon-themes   -
    content                 scrcpy-buddy:scrcpy-runtime-2404  -                               -
    content[sound-themes]   scrcpy-buddy:sound-themes         gtk-common-themes:sound-themes  -
    dbus                    -                                 scrcpy-buddy:dbus-scrcpy-buddy  -
    desktop                 scrcpy-buddy:desktop              :desktop                        -
    desktop-legacy          scrcpy-buddy:desktop-legacy       :desktop-legacy                 -
    gsettings               scrcpy-buddy:gsettings            :gsettings                      -
    home                    scrcpy-buddy:home                 :home                           -
    joystick                scrcpy-buddy:joystick             -                               -
    network                 scrcpy-buddy:network              :network                        -
    network-bind            scrcpy-buddy:network-bind         :network-bind                   -
    opengl                  scrcpy-buddy:opengl               :opengl                         -
    pulseaudio              scrcpy-buddy:pulseaudio           -                               -
    raw-usb                 scrcpy-buddy:raw-usb              -                               -
    removable-media         scrcpy-buddy:removable-media      -                               -
    unity7                  scrcpy-buddy:unity7               :unity7                         -
    wayland                 scrcpy-buddy:wayland              :wayland                        -
    x11                     scrcpy-buddy:x11                  :x11                            -
    
  7. sudo snap connect scrcpy-buddy:scrcpy-runtime-2404 scrcpy-runtime-2404:scrcpy-runtime-2404

  8. Check connections again:

snap connections scrcpy-buddy
Interface                     Plug                              Slot                                     Notes
adb-support                   scrcpy-buddy:adb-support          -                                        -
alsa                          scrcpy-buddy:alsa                 -                                        -
audio-playback                scrcpy-buddy:audio-playback       :audio-playback                          -
camera                        scrcpy-buddy:camera               -                                        -
content[ffmpeg-2404]          scrcpy-buddy:ffmpeg-2404          ffmpeg-2404:ffmpeg-2404                  -
content[gnome-46-2404]        scrcpy-buddy:gnome-46-2404        gnome-46-2404:gnome-46-2404              -
content[gpu-2404]             scrcpy-buddy:gpu-2404             mesa-2404:gpu-2404                       -
content[gtk-3-themes]         scrcpy-buddy:gtk-3-themes         gtk-common-themes:gtk-3-themes           -
content[gtk-3-themes]         scrcpy-buddy:gtk-3-themes         gtk-theme-breeze:gtk-3-themes            -
content[icon-themes]          scrcpy-buddy:icon-themes          gtk-common-themes:icon-themes            -
content[icon-themes]          scrcpy-buddy:icon-themes          icon-theme-breeze:icon-themes            -
content[scrcpy-runtime-2404]  scrcpy-buddy:scrcpy-runtime-2404  scrcpy-runtime-2404:scrcpy-runtime-2404  manual
content[sound-themes]         scrcpy-buddy:sound-themes         gtk-common-themes:sound-themes           -
dbus                          -                                 scrcpy-buddy:dbus-scrcpy-buddy           -
desktop                       scrcpy-buddy:desktop              :desktop                                 -
desktop-legacy                scrcpy-buddy:desktop-legacy       :desktop-legacy                          -
gsettings                     scrcpy-buddy:gsettings            :gsettings                               -
home                          scrcpy-buddy:home                 :home                                    -
joystick                      scrcpy-buddy:joystick             -                                        -
network                       scrcpy-buddy:network              :network                                 -
network-bind                  scrcpy-buddy:network-bind         :network-bind                            -
opengl                        scrcpy-buddy:opengl               :opengl                                  -
pulseaudio                    scrcpy-buddy:pulseaudio           -                                        -
raw-usb                       scrcpy-buddy:raw-usb              -                                        -
removable-media               scrcpy-buddy:removable-media      -                                        -
unity7                        scrcpy-buddy:unity7               :unity7                                  -
wayland                       scrcpy-buddy:wayland              :wayland                                 -
x11                           scrcpy-buddy:x11                  :x11                                     -
  1. ls -a /snap/scrcpy-buddy/scrcpy-runtime is still empty. And so is ffmpeg-2404.

I have attached the verbouse out for snapcraft pack -v: https://drive.google.com/file/d/16Z5B45pJ3ZAf2_wRvEufmqXWDr_AWD6r/view?usp=drive_link

Apologies for the ignorance, I can reproduce this problem and believe that you have triggered a snapd bug that causes the scrcpy-runtime-2404 content snap not mounted properly.

I’m looking into getting that bug fixed, in the meantime, I suggest you directly incorporate the scrcpy snap’s part building recipe into your snap.