Unable to mount S3 sync'd Local folder as External Storage device

,

Nextcloud version (eg, 20.0.5): 24.0.3
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04.4 LTS
Apache or nginx version (eg, Apache 2.4.25): Unsure, Nextcloud was installed using Snap
PHP version (eg, 7.4): Unsure, Nextcloud was installed using Snap

The issue you are facing: Attempting to mount an S3 bucket using rclone that has existing objects as an external storage device in Nextcloud

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

Steps to replicate it:

  1. Ensure the rclone config has full access to the S3 bucket being mounted
  2. Using rclone, mount an S3 bucket using the following command
    /bin/rclone mount s3:bucket /local-folder --vfs-cache-mode writes --use-server-modtime
  3. sudo chmod -R 0750 /local-folder & sudo chown -R www-data:www-data /local-folder
  4. Configure the folder in the nextcloud GUI

Here’s the output of ls -l /local-folder
total 4 drwxr-x--- 3 www-data www-data 4096 Jul 28 16:55 test_folder

The output of your Nextcloud log in Admin > Logging:

Storage with local::/local-folder/ marked as unavailable	
External storage not available: stat() failed	

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

$CONFIG = array (
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/snap/nextcloud/current/htdocs/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/var/snap/nextcloud/current/nextcloud/extra-apps',
      'url' => '/extra-apps',
      'writable' => true,
    ),
  ),
  'supportedDatabases' =>
  array (
    0 => 'mysql',
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/tmp/sockets/redis.sock',
    'port' => 0,
  ),
  'log_type' => 'file',
  'logfile' => '/var/snap/nextcloud/current/logs/nextcloud.log',
  'logfilemode' => 416,
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    1 => 'sub.domain.com',
  ),
  'datadirectory' => '/var/snap/nextcloud/common/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '24.0.3.2',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost:/tmp/sockets/mysql.sock',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '',
  'installed' => true,
  'instanceid' => '',
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'loglevel' => '1',
  'maintenance' => false,
);

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

apache_errors.log  doesn't have anything in it related to external storage errors```

Nextcloud.log:

{
    "reqId": "k7wwbj5XUK1uBZsrw7L4",
    "level": 1,
    "time": "2022-08-01T16:22:11+00:00",
    "remoteAddr": "10.0.0.194",
    "user": "NCAdmin",
    "app": "lib",
    "method": "GET",
    "url": "/index.php/apps/files_external/globalstorages/10?testOnly=true",
    "message": "Storage with local::/rclone_test/ marked as unavailable",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36",
    "version": "24.0.3.2",
    "data": {
        "app": "lib"
    }
}

{
    "reqId": "k7wwbj5XUK1uBZsrw7L4",
    "level": 1,
    "time": "2022-08-01T16:22:11+00:00",
    "remoteAddr": "10.0.0.194",
    "user": "NCAdmin",
    "app": "no app in context",
    "method": "GET",
    "url": "/index.php/apps/files_external/globalstorages/10?testOnly=true",
    "message": "External storage not available: stat() failed",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36",
    "version": "24.0.3.2",
    "data": []
}```

Sorry. I do not use S3. But maybe you can mount it directly.
Because of Snap maybe not possible.

Documentation:
Amazon S3 — Nextcloud latest Administration Manual latest documentation
Example:
S3 Object Storage mit Nextcloud nutzen (EN) | OVH Dokumentation
(sorry german and maybe not your S3 but commands there)