Adding SFTP mount as external storage to docker instance

Nextcloud version (eg, 20.0.5): 24.0.0.12
Operating system and version (eg, Ubuntu 20.04): DietPi v8.1
Apache or nginx version (eg, Apache 2.4.25): Not using nginx
PHP version (eg, 7.4): 8.0.19

The issue you are facing:

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

Mount external storage via sshfs, giving it uid=33 and gid=33 to make sure www-data is the owner of the mount point. Mount that ssfs directory into the nextcloud docker container (I used /mnt/nextcloud as the internal mount point). Confirmed that the owner and group transferred to the docker container.
Try adding that directory as external storage in Settings, but it doesn’t work.

The output of your Nextcloud log in Admin > Logging:

OCP\Files\StorageNotAvailableException: Storage with mount id 1 is not available

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'oc5eaz45jcal',
  'passwordsalt' => '<salt>',
  'secret' => '<secret>',
  'trusted_domains' => 
  array (
    0 => '<ip-addr>',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '24.0.0.12',
  'overwrite.cli.url' => '<ip-addre>',
  'dbname' => 'nextcloud',
  'dbhost' => 'mariadb',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '<user>',
  'dbpassword' => '<pwd>',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

N/A

nextcloud.log Error:

{"reqId":"7hQa2VZOpT7BR7vpCXtL","level":2,"time":"2022-05-20T19:30:48+00:00","remoteAddr":"192.168.29.155","user":"parag","app":"no app in context","method":"PROPFIND","url":"/remote.php/dav/files/parag/","message":"Error while getting quota info, using root quota","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0","version":"24.0.0.12","exception":{"Exception":"OCP\\Files\\StorageNotAvailableException","Message":"Storage with mount id 1 is not available","Code":1,"Trace":[{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":548,"function":"getAvailability","class":"OC\\Files\\Storage\\FailedStorage","type":"->","args":[]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":548,"function":"getAvailability","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":[]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","line":81,"function":"getAvailability","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":[]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","line":92,"function":"isAvailable","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":[]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","line":342,"function":"checkAvailability","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":[]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":334,"function":"free_space","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":[""]},{"file":"/var/www/html/lib/private/legacy/OC_Helper.php","line":548,"function":"free_space","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":[""]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php","line":341,"function":"getStorageInfo","class":"OC_Helper","type":"::","args":["/parag/files/Local",{"__class__":"OC\\Files\\Node\\Folder"},false]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":765,"function":"getQuotaInfo","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":[]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/PropFind.php","line":95,"function":"Sabre\\DAV\\{closure}","class":"Sabre\\DAV\\CorePlugin","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":769,"function":"handle","class":"Sabre\\DAV\\PropFind","type":"->","args":["{DAV:}quota-available-bytes",{"__class__":"Closure"}]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"propFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1052,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["propFind",[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":984,"function":"getPropertiesByNode","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\DAV\\Connector\\Sabre\\Directory"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1662,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["files/parag",["{DAV:}getlastmodified","{DAV:}getetag","{DAV:}getcontenttype","{DAV:}resourcetype","{http://owncloud.org/ns}fileid","And 15 more entries, set log level to debug to see all entries"],1]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1647,"function":"writeMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\Xml\\Writer","elementMap":[],"contextUri":"/remote.php/dav/","namespaceMap":{"DAV:":"d","http://sabredav.org/ns":"s","http://owncloud.org/ns":"oc","http://nextcloud.org/ns":"nc"},"classMap":[]},{"__class__":"Generator"},false]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":346,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Generator"},false]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:PROPFIND",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":352,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/lib/private/Files/Storage/FailedStorage.php","Line":209,"Hint":"Storage is temporarily not available","Previous":{"Exception":"OCP\\Files\\StorageNotAvailableException","Message":"Storage with mount id 1 is not available","Code":1,"Trace":[{"function":"OCA\\Files_External\\Config\\{closure}","class":"OCA\\Files_External\\Config\\ConfigAdapter","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/apps/files_external/lib/Config/ConfigAdapter.php","line":137,"function":"array_map","args":[{"__class__":"Closure"},{"1":"*** sensitive parameter replaced ***"},{"1":"*** sensitive parameter replaced ***"}]},{"file":"/var/www/html/lib/private/Files/Config/MountProviderCollection.php","line":124,"function":"getMountsForUser","class":"OCA\\Files_External\\Config\\ConfigAdapter","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"OC\\Files\\Storage\\StorageFactory"}]},{"file":"/var/www/html/lib/private/Files/SetupManager.php","line":213,"function":"addMountForUser","class":"OC\\Files\\Config\\MountProviderCollection","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"OC\\Files\\Mount\\Manager"},{"__class__":"Closure"}]},{"file":"/var/www/html/lib/private/Files/SetupManager.php","line":302,"function":"OC\\Files\\{closure}","class":"OC\\Files\\SetupManager","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/Files/SetupManager.php","line":214,"function":"setupForUserWith","class":"OC\\Files\\SetupManager","type":"->","args":[{"__class__":"OC\\User\\User"},{"__class__":"Closure"}]},{"file":"/var/www/html/lib/private/Files/SetupManager.php","line":386,"function":"setupForUser","class":"OC\\Files\\SetupManager","type":"->","args":[{"__class__":"OC\\User\\User"}]},{"file":"/var/www/html/lib/private/Files/Mount/Manager.php","line":128,"function":"setupForPath","class":"OC\\Files\\SetupManager","type":"->","args":["/parag/files",true]},{"file":"/var/www/html/lib/private/Files/View.php","line":1411,"function":"findIn","class":"OC\\Files\\Mount\\Manager","type":"->","args":["/parag/files"]},{"file":"/var/www/html/lib/private/Files/Node/Root.php","line":205,"function":"getFileInfo","class":"OC\\Files\\View","type":"->","args":["/parag/files"]},{"file":"/var/www/html/lib/private/Files/Node/LazyUserFolder.php","line":43,"function":"get","class":"OC\\Files\\Node\\Root","type":"->","args":["/parag/files"]},{"function":"OC\\Files\\Node\\{closure}","class":"OC\\Files\\Node\\LazyUserFolder","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/Files/Node/LazyFolder.php","line":69,"function":"call_user_func","args":[{"__class__":"Closure"}]},{"file":"/var/www/html/lib/private/Files/Node/LazyFolder.php","line":208,"function":"__call","class":"OC\\Files\\Node\\LazyFolder","type":"->","args":["getId",[]]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Node.php","line":247,"function":"getId","class":"OC\\Files\\Node\\LazyFolder","type":"->","args":[]},{"file":"/var/www/html/apps/text/lib/DAV/WorkspacePlugin.php","line":102,"function":"getId","class":"OCA\\DAV\\Connector\\Sabre\\Node","type":"->","args":[]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"propFind","class":"OCA\\Text\\DAV\\WorkspacePlugin","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\DAV\\Files\\FilesHome"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1052,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["propFind",[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\DAV\\Files\\FilesHome"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":984,"function":"getPropertiesByNode","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\DAV\\PropFind"},{"__class__":"OCA\\DAV\\Files\\FilesHome"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1662,"function":"getPropertiesIteratorForPath","class":"Sabre\\DAV\\Server","type":"->","args":["files/parag",["{DAV:}getlastmodified","{DAV:}getetag","{DAV:}getcontenttype","{DAV:}resourcetype","{http://owncloud.org/ns}fileid","And 15 more entries, set log level to debug to see all entries"],1]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1647,"function":"writeMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\Xml\\Writer","elementMap":[],"contextUri":"/remote.php/dav/","namespaceMap":{"DAV:":"d","http://sabredav.org/ns":"s","http://owncloud.org/ns":"oc","http://nextcloud.org/ns":"nc"},"classMap":[]},{"__class__":"Generator"},false]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":346,"function":"generateMultiStatus","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Generator"},false]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPropFind","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:PROPFIND",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/lib/Server.php","line":352,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/html/apps/files_external/lib/Config/ConfigAdapter.php","Line":142,"Hint":"Storage is temporarily not available"},"CustomMessage":"Error while getting quota info, using root quota"}}

I have an external storage server setup, that I have mounted on my Docker host via SFTP. I used the default setup instructions to setup Nextcloud with MariaDB via docker-compose, and mounted the SFTP instance to the /mnt/homeserver directory inside the nextcloud docker container. However, when I enable the External Storage addon and try adding the directory via the Local option, it fails.

From what I can tell, the problem is probably that the mounted directory inside the docker container is owned by root, causing Nextcloud to not be able to read it. Is that the correct reason, or is something else wrong that is causing this issue? I would use the SFTP option in the External Storage menu, but as far as I know, I can’t access machines on the LAN from inside a docker container (I would be gladly proven wrong if that isn’t the case).

I don’t known if this is your problem, but yes: Nextcloud (bzw. the user php runs with) must be able to read and write to /mnt/homeserver.

OK that’s what I thought. Is there a way to specify the UID and GID to be root instead of www-root while installing the docker container?

It would be www-data

Sorry yes that’s what I meant, installing Nextcloud with root ownership inside the container instead of www-data. Is there a way to do that?

No. You must use www-data

Hi @parag14,
You are missing the required support template. Please fill this form out and edit into your post.

Your can access your docker container with docker exec -it nextcloud /bin/bash

This will give us more technical info and logs needed to help you! Thanks.

@just I updated my description with more info. Also, I was able to mount the SFTP drive with the www-data user as owner, but I am still getting the same error.

1 Like

There is a high chance that www-data has a different uid/gid inside Docker than on your host system…

It’s not, I checked and the owner and group of the directory inside the docker container is still www-data.