Automount Core system-files

Hello again.

My snap already have access to mount-control, but It cannot create the mount points so in needs access to /media to create them.

Here is the source code

Thanks.

The mount-control interface only gives your application access to the mount command, nothing else… your app needs to take care of all the rest … i.e. the usual normal linux permissions to execute “mount” on a system level must be met (read: your app needs to be invoked with sudo by the user or run by root)

The interface will also not magically create mount points etc, you will have to find a solution for this yourself (i.e. by using a system-files interface or the removable-media one to gain access to /mnt and/or /media)

It needs system-files as removable-media only grant read access to /media and read/write to its children

Edit: I forgot to explain in the first post that I’m requesting access to system-files. Can @reviewers take a look?

Hi @ed10vi , I think the ask here is for automount to get auto-connect to removable-media interface since removable-media allows read/write access to mounted removable storage in /media, /run/media and /mnt.

If this is the case then +1 from me since it allign with the use-case of this snap

thanks

Hi. removable-media is not enough as it does not allow to create and remove the mount points because it only allow read access to /media and read/write to its children

https://github.com/snapcore/snapd/blob/5bbdeb8b2e13c0ae0ab8fa166e1ba35a7f84d385/interfaces/builtin/removable_media.go#L46

hi @ed10vi , True, but it allows the snaps to mount in /run/media/<user>/* or /media/<user>/*. The automount snap is mounting the storage to /media/auto/* directory, any particular reason behind not mounting it in /media/<user>/* directory?

thanks

Because it’s running as a service in Ubuntu Core without users and the directory /media/root does not exists, It would have to create it and It has no permissions

hi @ed10vi, does adjusting your system-files interface to write to /media/auto keep your snaps intended functionality and give your snap the ability to create /media/auto and mount under it?

Perhaps with something like the following for your media plug:

interface: system-files                                                                                                                                                                                 
write:                                                                                                                                                                                                  
  - /media/auto

Oh, great, it works.

Updated the interface name to media-auto

Given the purpose of the snap and the requirement to access only /media/auto, +1 from me for auto-connecting media-auto using the system-files interface. Could other @reviewers please vote

1 Like

As @cav said, considering the purpose and that existent removable-media interface does not fit for this situation +1 from me for granting write access to /media/auto via system-files.

+2 votes for, 0 against. Granting this snap auto-connection to media-auto interface. This is now live.

1 Like