[Classic confinement] Robogif - Accessing system binaries from a snap

Hi!

I’m trying to package my little Android screen recording tool into a snap. The tool is a simple Python affair that packages ffmpeg to do required conversions and uses Android adb to actually start recording.

Now, when attempting to publish the snap, I’ve noticed that I need to use ‘classic’ confinement because my tool wants to run “adb” from the users path. That is because adb loves to run a single global daemon to communicate with the device and that daemon is not tolerant of different adb versions used. So if I package adb inside the snap and user is a developer using adb from Android Studio distribution, the adb invocation will kill users ADB daemon and prevent him from using functionality in Android Studio. The only way to avoid that is to always use the same adb from path.

Is there any better way of achieving what I want?

Source of my tool: https://github.com/izacus/RoboGif
Snapcraft revision review: https://dashboard.snapcraft.io/snaps/robogif/revisions/2/

The problem is that if your snap is classic, there is no guarantee that any adb is on the system. There is an android-studio snap though. It sounds like perhaps it should provide an adb slot that your snap can then plugs. See https://github.com/snapcore/snapd/wiki/Interfaces#content for details.

I don’t think classic confinement will help here. As @jdstrand said there can be no guarantee that adb is install on the host and in the case of Android Studio it will be uncertain how it has been installed.

For now I think the best approach is to go with strict confinement and make use of the raw-usb interface and build android-tools in your snap. See the ubports installer for reference.

You will also run into the issue of missing udev rules. I opened a discussion here: Udev-rules for fastboot and adb

1 Like