Multiple issues after updating to nextcloud 27.1.10

Nextcloud version (eg, 29.0.5): 27.1.10
Operating system and version (eg, Ubuntu 29.04): Ubuntu 22.04 LTS
Apache or nginx version (eg, Apache 2.4.25): Nginx Proxy Manager v2.11.2 (nginx / openresty 1.21.4.3)
PHP version (eg, 8.3): 8.2.20

The issue you are facing:

I have a docker setup with portainer, nextcloud, mariadb, and nginx proxy manager. Everything was working as expected as far as I could tell. I wanted to update nextcloud from version 27.1.0 to 27.1.10.

To do this I simply use the “update the stack” button from portainer on my nextcloud stack.
The update seemed to work fine but now I have a broken Nextcloud instance :

  • the webgui return internal server error, either as an empty page or with a nextcloud background. But if I refresh enough times I manage to get into the web interface. Once in the web interface I face the same issue : sometimes I need multiple refresh to get to the desired page. The sync plugin on my desktop seems to go in and out of service.

In the admin overview I have multiple messages :

  • web server not configured to resolve “/.well-known/caldav”
  • web server not configured to resolve “/.well-known/carddav”
  • web server not configured to resolve “/.well-known/webfinger”
  • missing index in database

I also see multiple errors in the logging panel (see blow in the admin logging section).

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

Steps to replicate it:

  1. Setup a docker compose (see blow) for nextcloud and associated DB using nextcloud 27.1.0
  2. Setup Nginx proxy manager docker
  3. Confirm the system ran successfully
  4. Redeploy the stack with nextcloud 27.1.10
  5. Nextcloud broken

My docker compose for Nextcloud :

version: '2'

services:
  db:
    image: mariadb:10.6
    restart: always
    command: --transaction-isolation=READ-COMMITTED --log-bin=binlog --binlog-format=ROW
    volumes:
      - /home/olivier/nextcloud/mariadb/mysql:/var/lib/mysql
    environment:
      - MYSQL_ROOT_PASSWORD=ROOT_PWD
      - MYSQL_PASSWORD=DB_PWD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud


  app:
    image: nextcloud:27.1.10
    restart: always
    links:
      - db
    volumes:
     - /home/myuser/nextcloud/custom_apps:/var/www/html/custom_apps
     - /home/myuser/nextcloud/config:/var/www/html/config
     - /home/myuser/nextcloud/html:/var/www/html
     - /home/myuser//nextcloud/data:/var/www/html/data
    ports:
      - "8080:80"

    environment:
      - MYSQL_PASSWORD=DB_PWD
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - MYSQL_HOST=db
      - NEXTCLOUD_ADMIN_USER=ADMIN
      - NEXTCLOUD_ADMIN_PASSWORD=ADMIN_PWD
      - NEXTCLOUD_TRUSTED_DOMAINS=nextcloud.domain.org

networks:
  default:
    external: true
    name: common-network

The output of your Nextcloud log in Admin > Logging:

OCP\AppFramework\QueryException: Could not resolve OCA\Files_Versions\Versions\IVersionManager! Class can not be instantiated
OC\AppFramework\Utility\QueryNotFoundException: Could not resolve trashManager! Class "trashManager" does not exist
OC\AppFramework\Utility\QueryNotFoundException: Could not resolve externalMountProvider! Class "externalMountProvider" does not exist
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user 'nextcloud'@'172.18.0.6' (using password: YES)

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,
    ),
  ),
  'passwordsalt' => SALT',
  'secret' => 'SECRET',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.domain.org',
  ),
  'datadirectory' => '/var/www/html/data',
  'dbtype' => 'mysql',
  'version' => '27.1.10.2',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'db',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => DBPASSWORD,
  'instanceid' => 'oc08n5xvvlz0',
  'installed' => true,
  'overwriteprotocol' => 'https',
  'loglevel' => 2,
  'maintenance' => false,
);

There seem to be multiple issues at the same time and I am not sure what is independent or related so I try different fixes for different stuff.

Troubleshooting steps :

  1. I tried to fix the missing indices in the DB with : docker exec -it nextcloud_app_docker_id /var/www/html/occ db:add-missing-indices -u 33
    Returned : An unhandled exception has been thrown:
    Doctrine\DBAL\Exception: Failed to connect to the database:
    An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user ‘nextcloud’@‘172.18.0.6’ (using password: YES) in /var/www/html/lib/private/DB/Connection.php:140

  2. By going inside the nextcloud db container, I could log and access the nextcloud DB as user nextcloud with the password set in the docker-compose

mariadb -u nextcloud -p
Enter password: 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 924
Server version: 10.6.18-MariaDB-ubu2004-log mariadb.org binary distribution

MariaDB [(none)]> USE nextcloud;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
MariaDB [nextcloud]> SHOW tables;
  1. I tried to solve the web server messages by adding the following to my Nginx config :
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Accept-Encoding "";
proxy_set_header Host $host;
client_body_buffer_size 512k;
proxy_read_timeout 86400s;
client_max_body_size 0;
location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; }
location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav;  }
location ~ ^/(?:index|remote|public|cron|core/ajax/update|status|ocs/v[12]|updater/.+|oc[ms]-provider/.+|core/templates/40[34])\.php(?:$|/) {
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
try_files $fastcgi_script_name =404;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
#Avoid sending the security headers twice
fastcgi_param modHeadersAvailable true;
fastcgi_param front_controller_active true;
fastcgi_pass unix:/run/php/php8.1-fpm.sock;
fastcgi_intercept_errors on;
fastcgi_request_buffering off;
}
location ~ ^/(?:updater|oc[ms]-provider)(?:$|/) {
try_files $uri/ =404;
index index.php;
}

But it did not seem to help.

One thing that I am a bit puzzled by is that I saw the npm (nginx user) trying to access the nextcloud DB and the nextcloud user trying to access the npm DB (getting denied in both cases). I am not sure if that happened before, but the DB or Nginx have not changed so I fail to see the reason it would now be a problem.

I hope someone has a solution for me or at least directions to find the root cause of the issue.

Thank you for your time and your help

One thing that I am a bit puzzled by is that I saw the npm (nginx user) trying to access the nextcloud DB and the nextcloud user trying to access the npm DB (getting denied in both cases). I am not sure if that happened before, but the DB or Nginx have not changed so I fail to see the reason it would now be a problem.

Where is your NPM container’s Compose entry? Are you managing it as an independent stack? Does it’s dedicated db container happen to be called db?

P.S. I would ignore the admin settings warnings about .well-known URls and missing indexes until you have the bigger problem addressed. Neither those warnings are related to your current problem. Trying to fix them at the same time will complicate your life. :slight_smile:

1 Like

Yes, the Nginx proxy is managed as a separate stack (seemed logical to me as it also manage other applications). Here it is :

version: '3'
services:
  app:
    image: 'jc21/nginx-proxy-manager:latest'
    restart: unless-stopped
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    environment:
      DB_MYSQL_HOST: "db"
      DB_MYSQL_PORT: 3306
      DB_MYSQL_USER: USER
      DB_MYSQL_PASSWORD: PWD
      DB_MYSQL_NAME: "npm"
    volumes:
      - /home/myuser/nginx/data:/data
      - /home/myuser/nginx/letsencrypt:/etc/letsencrypt
  db:
    image: 'jc21/mariadb-aria:latest'
    restart: unless-stopped
    environment:
      MYSQL_ROOT_PASSWORD: ROOT_PWD
      MYSQL_DATABASE: 'npm'
      MYSQL_USER: USER
      MYSQL_PASSWORD: PWD
    volumes:
      - /home/myuser/nginx/data/mysql:/var/lib/mysql
      
      
networks:
    default:
      external: true
      name: common-network

I have 0 knowledge of databases, but my limited understanding is that I have 2 mariadb hosts,both named db, running in 2 different containers. The database inside them has a different name (npm and nextcloud) though. However they are on the same network so maybe that is part of the issue.

I tried to update the docker compose from npm and change the db name to something else. It looks like is solves the server error from nextcloud ! Thanks for hint.

Now I still have 2 issues with /.well-known/caldav and ./well-known/carddav .
Adding the following in the advanced setting for NPM seems to fix it :

location = /.well-known/carddav { return 301 $scheme://$host/remote.php/dav; }
location = /.well-known/caldav { return 301 $scheme://$host/remote.php/dav;  }

With that nextcloud seem functional again, thank you. I am still confused why these problems did not appear earlier.

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.