Another... Internal Server Error

Hi,

I am experincing trouble with my self-hosted Docker Nextcloud.
All was running well until I decide (for no reason…) to run a :

docker-compose down && docker-compose up -d

Now, I have this message while trying to access my Nextcloud :

Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Nextcloud version: 21.0.1 (latest)
Operating system and version: Debian 10
Apache or nginx version: Apache (Docker image)
PHP version: 7.4 (Docker image)

I can give you some logs if you tell me which one you want (and to get it).

The following command:

docker exec --user www-data nextcloud php occ maintenance:repair

Returns:

An unhandled exception has been thrown:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nextcloud.oc_appconfig' doesn't exist in /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php:82
Stack trace:
#0 /var/www/html/3rdparty/doctrine/dbal/src/Driver/PDO/Connection.php(82): PDO->query('SELECT * FROM `...')
#1 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1035): Doctrine\DBAL\Driver\PDO\Connection->query('SELECT * FROM `...')
#2 /var/www/html/lib/private/DB/Connection.php(226): Doctrine\DBAL\Connection->executeQuery('SELECT * FROM `...', Array, Array, NULL)
#3 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(210): OC\DB\Connection->executeQuery('SELECT * FROM `...', Array, Array)
#4 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /var/www/html/lib/private/AppConfig.php(345): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /var/www/html/lib/private/AppConfig.php(110): OC\AppConfig->loadConfigValues()
#7 /var/www/html/lib/private/AppConfig.php(301): OC\AppConfig->getApps()
#8 /var/www/html/lib/private/legacy/OC_App.php(957): OC\AppConfig->getValues(false, 'installed_versi...')
#9 /var/www/html/lib/private/Server.php(682): OC_App::getAppVersions()
#10 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
#11 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#12 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OC\\Memcache\\Fac...')
#13 /var/www/html/lib/private/ServerContainer.php(137): OC\AppFramework\Utility\SimpleContainer->query('OC\\Memcache\\Fac...', false)
#14 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query('OC\\Memcache\\Fac...')
#15 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(177): OC\AppFramework\Utility\SimpleContainer->get('OC\\Memcache\\Fac...')
#16 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(OC\Server))
#17 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#18 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OCP\\ICacheFacto...')
#19 /var/www/html/lib/private/ServerContainer.php(137): OC\AppFramework\Utility\SimpleContainer->query('OCP\\ICacheFacto...', false)
#20 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query('OCP\\ICacheFacto...')
#21 /var/www/html/lib/private/Server.php(1031): OC\AppFramework\Utility\SimpleContainer->get('OCP\\ICacheFacto...')
#22 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
#23 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#24 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OCP\\Lock\\ILocki...')
#25 /var/www/html/lib/private/ServerContainer.php(137): OC\AppFramework\Utility\SimpleContainer->query('OCP\\Lock\\ILocki...', false)
#26 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query('OCP\\Lock\\ILocki...')
#27 /var/www/html/lib/private/Server.php(1990): OC\AppFramework\Utility\SimpleContainer->get('OCP\\Lock\\ILocki...')
#28 /var/www/html/lib/private/Files/View.php(119): OC\Server->getLockingProvider()
#29 /var/www/html/lib/private/Server.php(430): OC\Files\View->__construct()
#30 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}(Object(OC\Server))
#31 /var/www/html/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}(Object(Pimple\Container))
#32 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet('OC\\Files\\Node\\H...')
#33 /var/www/html/lib/private/ServerContainer.php(137): OC\AppFramework\Utility\SimpleContainer->query('OC\\Files\\Node\\H...', false)
#34 /var/www/html/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query('OC\\Files\\Node\\H...')
#35 /var/www/html/lib/private/Server.php(1353): OC\AppFramework\Utility\SimpleContainer->get('OC\\Files\\Node\\H...')
#36 /var/www/html/lib/base.php(588): OC\Server->boot()
#37 /var/www/html/lib/base.php(1076): OC::init()
#38 /var/www/html/console.php(49): require_once('/var/www/html/l...')
#39 /var/www/html/occ(11): require_once('/var/www/html/c...')
#40 {main}

My docker-compose.yml file is like:

version: "3.6"

[...]

services:
  mariadb:
    image: library/mariadb:10
    container_name: mariadb
    restart: always
    command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
    volumes:
      - ./mariadb:/var/lib/mariadb
    secrets:
      - mysql_root_password
      - mysql_password
    environment:
      - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mysql_root_password
      - MYSQL_PASSWORD_FILE=/run/secrets/mysql_password
      - MYSQL_DATABASE=nextcloud
      - MYSQL_USER=nextcloud
      - TZ=Europe/Paris
    logging:
      options:
        max-size: "12m"
        max-file: "5"
      driver: json-file

  nextcloud:
    image: library/nextcloud:21
    container_name: nextcloud
    restart: always
    depends_on:
      - mariadb
    volumes:
      - ./nextcloud/config:/var/www/html/config
      - ./nextcloud/cloud:/var/www/html
      - ./nextcloud/apps:/var/www/html/apps
      - ./nextcloud/data:/var/www/html/data
    environment:
      - NEXTCLOUD_DATA_DIR=/var/www/html/data
      - NEXTCLOUD_TRUSTED_DOMAINS=ncloud.${DOMAIN}
      - NEXTCLOUD_TRUSTED_PROXIES=traefik
      - TZ=Europe/Paris
    labels:
      - "traefik.enable=true"

      # Entrypoint et TLS
      - "traefik.http.routers.ncloud.rule=Host(`ncloud.${DOMAIN}`)"
      - "traefik.http.routers.ncloud.entrypoints=websecure"
      - "traefik.http.routers.ncloud.tls=true"
      - "traefik.http.routers.ncloud.tls.certresolver=gandi"

      # Middlewares
      - "traefik.http.routers.ncloud.middlewares=ncloud@docker,ncloud-dav@docker"

      # Headers
      - "traefik.http.middlewares.ncloud.headers.customFrameOptionsValue=SAMEORIGIN"
      - "traefik.http.middlewares.ncloud.headers.frameDeny=true"
      - "traefik.http.middlewares.ncloud.headers.sslRedirect=true"
      - "traefik.http.middlewares.ncloud.headers.sslForceHost=true"
      - "traefik.http.middlewares.ncloud.headers.stsSeconds=31536000"
      - "traefik.http.middlewares.ncloud.headers.stsIncludeSubdomains=true"
      - "traefik.http.middlewares.ncloud.headers.stsPreload=true"
      - "traefik.http.middlewares.ncloud.headers.forceSTSHeader=true"
      - "traefik.http.middlewares.ncloud.headers.customRequestHeaders.X-Forwarded-Proto=https"

      # Middleware cloud-dav replaces .well-known paths for caldav and carddav with proper nextcloud path
      - "traefik.http.middlewares.ncloud-dav.replacepathregex.regex=^/.well-known/ca(l|rd)dav"
      - "traefik.http.middlewares.ncloud-dav.replacepathregex.replacement=/remote.php/dav/"
    logging:
      options:
        max-size: "12m"
        max-file: "5"
      driver: json-file

Could you please, help me to find out what is going wrong ?

Maybe the database is no longer “linked” to the nextcloud container? I don’t know how to verify that…

Thanks for your help!

Does anybody have an idea on what’s going wrong?

Hi @kaots, I found this: Error: Table 'nextcloud.oc_appconfig' doesn't exist - #2 by diplodata
Check if all the files of nextcloud folder have correct permissions like config.php

Thank you for you halp, @Mageunic !

According to the linked thread, I updated the user:group permissions.

The error is the same except that… it’s written in French (my language) and I have the blue wallpaper in the background. I had previously a simple black text on a white page.

So it’s better, but not solved, unfortunately :slightly_frowning_face:

@kaots can you check your log and send the errors?

docker exec --user www-data nextcloud php occ maintenance:repair

Cannot write into “config” directory!
This can usually be fixed by giving the webserver write access to the config directory

Or, if you prefer to keep config.php file read only, set the option “config_is_read_only” to true in it.
See https://docs.nextcloud.com/server/21/go.php?to=admin-config

Nothing changed after adding config_is_read_only => true to the config.php file.

@kaots can you show the permissions to your config.php file?

ls -l config.php

-rw-r–r-- 1 hp hp 1680 mai 8 07:37 config.php

I am logged in as “hp” user.

Tried to chown with www-data:www-data but nothing happened…

@kaots , try this on your nextcloud folder :
sudo chown -R www-data:www-data /.....
sudo chmod -R 750 /....

No effect: I still get the first message written in black on a white page. :frowning_face:

@kaots which docker do you use?

I am using Docker version 20.10.6 from the official Debian Buster repository (package docker-ce).

Maybe the issue comes from the MariaDB volume instead of the Nextcloud config ?

My others services runs flawlessly…

@kaots maybe but you have a slight change in your web page after editing the permissions…