Hi,
I installed nextcloud via snap on a Raspberry Pi3 running Ubuntu Core.
I mounted an external HDD formatted to EXT4 to /media/Data and, from the Nextcloud web interface, I added the Local external storage (named "Data", with permission set to "all users"):

But when I try to create a file in Data folder, it says it's impossible to create files here:

If I type sudo nextcloud.occ files:scan <username> I get this error:
`Exception while scanning: opendir(/media/Data/): failed to open dir: Permission denied
Neither chown nor chmod 777 on the mount point "/media/Data" seem to work. What do you think? Thanks in advance.
Hey there @Void97, thanks for logging an issue. From the symptoms it sounds like you haven't connected the removable-media plug, could that be true? Stealing from the README in case you don't know what I'm talking about:
Also note that the interface providing the ability to access removable media is not automatically connected upon install, so if you'd like to use external storage (or otherwise use a device in /media for data), you need to give the snap permission to access removable media by connecting that interface:
$ sudo snap connect nextcloud:removable-media
Thanks for the advice!
I've tried what you suggested, now typing sudo nextcloud.occ files:scan <username> gives me a LockedException:
`Exception while scanning: "files/f3c292d7b0f1af4eddce2a8723dc76c4" is locked
But it works, from the web interface I can access to my external HDD. So it was a problem of snap confinement. Should I ignore the LockedException?
Should I ignore the LockedException?
Yeah I suspect it's temporary, e.g. it's already being scanned, so it locked it. Glad it's working! I'll go ahead and close this.
Yep, thank you!
Almost 3 years later still a valid advice! Thanks guys, saved me hours.
$ sudo snap connect nextcloud:removable-media
Still valid, fixed it for me
Most helpful comment
Hey there @Void97, thanks for logging an issue. From the symptoms it sounds like you haven't connected the
removable-mediaplug, could that be true? Stealing from the README in case you don't know what I'm talking about: