Can I not "snap try" a squashfuse-mounted snap directory?

I know that if I download a snap, and unsquashfs it on my local system, I can install it with “snap try squashfs-root”, where the snap was unpacked. But if I “squashfuse” mount it to a local directory instead, then even though the contents are apparently identical, I can’t use “snap try” on that:

error: cannot try “/…/m”: not a snap directory

Sure, the squashfuse-mounted snap is mounted read-only, but since a snap is mounted that way by default anyway, that should make no difference. Does “snap try” simply not recognize squashfuse-mounted snaps?

Yes, I can confirm this observation. This is due to security measures of fusermount which allows users to mount filesystems, but no other users including root can access it (see https://manpages.debian.org/stretch/fuse/mount.fuse.8.en.html - Security notes). So what happens is snapd cannot stat this directory (if you sudo stat <your mount dir> you will see “access denied” error).

What you can do instead is something like:

sudo mount <your snap> -o allow_other -t fuse.snapfuse <mountdir>

and then snap try over mountdir, but this doesn’t make much sense, since if you have a snap blob then you can just install it; snap try is meant to help in snap development where you can quickly iterate over your snap directory without needing to build the blob.

1 Like