Fuse-support plug and mount points in $SNAP_COMMON folder

So the snap uses fuse-support plug and was trying to mount to /media/mstp directory which did not work. The snappy-debug suggested to use the mount points from SNAP directories and so I tried to create a directory in $SNAP_COMMON and tried to mount which resulted in permission denied error. Any idea how to overcome this issue ? Please let me know if you need more info.

Thanks

 = AppArmor =
Time: Feb 16 06:38:29
Log: apparmor="DENIED" operation="mkdir" profile="snap.usermstp.usermstpser" name="/media/mstp/" 
pid=17467 comm="mkdir" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
File: /media/mstp/ (write)
Suggestion:
* adjust program to write to $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or 
$SNAP_USER_COMMON

= AppArmor =
Time: Feb 16 06:41:22
Log: apparmor="DENIED" operation="mount" info="failed mntpnt match" error=-13 
profile="snap.usermstp.fusemstp" name="/var/snap/usermstp/common/mstp/" pid=17993 
comm="fuse_mstp" fstype="fuse.fuse_mstp" srcname="fuse_mstp" flags="rw, nosuid, nodev"

that translates to “I tried to create a directory in /var/snap/<snapname>/common” … is your app running as root (did you use sudo) ? Else you wont have permissions to create a dir there …

If you want this to work without sudo permissions use $SNAP_USER_COMMON (which translates to ~/snap/<snapname>/common) where the user definitely has write permissions.

@ogra ,Yes I am running my app as root but that does not seem to be helping.

what is the exact error when you try to run your app with sudo and tell it to use $SNAP_COMMON ?

failed mntpnt match is the error scanlog shows (below is the log).

= AppArmor =
Time: Feb 16 06:41:22
Log: apparmor="DENIED" operation="mount" info="failed mntpnt match" error=-13 
profile="snap.usermstp.fusemstp" name="/var/snap/usermstp/common/mstp/" pid=17993 
comm="fuse_mstp" fstype="fuse.fuse_mstp" srcname="fuse_mstp" flags="rw, nosuid, nodev"

well, the dir creation worked at least :slight_smile:

did you connect the fuse-suppport interface with snap connect ?

Note, the fuse-support interface does not support user mounts.

1 Like

Today, the fuse-support interface only allows mounts to SNAP_DATA and SNAP_USER_DATA.

I see no reason why we couldn’t also support SNAP_COMMON and SNAP_USER_COMMON, so I’ve added this to the list for the next batch of updates.

2 Likes

@ogra, the directory was created in a startup script with mkdir -p /$SNAP_USER_COMMON/mstp command . Do you think that might be the reason behind the permission denied error ? Thanks .

@jdstrand, thanks for the clarification. Can it also be made to support mounting something like /media/<some-directory> as well ?

no, as @jdstrand said above, the interface currently only allows $SNAP_USER_DATA and $SNAP_DATA as mountpoints (not _COMMON). So try to change this and it should work … (or wait til the next batch of updates that will allow _COMMON too)

Cool, that did the trick, useing $SNAP_DATA got the fuse working. Thanks for the support.

To expand on @ogra’s answer (which I agree with), we are being very careful with the mount locations that fuse-support can do. Specifically we limit them to the snap’s directories so that the snap can’t interfere with other parts of the system.

Thanks for the clarification.

FYI, https://github.com/snapcore/snapd/pull/5006

2 Likes