Internal server error when accessing files

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 22.2.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Nginx 1.18.0
PHP version (eg, 7.4): 7.4

The issue you are facing:

I have installed in a subdirectory /var/www/html/nextcloud
data are in /var/lib/nextcloud/data
i am able to login and create users
I have nfs mapped the users dirs to their respective …nextcloud/data//files dir
I have run the occ command with the files:scan and it reported back the #dirs and files

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

Steps to replicate it:
When i login as a user i get the dashboard
When i try to click on files i get the error:

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.

I have set loglevel to 3 and the serverlog shows:

More details can be found in the server log.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"tnOaNUxl849ljA8VPPbB","level":3,"time":"November 02, 2021 20:20:30","remoteAddr":"192.168.1.1","user":"superjk","app":"index","method":"GET","url":"/nextcloud/apps/theming/img/core/filetypes/x-office-document.svg?v=0","message":"Could not create path","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0","version":"22.2.0.2","exception":{"Exception":"OCP\\Files\\NotPermittedException","Message":"Could not create path","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/Files/SimpleFS/NewSimpleFile.php","line":133,"function":"newFile","class":"OC\\Files\\Node\\Folder","type":"->"},{"file":"/var/www/html/nextcloud/apps/theming/lib/ImageManager.php","line":191,"function":"putContent","class":"OC\\Files\\SimpleFS\\NewSimpleFile","type":"->"},{"file":"/var/www/html/nextcloud/apps/theming/lib/Controller/IconController.php","line":96,"function":"setCachedImage","class":"OCA\\Theming\\ImageManager","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":217,"function":"getThemedIcon","class":"OCA\\Theming\\Controller\\IconController","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":126,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":156,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":301,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1000,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/lib/private/Files/Node/Folder.php","Line":203,"CustomMessage":"--"}}
{"reqId":"jL37BdcRChym1QgRroT3","level":3,"time":"November 02, 2021 20:20:30","remoteAddr":"192.168.1.1","user":"superjk","app":"PHP","method":"GET","url":"/nextcloud/apps/theming/img/core/filetypes/folder.svg?v=0","message":"chmod(): Operation not permitted at /var/www/html/nextcloud/lib/private/Log/File.php#86","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0","version":"22.2.0.2"}
{"reqId":"tnOaNUxl849ljA8VPPbB","level":3,"time":"November 02, 2021 20:20:30","remoteAddr":"192.168.1.1","user":"superjk","app":"PHP","method":"GET","url":"/nextcloud/apps/theming/img/core/filetypes/x-office-document.svg?v=0","message":"chmod(): Operation not permitted at /var/www/html/nextcloud/lib/private/Log/File.php#86","userAgent":"Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0","version":"22.2.0.2"}
root@www:/var/www/html/nextcloud# 

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

<?php
$CONFIG = array (
  'instanceid' => 'oc0blqo5tphp',
  'passwordsalt' => 'xxxxxxxxxxxxxxxxxxxxxx',
  'secret' => 'xxxxxxxxxxxxxxxxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'serverdns',
    1 => '192.168.1.123',
  ),
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud.log',
  'loglevel' => 4,
  'logdateformat' => 'F d, Y H:i:s',
  'datadirectory' => '/var/lib/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.2.0.2',
  'overwrite.cli.url' => 'serverurl/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => <username>,
  'dbpassword' => 'xxxxxxxxxxxxxxx',
  'installed' => true,
);

The output of your Apache/nginx/system log in /var/log/____:

192.168.1.1 - - [02/Nov/2021:23:02:36 +0100] "GET /wpad.dat HTTP/1.1" 301 162 "-" "WinHttp-Autoproxy-Service/5.1"
192.168.1.1 - - [02/Nov/2021:23:02:36 +0100] "GET /wpad.dat HTTP/1.1" 301 162 "-" "WinHttp-Autoproxy-Service/5.1"
192.168.1.1 - - [02/Nov/2021:23:02:39 +0100] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/2.0" 304 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0"
192.168.1.1 - - [02/Nov/2021:23:02:40 +0100] "GET /nextcloud/remote.php/webdav/ HTTP/1.1" 401 426 "-" "-"
192.168.1.1 - jk [02/Nov/2021:23:03:07 +0100] "GET /nextcloud/remote.php/webdav/ HTTP/1.1" 401 355 "-" "-"
192.168.1.1 - - [02/Nov/2021:23:03:09 +0100] "GET /nextcloud/ocs/v2.php/apps/notifications/api/v2/notifications HTTP/2.0" 304 0 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0"

I tried to enable the app external storage support but it failed with the message:

Error: This app cannot be enabled because it makes the server unstable

So I found the issue at hand, It was an error in the rights for the admin users …/files/Documents directory.
It was created by Nextcloud on installation so why www-data user was not owner to the directory - i do not know