Internal Server Error when accessing Security tab (under Admin

Good evening folks!

Although I am not an inexperienced IT administrator and Software Development Engineer, this is my first post within the Nextcloud community forum, and I am also new to nextcloud, having recently migrated from owncloud 10.5.0 to the latest Nextcloud 20.0.4 (using the migration tools available upon a quick google search for such… whilst officially unsupported, they are clearly supported by the nextcloud community and hence I deemed them safe to use.

Despite a rather annoying issue with the oauth 3rd party app, everything else migrated and updated without issue.

However, I am faced with two problems (the first of which is detailed here, and I mention the second only for background information).

[details=“Internal Server Error”]
Upon opening the page [https://oc.thebotfactory.net/settings/user](https://User settings page) and clicking the ** Security ** link under the Administration menu, I get the following - External IP Address redacted:

## 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: 77.*.*.*
* Request ID: hXT8bRPkTY7XiPTH3vPZ

I would like to resolve this issue, as I believe it is related to the first issue, where I am continually seeing the error message `Invalid private key for encryption app. Please update your private key password in your personal settings to recover access to your encrypted files." every time I open a new page within the Nextcloud dashboard.

I do not have the default encryption enabled, nor do I have the other app installed or server side encryption enabled. Having searched this forum, it appears the answer is to enable/install these apps, turn on server side encryption, and then turn them off again. This had gotten rid of the error for folks on this forum.

But, with respect to the above invalid private key, (I tried to install and enable) I am unable to access the settings for these apps, to turn on server-side encryptions, for example, due to the above internal server error.

Nextcloud version (eg, 18.0.2): 20.0.4
Operating system and version (eg, Ubuntu 20.04): Raspbian (Buster), running on Raspbery PI 4

Linux master 5.4.79-v7l+ #1373 SMP Mon Nov 23 13:27:40 GMT 2020 armv7l GNU/Linux```

Apache or nginx version _(eg, Apache 2.4.25)_: nginx version: nginx/1.14.2
 
PHP version _(eg, 7.1)_: 7.3.19-1~deb10u1

The issue you are facing:
[Uploading: internal-error.png...]

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

Steps to replicate it:
1. Upgrade from Owncloud 10.5 to Nextcloud, following the (un)officially supported method at https://return2.net/migrate-owncloud-to-nextcloud/
2. Resolve the oauth problem (due to wrongly named table names and the table trying to be accessed before the migration script that creates the new table is even run
3. Verify that nextcloud is actually working (aside from error above)
3. Attempt to access the security tab

I will post the output of the next two items shortly, as I have to go out right now. (Sorry for the delay!)

As promised, I have finished by posting the final requested information

The output of your Nextcloud log in Admin > Logging:
https://oc.mydomain.net/settings/admin/logging

[files_sharing] Debug: /appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.

GET /apps/logreader/poll?lastReqId=sbnTGiyuP2HZw1xdTUmZ
from 77.*.*.* by noscere at 2021-01-07T19:11:30+00:00

[encryption] Debug: /appinfo/app.php is deprecated, use \OCP\AppFramework\Bootstrap\IBootstrap on the application class instead.

GET /apps/logreader/poll?lastReqId=aDb427z6qOKMB8RgUa4D
from 77.*.*.* by noscere at 2021-01-07T19:14:21+00:00

The above log entries appear every second and are filling my log file rather quickly!

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 => 'oc.mydomain.net',
  ),
  'datadirectory' => '/clusterfs/srv/http/owncloud/data',
  'overwrite.cli.url' => 'https://oc.mydomain.net',
  'dbtype' => 'pgsql',
  'version' => '20.0.4.0',
  'dbname' => 'owncloud10_3_2',
  'dbhost' => *'redacted.com'*,
  'dbtableprefix' => 'oc_',
  'dbuser' => *'redacted'*,
  'dbpassword' => *'redacted'*,
  'logtimezone' => 'UTC',
  'apps_paths' =>
  array (
    0 =>
    array (
      'path' => '/clusterfs/srv/http/owncloud/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 =>
    array (
      'path' => '/clusterfs/srv/http/owncloud/apps-external',
      'url' => '/apps-external',
      'writable' => true,
    ),
  ),
  'installed' => true,
  'mail_domain' => 'gmail.com',
  'mail_from_address' => *'redacted'*,
  'mail_smtpmode' => 'php',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => 6379,
  ),
  'integrity.excluded.files' =>
  array (
    0 => '.DS_Store',
    1 => 'Thumbs.db',
    2 => 'lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Schema/PostgreSqlSchemaM$
    3 => '.user.ini',
  ),
  'maintenance' => false,
  'loglevel' => 0,
  'theme' => '',
  'encryption.legacy_format_support' => true,
  'encryption.key_storage_migrated' => false,
);

The above sensitive information has been redacted (and the SMTP mail has not yet been tested, but the settings do not seem to have imported correctly from owncloud.

The path /clusterfs/srv relates to my raid filesystem, which is configured on boot within fstab, and used for my webcluster of raspberry pi 3 for my numerous websites (the raspberry PI 4 is the controller for this cluster, but Owncloud - and now Nextcloud - is running directly on the controller, as it is appears more resource intensive - or was until I migrated the postgres DB to an AWS instance.

/clusterfs is a symbolic link to /srv on the RPI4 and each RPI3 within the cluster, and using fuse (and ntfs-g3) these are not mounted until the filesystem is available.

For this, I have enabled word wrap and line numbering for the output of my nginx/system log in /var/log/____ - the error.log appears not to have been updated during this access, but the access.log has entries :

Access.log

 127.0.0.1 - - [07/Jan/2021:19:32:24 +0000] "GET / HTTP/1.0" status: 301 178 "-" "mon.d/http.monitor" "-" Rquested: "http" "localhost" "/" "master"
 2 77.*.*.* - - [07/Jan/2021:19:32:26 +0000] "GET /settings/admin/logging HTTP/2.0" status: 200 7197 "https://oc.mydomain.net/settings/user/security" "Mozilla/5.0 (Windows NT 10.0
   ; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/settings/admin/logging" "master"
 3 77.*.*.* - - [07/Jan/2021:19:32:28 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/2.0" status: 200 861 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/ocs/v2.php/apps/notifica
   tions/api/v2/notifications" "master"
 4 77.*.*.* - - [07/Jan/2021:19:32:29 +0000] "PUT /apps/user_status/heartbeat HTTP/2.0" status: 204 0 "https://oc.mydomain.net/settings/admin/logging" "Mozilla/5.0 (Windows NT 10.
   0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/user_status/heartbeat" "master"
 5 77.*.*.* - - [07/Jan/2021:19:32:29 +0000] "GET /apps/logreader/settings HTTP/2.0" status: 200 107 "https://oc.mydomain.net/settings/admin/logging" "Mozilla/5.0 (Windows NT 10.0
   ; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/settings" "master"
 6 77.*.*.* - - [07/Jan/2021:19:32:29 +0000] "GET /ocs/v2.php/search/providers?from=%2Fsettings%2Fadmin%2Flogging HTTP/2.0" status: 200 191 "https://oc.mydomain.net/settings/admin
   /logging" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/ocs/v2.php/s
   earch/providers?from=%2Fsettings%2Fadmin%2Flogging" "master"
 7 77.*.*.* - - [07/Jan/2021:19:32:30 +0000] "GET /ocs/v2.php/apps/user_status/api/v1/user_status HTTP/2.0" status: 200 150 "https://oc.mydomain.net/settings/admin/logging" "Mozil
   la/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/ocs/v2.php/apps/user_status/
   api/v1/user_status" "master"
 8 77.*.*.* - - [07/Jan/2021:19:32:30 +0000] "GET /apps/logreader/get?offset=0&count=50&levels=11111 HTTP/2.0" status: 200 2643 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/get?offse
   t=0&count=50&levels=11111" "master"
 9 77.*.*.* - - [07/Jan/2021:19:32:31 +0000] "GET /apps/encryption/ajax/getStatus HTTP/2.0" status: 200 158 "https://oc.mydomain.net/settings/admin/logging" "Mozilla/5.0 (Windows
   NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/encryption/ajax/getStatus" "master"
10 77.*.*.* - - [07/Jan/2021:19:32:31 +0000] "GET /apps/logreader/poll?lastReqId=Kquxy9VW3RN9F7gGzpmU HTTP/2.0" status: 200 532 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=Kquxy9VW3RN9F7gGzpmU" "master"
11 77.*.*.* - - [07/Jan/2021:19:32:32 +0000] "GET /apps/logreader/poll?lastReqId=uFtedH5RThudU5Rr0PZJ HTTP/2.0" status: 200 453 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=uFtedH5RThudU5Rr0PZJ" "master"
12 77.*.*.* - - [07/Jan/2021:19:32:33 +0000] "GET /apps/logreader/poll?lastReqId=8AEgPVySEKLk9y8zvkNF HTTP/2.0" status: 200 453 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=8AEgPVySEKLk9y8zvkNF" "master"
13 77.*.*.* - - [07/Jan/2021:19:32:34 +0000] "GET /apps/logreader/poll?lastReqId=J46PyZnnekaqrhCmstW6 HTTP/2.0" status: 200 452 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=J46PyZnnekaqrhCmstW6" "master"
14 77.*.*.* - noscere [07/Jan/2021:19:32:35 +0000] "PROPFIND /remote.php/dav/files/noscere/ HTTP/1.1" status: 207 258 "-" "Mozilla/5.0 (Windows) mirall/2.7.4 (build 2934) (ownCloud, wi
   ndows-10.0.19041 ClientArchitecture: i386 OsArchitecture: x86_64)" "-" Rquested: "https" "oc.mydomain.net" "/remote.php/dav/files/noscere/" "master"
15 77.*.*.* - - [07/Jan/2021:19:32:35 +0000] "GET /apps/logreader/poll?lastReqId=qAufG5nsOqkQQGZAx5Wq HTTP/2.0" status: 200 611 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=qAufG5nsOqkQQGZAx5Wq" "master"
16 77.*.*.* - - [07/Jan/2021:19:32:36 +0000] "GET /apps/logreader/poll?lastReqId=UAKzQIaFMS8LgjuMlAwo HTTP/2.0" status: 200 452 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=UAKzQIaFMS8LgjuMlAwo" "master"
17 77.*.*.* - - [07/Jan/2021:19:32:37 +0000] "GET /apps/logreader/poll?lastReqId=A7psQ2WdxQpq58w1orWU HTTP/2.0" status: 200 449 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=A7psQ2WdxQpq58w1orWU" "master"
18 77.*.*.* - - [07/Jan/2021:19:32:38 +0000] "GET /apps/logreader/poll?lastReqId=bemonLF7HosmzmNm1gt5 HTTP/2.0" status: 200 450 "https://oc.mydomain.net/settings/admin/logging" "M ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=bemonLF7HosmzmNm1gt5" "master"
19 77.*.*.* - - [07/Jan/2021:19:32:39 +0000] "GET /apps/logreader/poll?lastReqId=N4MKd1EOCRJlemkecG2l HTTP/2.0" status: 200 451 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=N4MKd1EOCRJlemkecG2l" "master"
20 77.*.*.* - - [07/Jan/2021:19:32:40 +0000] "GET /apps/logreader/poll?lastReqId=mtffHqmTQMpLAx30UUSP HTTP/2.0" status: 200 453 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=mtffHqmTQMpLAx30UUSP" "master"
21 77.*.*.* - - [07/Jan/2021:19:32:42 +0000] "GET /apps/logreader/poll?lastReqId=XNBuX0QD7IHuwpEQdtUR HTTP/2.0" status: 200 454 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=XNBuX0QD7IHuwpEQdtUR" "master"
22 77.*.*.* - - [07/Jan/2021:19:32:42 +0000] "GET /apps/logreader/poll?lastReqId=Dgq7TI2X4bNwN5aeQJRG HTTP/2.0" status: 200 453 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=Dgq7TI2X4bNwN5aeQJRG" "master"
23 77.*.*.* - - [07/Jan/2021:19:32:44 +0000] "GET /apps/logreader/poll?lastReqId=bZS7SPa5ouuIdwj273Jm HTTP/2.0" status: 200 452 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=bZS7SPa5ouuIdwj273Jm" "master"
24 77.*.*.* - - [07/Jan/2021:19:32:45 +0000] "GET /apps/logreader/poll?lastReqId=AvRsVRIj7tA5FA2C7aHz HTTP/2.0" status: 200 453 "https://oc.mydomain.net/settings/admin/logging" "M
   ozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?last
   ReqId=AvRsVRIj7tA5FA2C7aHz" "master"
25 77.*.*.* - - [07/Jan/2021:19:32:45 +0000] "GET /settings/admin/security HTTP/2.0" status: 500 7288 "https://oc.mydomain.net/settings/admin/logging" "Mozilla/5.0 (Windows NT 10.
   0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/settings/admin/security" "master"
26 77.*.*.* - - [07/Jan/2021:19:32:45 +0000] "GET /apps/logreader/poll?lastReqId=9aCncfxDDJJvaKYRzoYV HTTP/2.0" status: 499 0 "https://oc.mydomain.net/settings/admin/logging" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/apps/logreader/poll?lastRe
   qId=9aCncfxDDJJvaKYRzoYV" "master"
27 77.*.*.* - - [07/Jan/2021:19:32:47 +0000] "GET /settings/admin/index.php/apps/bruteforcesettings/ipwhitelist HTTP/2.0" status: 500 3032 "https://oc.mydomain.net/settings/admin/
   security" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/settings/adm
   in/index.php/apps/bruteforcesettings/ipwhitelist" "master"
28 77.*.*.* - - [07/Jan/2021:19:32:48 +0000] "GET /settings/admin/ocs/v2.php/cloud/groups?offset=0&search=&limit=20/ HTTP/2.0" status: 500 3032 "https://oc.mydomain.net/settings/a
   dmin/security" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" "-" Rquested: "https" "oc.mydomain.net" "/setting
   s/admin/ocs/v2.php/cloud/groups?offset=0&search=&limit=20/" "master"

Whether this issue got resolved may i know how to resolve this