Unexpected server response (503) while retrieving PDF

Hi,

This is my first topic and first call for help, hope I’m doing it right. Since the last nextcloud update, I have problems to access files and to run occ comands. Somthing seems to have broken somwhere and I cannot find a solution online.

For ex., when trying to open a pdf file from a browser, it returns the following error message:

PDF.js v2.4.456 (build: 228a591c)
Message: Unexpected server response (503) while retrieving PDF "https://cloud.xxxxx.xx/remote.php/dav/files/...

…and when trying to run the following command (which used to work until recently) “sudo -u www-data php /var/www/nextcloud/occ files:scan --all”, I get the following error message:

Starting scan for user 1 out of 1 (User)
Home storage for user User not writable
Make sure you're running the scan command only as the user the web server runs as

I am running nextcloud on a RPI4, files are stored (/data) on an external USB drive. More config info below:

Nextcloud version: 21.0.0 beta1 (note that I had the same problem with the latest stable)
Operating system and version: Raspbian buster
nginx version: nginx/1.14.2
PHP version: PHP 7.3.19-1~deb10u1 (cli) (built: Jul 5 2020 06:46:45) ( NTS )

The nextcloud folder/files have been set with the following permissions:

chown -R www-data:www-data
-type d -exec chmod 750
-type f -exec chmod 640

root@nc-serv:/var/www/nextcloud# sudo ls -la
total 164
drwxr-x— 13 www-data www-data 4096 Dec 20 18:28 .
drwxr-xr-x 6 root root 4096 Oct 22 02:56 …
drwxr-x— 43 www-data www-data 4096 Dec 20 18:28 3rdparty
drwxr-x— 50 www-data www-data 4096 Dec 25 13:58 apps
-rw-r----- 1 www-data www-data 17234 Dec 20 18:27 AUTHORS
drwxr-x— 2 www-data www-data 4096 Dec 28 21:17 config
-rw-r----- 1 www-data www-data 3893 Dec 20 18:27 console.php
-rw-r----- 1 www-data www-data 34520 Dec 20 18:28 COPYING
drwxr-x— 22 www-data www-data 4096 Dec 20 18:28 core
-rw-r----- 1 www-data www-data 5083 Dec 20 18:27 cron.php
lrwxrwxrwx 1 www-data www-data 21 Oct 20 05:24 data -> /media/nextcloud/data
-rw-r----- 1 www-data www-data 3124 Dec 20 18:30 .htaccess
-rw-r----- 1 www-data www-data 156 Dec 20 18:27 index.html
-rw-r----- 1 www-data www-data 2960 Dec 20 18:27 index.php
drwxr-x— 6 www-data www-data 4096 Dec 20 18:28 lib
-rw-r----- 1 www-data www-data 283 Dec 20 18:27 occ
drwxr-x— 2 www-data www-data 4096 Dec 20 18:28 ocm-provider
drwxr-x— 2 www-data www-data 4096 Dec 20 18:28 ocs
drwxr-x— 2 www-data www-data 4096 Dec 20 18:28 ocs-provider
-rw-r----- 1 www-data www-data 3102 Dec 20 18:28 public.php
-rw-r----- 1 www-data www-data 5341 Dec 20 18:27 remote.php
drwxr-x— 4 www-data www-data 4096 Dec 20 18:28 resources
-rw-r----- 1 www-data www-data 26 Dec 20 18:27 robots.txt
-rw-r----- 1 www-data www-data 2388 Dec 20 18:27 status.php
drwxr-x— 3 www-data www-data 4096 Dec 20 18:28 themes
drwxr-x— 2 www-data www-data 4096 Dec 20 18:30 updater
-rw-r----- 1 www-data www-data 101 Dec 20 18:28 .user.ini
-rw-r----- 1 www-data www-data 368 Dec 20 18:27 version.php

This is the logfile output after trying to open a PDF file from Firefox:

Fatal	webdav	Sabre\DAV\Exception\ServiceUnavailable: Could not open file	

Error	PHP	Error: fopen(/media/nextcloud/data/User/files/doc.pdf): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#355

I don’t understand why it is mentioned that there is no such file or directory…

Can anyone please help identifying the problem? I am lost here…

Thank you

lls

Can anyone please help?

In addition to the above:

The config.php file

<?php
$CONFIG = array (
  'instanceid' => 'XXXXXXX',
  'passwordsalt' => 'XXXXXXXX',
  'secret' => 'XXXXXXXX',
  'trusted_domains' => 
  array (
    0 => 'cloud.XXXXX.org',
  ),
  'datadirectory' => '/media/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '21.0.0.11',
  'overwrite.cli.url' => 'http://cloud.XXXXX.org',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXXXX',
  'dbpassword' => 'XXXXXXX',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'XXXXXXX',
  'mail_domain' => 'gmail.com',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'smtp.gmail.com',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'XXXXXXXX.com',
  'mail_smtppassword' => 'XXXXXXX',
  'mail_smtpauthtype' => 'LOGIN',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.release.channel' => 'stable',
  'twofactor_enforced' => 'false',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => 'localhost',
    'port' => 0,
  ),
  'log_rotate_size' => 52428800,
);

The /var/log/nginx/error.log

2021/02/01 01:24:29 [crit] 13856#13856: *2517 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 74.82.47.2, server: 0.0.0.0:443
2021/02/01 12:47:57 [error] 13856#13856: *4736 access forbidden by rule, client: xxx.38.124.xx, server: cloud.XXXXXXX.org, request: "GET /.well-known/webfinger HTTP/2.0", host: "cloud.XXXXXXX.org"
2021/02/01 12:47:57 [error] 13856#13856: *4736 access forbidden by rule, client: xxx.38.124.xx, server: cloud.XXXXXXX.org, request: "GET /.well-known/nodeinfo HTTP/2.0", host: "cloud.XXXXXXX.org"