Ubuntu – How to get access to USB-storage from an application installed as Snap

18.04permissionssnapusb-driveusb-storage

I have Ubuntu 18.04 LTS installed.

I inserted USB-flash to my laptop. It was automounted to /media/username/DISKLABEL and opened in Nautilus. I can read and write objects to it.

How can I access it from the application, which is installed as Snap?

I tried snaps of the following applications such as gedit, arduino-mhall119, organize-my-files. All them show me errors if I navigate to /media folder:

trying to access /media

trying to access /media

Could not read the contents of Media

Error opening the directory of '/media': permission denied

Output of active Snap interfaces is below:

$ snap interfaces  | grep -v ".*-$"
Slot                             Plug
:browser-support                 organize-my-files
:core-support                    core:core-support-plug
:cups-control                    gedit
:desktop                         gedit,organize-my-files
:desktop-legacy                  gedit,organize-my-files
:gsettings                       gedit,organize-my-files
:home                            arduino-mhall119,gedit,organize-my-files
:network                         arduino-mhall119,gedit,organize-my-files,pulsemixer
:opengl                          organize-my-files
:pulseaudio                      organize-my-files,pulsemixer
:unity7                          arduino-mhall119,gedit,organize-my-files
:wayland                         gedit
:x11                             arduino-mhall119,organize-my-files,pulsemixer
gnome-3-26-1604:gnome-3-26-1604  gedit
gtk-common-themes:gtk3-themes    gedit
gtk-common-themes:icon-themes    gedit
gtk-common-themes:sound-themes   gedit
-                                arduino-mhall119:serial-port
-                                gedit:avahi-observe
-                                gedit:mount-observe

Updates:

  • connecting mount-observe to Gedit with snap connect gedit:mount-observe does not help.
  • it seems that we need special Snap with support of removable-media interface.

Best Answer

So we need special prepared Snap with support of removable-media connector/interface/plugin.

Below is a list of Snap with removable-media plug described in YAML-manifest :

One can find other Snaps released by SnapCrafters with the following GitHub search link.


So if the application does not have auto-connect of removable-media we need to connect it manually with:

snap connect some-snap-name:removable-media

But not all applications have this plug/interface in YAML-manifest.


It is hard to find packages by supported plugs - so I created issue "Add ability for parametric Snap search with filters (plugs, such as removable-media and so on)" about snapcraft.io site.

The bug about snap command named "snap should provide functionality to find packages with needed plug or connector" was filed to launchpad as bug 1776938.

Related Question