Internal Server Error after 20.0.8 -> 21.0.1 upgrade

Nextcloud version (eg, 20.0.5): 20.0.8 → 21.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): 2.4.41
PHP version (eg, 7.4): 7.4.3

The issue you are facing:

I tried to upgrade from 20.0.8 to 20.0.9 via the web-based updater, like I usually do. However, it then decided to offer 21.0.1 instead. I figured this was okay, and proceeded. It appeared to work at first, but then it gave me this message after upgrade:

Internal Server Error

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log.

Technical details

  • Remote Address: 76.178.132.10
  • Request ID: YHhdU0CS64Nko@pJcjxuSAAAAAc

Help appreciated, I’m tearing my hair out. This Nextcloud instance is needed for a project with a deadline! Normally I can debug this stuff solo, but I’m stumped this time.

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

Steps to replicate it:

  1. Upgrade.

The output of your Nextcloud log in Admin > Logging:
(Cannot access, grabbed from tail -20 data/nextcloud.log and reformatted in VS Code. I had to trim most of it:

{
    "reqId": "YHhYi9lMUajw4EiINk4DjAAAAAM",
    "level": 3,
    "time": "2021-04-15T15:15:23+00:00",
    "remoteAddr": "76.178.132.10",
    "user": "--",
    "app": "no app in context",
    "method": "GET",
    "url": "/index.php/js/core/merged-template-prepend.js?v=fb029bce-9",
    "message": {
        "Exception": "OCP\\AppFramework\\QueryException",
        "Message": "Could not resolve trashManager! Class trashManager does not exist",
        "Code": 0,
        "Trace": [
            {
                "file": "/opt/ibp/lib/private/AppFramework/Utility/SimpleContainer.php",
                "line": 126,
                "function": "resolve",
                "class": "OC\\AppFramework\\Utility\\SimpleContainer",
                "type": "->",
                "args": [
                    "trashManager"
                ]
            },
            // snip...
            {
                "file": "/opt/ibp/index.php",
                "line": 77,
                "function": "printExceptionErrorPage",
                "class": "OC_Template",
                "type": "::",
                "args": [
                    {
                        "__class__": "Error"
                    },
                    500
                ]
            }
        ],
        "File": "/opt/ibp/lib/private/AppFramework/Utility/SimpleContainer.php",
        "Line": 115,
        "CustomMessage": "Could not boot files_trashbinCould not resolve trashManager! Class trashManager does not exist"
    },
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",
    "version": "21.0.1.1"
}
{
    "reqId": "YHhYi9lMUajw4EiINk4DjAAAAAM",
    "level": 3,
    "time": "2021-04-15T15:15:23+00:00",
    "remoteAddr": "76.178.132.10",
    "user": "--",
    "app": "no app in context",
    "method": "GET",
    "url": "/index.php/js/core/merged-template-prepend.js?v=fb029bce-9",
    "message": {
        "Exception": "OCP\\AppFramework\\QueryException",
        "Message": "Could not resolve OCA\\Files_Versions\\Versions\\IVersionManager! Class can not be instantiated",
        "Code": 0,
        "Trace": [
            {
                "file": "/opt/ibp/lib/private/AppFramework/Utility/SimpleContainer.php",
                "line": 126,
                "function": "resolve",
                "class": "OC\\AppFramework\\Utility\\SimpleContainer",
                "type": "->",
                "args": [
                    "OCA\\Files_Versions\\Versions\\IVersionManager"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/DependencyInjection/DIContainer.php",
                "line": 459,
                "function": "query",
                "class": "OC\\AppFramework\\Utility\\SimpleContainer",
                "type": "->",
                "args": [
                    "OCA\\Files_Versions\\Versions\\IVersionManager"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/DependencyInjection/DIContainer.php",
                "line": 431,
                "function": "queryNoFallback",
                "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
                "type": "->",
                "args": [
                    "OCA\\Files_Versions\\Versions\\IVersionManager"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/Utility/SimpleContainer.php",
                "line": 56,
                "function": "query",
                "class": "OC\\AppFramework\\DependencyInjection\\DIContainer",
                "type": "->",
                "args": [
                    "OCA\\Files_Versions\\Versions\\IVersionManager"
                ]
            },
            {
                "file": "/opt/ibp/apps/files_versions/lib/AppInfo/Application.php",
                "line": 121,
                "function": "get",
                "class": "OC\\AppFramework\\Utility\\SimpleContainer",
                "type": "->",
                "args": [
                    "OCA\\Files_Versions\\Versions\\IVersionManager"
                ]
            },
            {
                "file": "/opt/ibp/apps/files_versions/lib/AppInfo/Application.php",
                "line": 108,
                "function": "loadBackend",
                "class": "OCA\\Files_Versions\\AppInfo\\Application",
                "type": "->",
                "args": [
                    {
                        "@attributes": {
                            "for": "OCP\\Files\\Storage\\IStorage"
                        },
                        "@value": "OCA\\Files_Versions\\Versions\\LegacyVersionsBackend"
                    },
                    {
                        "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
                    },
                    {
                        "__class__": "OC\\AppFramework\\Logger"
                    }
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/Bootstrap/FunctionInjector.php",
                "line": 68,
                "function": "registerVersionBackends",
                "class": "OCA\\Files_Versions\\AppInfo\\Application",
                "type": "->",
                "args": [
                    {
                        "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
                    },
                    {
                        "__class__": "OC\\App\\AppManager"
                    },
                    {
                        "__class__": "OC\\AppFramework\\Logger"
                    }
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/Bootstrap/BootContext.php",
                "line": 52,
                "function": "injectFn",
                "class": "OC\\AppFramework\\Bootstrap\\FunctionInjector",
                "type": "->",
                "args": [
                    {
                        "__class__": "Closure"
                    }
                ]
            },
            {
                "file": "/opt/ibp/apps/files_versions/lib/AppInfo/Application.php",
                "line": 93,
                "function": "injectFn",
                "class": "OC\\AppFramework\\Bootstrap\\BootContext",
                "type": "->",
                "args": [
                    {
                        "__class__": "Closure"
                    }
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/Bootstrap/Coordinator.php",
                "line": 176,
                "function": "boot",
                "class": "OCA\\Files_Versions\\AppInfo\\Application",
                "type": "->",
                "args": [
                    {
                        "__class__": "OC\\AppFramework\\Bootstrap\\BootContext"
                    }
                ]
            },
            {
                "file": "/opt/ibp/lib/private/legacy/OC_App.php",
                "line": 197,
                "function": "bootApp",
                "class": "OC\\AppFramework\\Bootstrap\\Coordinator",
                "type": "->",
                "args": [
                    "files_versions"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/legacy/OC_App.php",
                "line": 137,
                "function": "loadApp",
                "class": "OC_App",
                "type": "::",
                "args": [
                    "files_versions"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/legacy/OC_Util.php",
                "line": 203,
                "function": "loadApps",
                "class": "OC_App",
                "type": "::",
                "args": [
                    [
                        "filesystem"
                    ]
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Files/Filesystem.php",
                "line": 267,
                "function": "setupFS",
                "class": "OC_Util",
                "type": "::",
                "args": [
                    ""
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Server.php",
                "line": 408,
                "function": "getMountManager",
                "class": "OC\\Files\\Filesystem",
                "type": "::",
                "args": [
                    null
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/Utility/SimpleContainer.php",
                "line": 155,
                "function": "OC\\{closure}",
                "class": "OC\\Server",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/opt/ibp/3rdparty/pimple/pimple/src/Pimple/Container.php",
                "line": 118,
                "function": "OC\\AppFramework\\Utility\\{closure}",
                "class": "OC\\AppFramework\\Utility\\SimpleContainer",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/Utility/SimpleContainer.php",
                "line": 122,
                "function": "offsetGet",
                "class": "Pimple\\Container",
                "type": "->",
                "args": [
                    "RootFolder"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/ServerContainer.php",
                "line": 137,
                "function": "query",
                "class": "OC\\AppFramework\\Utility\\SimpleContainer",
                "type": "->",
                "args": [
                    "RootFolder",
                    false
                ]
            },
            {
                "file": "/opt/ibp/lib/private/AppFramework/Utility/SimpleContainer.php",
                "line": 56,
                "function": "query",
                "class": "OC\\ServerContainer",
                "type": "->",
                "args": [
                    "RootFolder"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Server.php",
                "line": 441,
                "function": "get",
                "class": "OC\\AppFramework\\Utility\\SimpleContainer",
                "type": "->",
                "args": [
                    "RootFolder"
                ]
            },
            {
                "function": "OC\\{closure}",
                "class": "OC\\Server",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Files/Node/LazyFolder.php",
                "line": 63,
                "function": "call_user_func",
                "args": [
                    {
                        "__class__": "Closure"
                    }
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Files/Node/LazyFolder.php",
                "line": 143,
                "function": "__call",
                "class": "OC\\Files\\Node\\LazyFolder",
                "type": "->",
                "args": [
                    "get",
                    [
                        "appdata_oc9pd2i3xxs1/js/core"
                    ]
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Files/AppData/AppData.php",
                "line": 142,
                "function": "get",
                "class": "OC\\Files\\Node\\LazyFolder",
                "type": "->",
                "args": [
                    "appdata_oc9pd2i3xxs1/js/core"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Template/JSCombiner.php",
                "line": 97,
                "function": "getFolder",
                "class": "OC\\Files\\AppData\\AppData",
                "type": "->",
                "args": [
                    "core"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Template/JSResourceLocator.php",
                "line": 116,
                "function": "process",
                "class": "OC\\Template\\JSCombiner",
                "type": "->",
                "args": [
                    "/opt/ibp",
                    "core/js/merged-template-prepend.json",
                    "core"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Template/JSResourceLocator.php",
                "line": 72,
                "function": "cacheAndAppendCombineJsonIfExist",
                "class": "OC\\Template\\JSResourceLocator",
                "type": "->",
                "args": [
                    "/opt/ibp",
                    "core/js/merged-template-prepend.json"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Template/ResourceLocator.php",
                "line": 79,
                "function": "doFind",
                "class": "OC\\Template\\JSResourceLocator",
                "type": "->",
                "args": [
                    "js/merged-template-prepend"
                ]
            },
            {
                "file": "/opt/ibp/lib/private/TemplateLayout.php",
                "line": 365,
                "function": "find",
                "class": "OC\\Template\\ResourceLocator",
                "type": "->",
                "args": [
                    [
                        "core/js/dist/main",
                        "js/dist/files_fileinfo",
                        "js/dist/files_client",
                        "js/merged-template-prepend",
                        "core/l10n/en"
                    ]
                ]
            },
            {
                "file": "/opt/ibp/lib/private/TemplateLayout.php",
                "line": 193,
                "function": "findJavascriptFiles",
                "class": "OC\\TemplateLayout",
                "type": "::",
                "args": [
                    [
                        "core/js/dist/main",
                        "js/dist/files_fileinfo",
                        "js/dist/files_client",
                        "js/merged-template-prepend",
                        "core/l10n/en"
                    ]
                ]
            },
            {
                "file": "/opt/ibp/lib/private/legacy/OC_Template.php",
                "line": 183,
                "function": "__construct",
                "class": "OC\\TemplateLayout",
                "type": "->",
                "args": [
                    "error",
                    ""
                ]
            },
            {
                "file": "/opt/ibp/lib/private/Template/Base.php",
                "line": 132,
                "function": "fetchPage",
                "class": "OC_Template",
                "type": "->",
                "args": []
            },
            {
                "file": "/opt/ibp/lib/private/legacy/OC_Template.php",
                "line": 332,
                "function": "printPage",
                "class": "OC\\Template\\Base",
                "type": "->",
                "args": []
            },
            {
                "file": "/opt/ibp/index.php",
                "line": 77,
                "function": "printExceptionErrorPage",
                "class": "OC_Template",
                "type": "::",
                "args": [
                    {
                        "__class__": "Error"
                    },
                    500
                ]
            }
        ],
        "File": "/opt/ibp/lib/private/AppFramework/Utility/SimpleContainer.php",
        "Line": 111,
        "CustomMessage": "Could not boot files_versionsCould not resolve OCA\\Files_Versions\\Versions\\IVersionManager! Class can not be instantiated"
    },
    "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36",
    "version": "21.0.1.1"
}
{
    "reqId": "YHhYnlvzHCHEw21lsTFdegAAAAA",
    "level": 4,
    "time": "2021-04-15T15:15:42+00:00",
    "remoteAddr": "76.178.132.10",
    "user": "--",
    "app": "webdav",
    "method": "PROPFIND",
    "url": "/remote.php/dav/files/jasonmc92/",
    "message": {
        "Exception": "Sabre\\DAV\\Exception\\ServiceUnavailable",
        "Message": "Error: Class 'OCA\\Deck\\AppInfo\\Application20' not found",
        "Code": 0,
        "Trace": [
            {
                "file": "/opt/ibp/3rdparty/sabre/event/lib/WildcardEmitterTrait.php",
                "line": 89,
                "function": "{closure}",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/opt/ibp/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 456,
                "function": "emit",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": [
                    "beforeMethod:PROPFIND",
                    [
                        "*** sensitive parameter replaced ***",
                        "*** sensitive parameter replaced ***"
                    ]
                ]
            },
            {
                "file": "/opt/ibp/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 253,
                "function": "invokeMethod",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": [
                    "*** sensitive parameter replaced ***",
                    "*** sensitive parameter replaced ***"
                ]
            },
            {
                "file": "/opt/ibp/3rdparty/sabre/dav/lib/DAV/Server.php",
                "line": 321,
                "function": "start",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": []
            },
            {
                "file": "/opt/ibp/remote.php",
                "line": 76,
                "function": "exec",
                "class": "Sabre\\DAV\\Server",
                "type": "->",
                "args": []
            },
            {
                "file": "/opt/ibp/remote.php",
                "line": 171,
                "function": "handleException",
                "args": [
                    {
                        "__class__": "Error"
                    }
                ]
            }
        ],
        "File": "/opt/ibp/remote.php",
        "Line": 74,
        "CustomMessage": "--"
    },
    "userAgent": "Mozilla/5.0 (Linux) mirall/2.6.2-1build1 (Nextcloud)",
    "version": "21.0.1.1"
}
{
    "reqId": "YHhYoFgZWd@JaRJc4vbx7gAAAAI",
    "level": 3,
    "time": "2021-04-15T15:15:44+00:00",
    "remoteAddr": "76.178.132.10",
    "user": "--",
    "app": "PHP",
    "method": "GET",
    "url": "/ocs/v2.php/apps/notifications/api/v2/notifications?format=json",
    "message": "Error: Class 'OCA\\Deck\\AppInfo\\Application20' not found at /opt/ibp/apps/deck/lib/AppInfo/Application.php#28",
    "userAgent": "Mozilla/5.0 (Linux) mirall/2.6.2-1build1 (Nextcloud)",
    "version": "21.0.1.1"
}

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

<?php
$CONFIG = array (
  'instanceid' => 'REDACTED',
  'passwordsalt' => 'REDACTED',
  'secret' => 'REDACTED',
  'trusted_domains' => 
  array (
    0 => 'REDACTED',
  ),
  'datadirectory' => 'REDACTED',
  'dbtype' => 'mysql',
  'version' => '21.0.1.1',
  'overwrite.cli.url' => 'REDACTED',
  'dbname' => 'REDACTED',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'REDACTED',
  'dbpassword' => 'REDACTED',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'loglevel' => 2,
  'theme' => '',
  'updater.secret' => 'REDACTED',
);

The output of Apache log in /var/log/apache2/access.log (from this request only):

76.178.132.10 - - [15/Apr/2021:08:50:38 -0700] "GET /core/img/favicon.ico HTTP/1.1" 200 4357 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.114 Safari/537.36"

Nothing in /var/log/apache2/error.log

Good afternoon @CodeMouse92 how are you?

Hope you are doing well…

So, one thing that nextcloud recommends doing before an upgrade is to disabling every third-party apps that you have enabled.

Did you do that? If you think that was what probably caused the error, we can start to fix things up.

Meanwhile, what you can do:

1) sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on
2) chown -R www-data:www-data /var/www/nextcloud/
3) chmod -R 770 /var/www/nextcloud/
4) sudo -u www-data php /var/www/nextcloud/occ maintenance:repair
5) sudo -u www-data php /var/www/nextcloud/occ db:add-missing-columns
6) sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
7) sudo -u www-data php /var/www/nextcloud/occ maintenance:update:htaccess
8) sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off
9) sudo systemctl restart apache2

Make sure you have php-fpm installed and running.

Also, make sure you update php/redis/apache as well.

Hope this can help you.

Have a nice weekend mate, regards.

:smiley:

Resolved via the last post here: Internal Server error No error code - #5 by Immuc

I ran the following from within my Nextcloud directory:

sudo apt install php7.4-fpm

sudo -u www-data php occ maintenance:mode --on
chown -R www-data:www-data /opt/ibp
chmod -R 770 /opt/ibp
sudo -u www-data php occ maintenance:repair
sudo -u www-data php occ db:add-missing-columns
sudo -u www-data php occ db:add-missing-indices
sudo -u www-data php occ maintenance:update:htaccess
sudo -u www-data php occ maintenance:mode --off

sudo systemctl restart apache2

I had not had php7.4-fpm installed (my PHP version is php7.4), as that was not required for Nextcloud 20 and before. That should have been checked by the upgrader or admin screen, the same as how there was a warning about MySQL 5 not being supported.

1 Like

Nice man! That’s some good news!

I’m happy for you, congratulations!

Have a nice weekend fella!

:smiley: