linuxserver / docker-nextcloud

GNU General Public License v3.0
677 stars 128 forks source link

Internal Server Error after upgrading to NC V27 #340

Closed squallxb1983 closed 11 months ago

squallxb1983 commented 11 months ago

Is there an existing issue for this?

Current Behavior

After many attempts, I finally upgraded NC to V27, but now the login page says "Internal Server Error. The server was unable to complete your request."

The container log can be found below. Thank you for the help in advance.

Expected Behavior

No response

Steps To Reproduce

upgrade version of data from V21 to V27.

Environment

- OS:
- How docker service was installed:

CPU architecture

x86-64

Docker creation

version: "2"
services:
  nextcloud:
    image: ghcr.io/linuxserver/nextcloud
    container_name: nextcloud
    environment:
      - PUID=998
      - PGID=100
      - TZ=Europe/Stockholm
    volumes:
      - /srv/dev-disk-by-uuid-9dadb505-8d6a-4aba-8700-e4732a27f010/AppData/nextcloud/config:/config
      - /srv/dev-disk-by-uuid-9dadb505-8d6a-4aba-8700-e4732a27f010/Nextcloud/data:/data
    depends_on:
      - mariadb
    restart: unless-stopped
  mariadb:
    image: ghcr.io/linuxserver/mariadb
    container_name: mariadb
    environment:
      - PUID=998
      - PGID=100
      - MYSQL_ROOT_PASSWORD=mariadbpassword
      - TZ=Europe/Stockholm
    volumes:
      - /srv/dev-disk-by-uuid-9dadb505-8d6a-4aba-8700-e4732a27f010/AppData/mariadb/config:/config
    restart: unless-stopped

Container logs

using keys found in /config/keys
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐
│  old date  │  new date  │ path                                                                   │
├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤
│ 2022-08-20 │ 2023-06-24 │ /config/nginx/ssl.conf                                                 │
└────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘
**** The following site-confs have extensions other than .conf ****
**** This may be due to user customization. ****
**** You should review the files and rename them to use the .conf extension or remove them. ****
**** nginx.conf will only include site-confs with the .conf extension. ****
/config/nginx/site-confs/default
/config/nginx/site-confs/default.conf.bak
[custom-init] No custom files found, skipping...
[ls.io-init] done.
nemchik commented 11 months ago

can you check the nextcloud log at /data/nextcloud.log ?

squallxb1983 commented 11 months ago

can you check the nextcloud log at /data/nextcloud.log ?

I deleted the log before Jun 24th and attached it as below. Thank you once again for the help. nextcloud.log

nemchik commented 11 months ago

Potential fix https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues/830#issuecomment-1591070993

squallxb1983 commented 11 months ago

Potential fix ONLYOFFICE/onlyoffice-nextcloud#830 (comment)

I'm not sure how to fix it. I tried removing onlyoffice and installing onlyoffice V8.1.0, but it seems neither worked for me.

nemchik commented 11 months ago

Can you try removing onlyoffice entirely and not installing another version and see if things run?

It could be a bug with onlyoffice that they need to fix. If things still don't run even when you remove onlyoffice entirely then it could be a bug on our end, or maybe still something else.

Italia38 commented 11 months ago

Same problem here. Last update was 5/27 (v 26.02 I think). Updated today, and I'm getting the same message as @squallxb1983 Running on an Alpine server (x86-64), Nextcloud and Mariadb installed and updated using docker-compose. I don't have the OnlyOffice App installed, so that is not my issue.

nemchik commented 11 months ago

Post your log. Even if it's the same error, there may be context around it.

Italia38 commented 11 months ago

Here's the live log:

The following active confs have different version dates than the samples that are shipped. This may be due to user customization or an update to the samples. You should compare the following files to the samples in the same folder and update them. Use the link at the top of the file to view the changelog. ┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐ │ old date │ new date │ path │ ├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤ │ 2022-08-16 │ 2023-04-13 │ /config/nginx/nginx.conf │ │ 2022-08-20 │ 2023-06-24 │ /config/nginx/ssl.conf │ └────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘ [custom-init] No custom files found, skipping... [ls.io-init] done. Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2006] MySQL server has gone away in /app/www/public/lib/private/DB/Connection.php:140 Stack trace:

0 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(1531): OC\DB\Connection->connect()

1 /app/www/public/3rdparty/doctrine/dbal/src/Connection.php(1029): Doctrine\DBAL\Connection->getWrappedConnection()

2 /app/www/public/lib/private/DB/Connection.php(262): Doctrine\DBAL\Connection->executeQuery()

3 /app/www/public/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(345): OC\DB\Connection->executeQuery()

4 /app/www/public/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()

5 /app/www/public/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()

6 /app/www/public/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()

7 /app/www/public/lib/private/AppConfig.php(374): OC\AppConfig->getApps()

8 /app/www/public/lib/private/legacy/OC_App.php(803): OC\AppConfig->getValues()

9 /app/www/public/lib/private/Server.php(733): OC_App::getAppVersions()

10 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC{closure}()

11 /app/www/public/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()

12 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()

13 /app/www/public/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()

14 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()

15 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(193): OC\AppFramework\Utility\SimpleContainer->get()

16 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()

17 /app/www/public/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()

18 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()

19 /app/www/public/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()

20 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()

21 /app/www/public/lib/private/Server.php(1115): OC\AppFramework\Utility\SimpleContainer->get()

22 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC{closure}()

23 /app/www/public/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()

24 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()

25 /app/www/public/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()

26 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()

27 /app/www/public/lib/private/Server.php(2067): OC\AppFramework\Utility\SimpleContainer->get()

28 /app/www/public/lib/private/Files/View.php(106): OC\Server->getLockingProvider()

29 /app/www/public/lib/private/Server.php(467): OC\Files\View->__construct()

30 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(171): OC\Server->OC{closure}()

31 /app/www/public/3rdparty/pimple/pimple/src/Pimple/Container.php(122): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility{closure}()

32 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(138): Pimple\Container->offsetGet()

33 /app/www/public/lib/private/ServerContainer.php(171): OC\AppFramework\Utility\SimpleContainer->query()

34 /app/www/public/lib/private/AppFramework/Utility/SimpleContainer.php(65): OC\ServerContainer->query()

35 /app/www/public/lib/private/Server.php(1469): OC\AppFramework\Utility\SimpleContainer->get()

36 /app/www/public/lib/base.php(638): OC\Server->boot()

37 /app/www/public/lib/base.php(1180): OC::init()

38 /app/www/public/cron.php(43): require_once('...')

39 {main}

Italia38 commented 11 months ago

It appears to be a Mariadb error. Nextcloud can't connect to the database, per log above. I ran database check on Mariadb mariadb-check -u root -p<PASSWORD> -c -A # check all databases for errors and got this:

mariadb-check: Got error: 2002: Can't connect to local server through socket '/var/run/mysqld/mysqld.sock' (2) when trying to connect

I updated the Mariadb container at the same time as the Nextcloud update, as I've always done, but this time it seems there is an issue. Any pointers on how to fix Mariadb appreciated.

Edit: I followed instructions detailed here https://github.com/linuxserver/docker-mariadb/issues/125 and here https://github.com/linuxserver/cstate/blob/2505217ea6d06b00a1b413d44108c47f0a6cccee/content/issues/2023-05-28-mariadb.md to roll back Mariadb to 10.6.13. Now Nexcloud displays in Maintenance mode, so the problem was Mariadb. However I do still have a different problem to solve with Nextcloud after getting past the error reported above.

Italia38 commented 11 months ago

Fixed the issue on my Nextcloud instance and was able to upgrade to v27. After fixing the Mariadb issue (see above) and pinning to v 10.6.13, Nextcloud appeared in Maintenance mode due to some database errors. The fix was to change the line in the config file to turn maintenance mode off, then was able to log in to Nextcloud via the web interface. In Administration, ran checks and it showed database related errors, there were four outdated tables. Ran docker exec -it nextcloud occ db:add-missing-indices, then updated /nginx/site-confs/default.conf and /nginx/nginx.conf, restarted the container, and all is updated and functioning properly so far.

squallxb1983 commented 11 months ago

I gave up and installed nextcloud AIO instead. Then migrated all the data to AIO, now everything runs smoothly as it should be. The management in AIO is also easier and the new backup function is very useful.

Bidonh commented 7 months ago

For the record, I started having these 2 errors and random crashes of Nextcloud after a forced shutdown of my NAS.

Error | core | Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000] [2002] Connection refused

Error | core | OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

After connecting to docker and checking MariaDB, I randomly got these errors.

mariadb-check: Got error: 2013: Lost connection to server during query when executing 'CHECK TABLE ... '
mariadb-check: Got error: 2002: Can't connect to local server through socket '/var/run/mysqld/mysqld.sock' (111) when trying to connect

Although the tables were declared as OK.

Redownloading the image of the same version of MariaDB but a more recent build and recreating the stack fixed the problem.