S3 Storage issues

Nextcloud version (eg, 20.0.5): 25.0.3
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.54
PHP version (eg, 7.4): 8.1

The issue you are facing: I can’t find files in S3 Bucket

Is this the first time you’ve seen this error? Y:

Steps to replicate it:

  1. Migrate from standard install with local storage to s3 primary storage using this guide https://github.com/nextcloud/server/issues/25781#issuecomment-1326828065
  2. After fiew days some users reports sync problems, take a look on S3 interface and see that there are no updates for a week but all files seems to be present on Nextcloud interface

The output of your Nextcloud log in Admin > Logging:

[PHP] Erreur: Error: fopen(https://******.s3.gra.perf.cloud.ovh.net/urn%3Aoid%3A163954): Failed to open stream: HTTP request failed! HTTP/1.1 416 Requested Range Not Satisfiable
 at /var/www/nextcloud/www/lib/private/Files/ObjectStore/S3ObjectTrait.php#87 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError()
 1. /var/www/nextcloud/www/lib/private/Files/ObjectStore/S3ObjectTrait.php line 87
    fopen()
 2. /var/www/nextcloud/www/lib/private/Files/Stream/SeekableHttpStream.php line 89
    OC\Files\ObjectStore\S3->OC\Files\ObjectStore\{closure}("*** sensitive parameters replaced ***")
 3. /var/www/nextcloud/www/lib/private/Files/Stream/SeekableHttpStream.php line 140
    OC\Files\Stream\SeekableHttpStream->reconnect()
 4. /var/www/nextcloud/www/lib/private/Files/Stream/SeekableHttpStream.php line 165
    OC\Files\Stream\SeekableHttpStream->getCurrent()
 5. <<closure>>
    OC\Files\Stream\SeekableHttpStream->stream_read()
 6. /var/www/nextcloud/www/3rdparty/icewind/streams/src/Wrapper.php line 55
    fread()
 7. /var/www/nextcloud/www/3rdparty/icewind/streams/src/CallbackWrapper.php line 96
    Icewind\Streams\Wrapper->stream_read()
 8. <<closure>>
    Icewind\Streams\CallbackWrapper->stream_read()
 9. /var/www/nextcloud/www/3rdparty/sabre/http/lib/Sapi.php line 110
    stream_copy_to_stream()
10. /var/www/nextcloud/www/3rdparty/sabre/dav/lib/DAV/Server.php line 490
    Sabre\HTTP\Sapi::sendResponse()
11. /var/www/nextcloud/www/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
12. /var/www/nextcloud/www/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
13. /var/www/nextcloud/www/apps/dav/lib/Server.php line 360
    Sabre\DAV\Server->exec()
14. /var/www/nextcloud/www/apps/dav/appinfo/v2/remote.php line 35
    OCA\DAV\Server->exec()
15. /var/www/nextcloud/www/remote.php line 171
    require_once("/var/www/nextcl ... p")

GET /remote.php/dav/files/<user>/<Path>/IMG_0768.jpg
from <IP> by <user> at 2023-02-16T11:20:21+00:00

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

$CONFIG = array (
  'instanceid' => '*****',
  'passwordsalt' => '*****',
  'secret' => '*******',
  'trusted_domains' => 
  array (
    0 => 'cloud.******.com',
    1 => 'cloud.******.fr',
  ),
  'datadirectory' => '/var/www/nextcloud/www/data',
  'dbtype' => 'mysql',
  'version' => '25.0.3.2',
  'overwrite.cli.url' => 'https://cloud.******.fr',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => '*******',
  'installed' => true,
  'maintenance' => false,
  'objectstore' => 
  array (
    'class' => 'OC\\Files\\ObjectStore\\S3',
    'arguments' => 
    array (
      'bucket' => '******',
      'autocreate' => true,
      'hostname' => '********',
      'port' => 443,
      'key' => '******',
      'secret' => '*******',
      'use_ssl' => true,
      'use_path_style' => false,
      'region' => '*****',
    ),
  ),
  'loglevel' => '2',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '127.0.0.1',
    'port' => 6379,
    'dbindex' => 0,
    'password' => '*********',
    'timeout' => 1.5,
  ),
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'updater.secret' => '*****',
  'default_phone_region' => 'FR',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'cloud',
  'mail_domain' => '*******',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 's*****',
  'mail_smtpport' => '587',
  'mail_smtpname' => '********',
  'mail_smtppassword' => '*******',
);

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

[Thu Feb 16 12:37:53.211794 2023] [access_compat:error] [pid 189383:tid 139892654864128] [client ********57864] AH01797: client denied by server configuration: /var/www/nextcloud/www/data/.ocdata
[Thu Feb 16 12:40:55.624358 2023] [access_compat:error] [pid 189384:tid 139893560817408] [client ********:57949] AH01797: client denied by server configuration: /var/www/nextcloud/www/data/.ocdata

Actually the file concerned by the report in the log as been deleted
I ran filescan with no effects as seems that it doen’t scan s3 storage:

sudo -u nextcloud /usr/bin/php8.1 occ files:scan --all
±--------±------±-------------+
| Folders | Files | Elapsed time |
±--------±------±-------------+
| 0 | 0 | 00:00:00 |
±--------±------±-------------+

aws ls s3://my-bucket

shows no updates for a week BUT files are present on interface

The datadir on server is empty

A good migration from local to S3 is a bit of a challenge… have you done it all correctly?

I built a script that handles the migration, also my “local to S3 script” does a bunch of checks… you could check it out and use the “S3 sanity check part” ?