Nextcloud web interface didn't load after upgrade to Nextcloud 12

Nextcloud version 12.0.0.29:
Operating system and version Raspbian GNU/Linux 8.0 (jessie):
Apache or nginx version nginx 1.10.2-2:
PHP version 7.0.14-2:
Is this the first time you’ve seen this error?: yes

Can you reliably replicate it? (If so, please outline steps): I haven’t tried

The issue you are facing:
My backup server used to run Nextcloud 11 and a few days ago I tried to upgrade it to Nextcloud 12 and now the web interface shows the following 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.
More details can be found in the server log.

/var/log/nextcloud.log doesn’t show anything when this error occurs, so I decided to dig into the PHP code myself a bit. Editing index.php, I added some logging code around https://github.com/nextcloud/server/blob/08702cbabaa4169b9fd368bc4b003c1ee0d73a40/index.php#L59 which revealed that the error is coming from https://github.com/nextcloud/server/blob/08702cbabaa4169b9fd368bc4b003c1ee0d73a40/lib/private/Files/Node/Node.php#L97. Adding a die($this->path) before that line reveals that the path name that isn’t found is “/appdata_ocsy9nheifei/js”. My data directory is /data, and under it I have:

$ ls -al /data/appdata_ocsy9nheifei
total 24
drwxr-xr-x 6 www-data www-data 4096 Jun 11 19:48 .
drwxrwx— 9 pi www-data 4096 Dec 14 04:27 …
drwxr-xr-x 2 www-data www-data 4096 Dec 14 04:27 appstore
drwxr-xr-x 4 www-data www-data 4096 Dec 14 04:45 avatar
drwxr-xr-x 2 www-data www-data 4096 Dec 14 04:27 preview
drwxr-xr-x 3 www-data www-data 4096 Jun 11 19:48 theming

Indeed no js directory under there. I tried creating that directory manually and now I get this exception:

[error] Exception: OCP\Files\NotPermittedException
Message: No create permission for folder
Code:0
Trace:
#0 /home/pi/nextcloud/lib/private/Files/AppData/AppData.php(112): OC\Files\Node\Folder->newFolder('core')
#1 /home/pi/nextcloud/lib/private/Template/JSCombiner.php(83): OC\Files\AppData\AppData->newFolder('core')
#2 /home/pi/nextcloud/lib/private/Template/JSResourceLocator.php(105): OC\Template\JSCombiner->process('/home/pi/nextcl...', 'core/js/merged-...', 'core')
#3 /home/pi/nextcloud/lib/private/Template/JSResourceLocator.php(68): OC\Template\JSResourceLocator->cacheAndAppendCombineJsonIfExist('/home/pi/nextcl...', 'core/js/merged-...')
#4 /home/pi/nextcloud/lib/private/Template/ResourceLocator.php(75): OC\Template\JSResourceLocator->doFind('js/merged-templ...')
#5 /home/pi/nextcloud/lib/private/TemplateLayout.php(249): OC\Template\ResourceLocator->find(Array)
#6 /home/pi/nextcloud/lib/private/TemplateLayout.php(132): OC\TemplateLayout::findJavascriptFiles(Array)
#7 /home/pi/nextcloud/lib/private/legacy/template.php(205): OC\TemplateLayout->__construct('guest', 'core')
#8 /home/pi/nextcloud/lib/public/AppFramework/Http/TemplateResponse.php(157): OC_Template->fetchPage()
#9 /home/pi/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(113): OCP\AppFramework\Http\TemplateResponse->render()
#10 /home/pi/nextcloud/lib/private/AppFramework/App.php(114): OC\AppFramework\Http\Dispatcher->dispatch(Object(OC\Core\Controller\LoginController), 'showLoginForm')
#11 /home/pi/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php(47): OC\AppFramework\App::main('OC\\Core\\Control...', 'showLoginForm', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
#12 [internal function]: OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
#13 /home/pi/nextcloud/lib/private/Route/Router.php(299): call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
#14 /home/pi/nextcloud/lib/base.php(1000): OC\Route\Router->match('/login')
#15 /home/pi/nextcloud/index.php(40): OC::handleRequest()
#16 {main}
File:/home/pi/nextcloud/lib/private/Files/Node/Folder.php
Line:166

Even though the mode for /data/appdata_ocsy9nheifei/js is 777. So I had to create /data/appdata_ocsy9nheifei/js/core and change its mode to 777 myself manually. I had to repeat this a number of times by getting similar error messages over and over again and creating the respective directories manually. After that I got a similar error message for a non-existing /data/appdata_ocsy9nheifei/css directory as well, and created that one similarly as well. After doing all of this now I can use the web interface again, it seems.

This is the current state of these new directories:

$ ls -l /data/appdata_ocsy9nheifei/{js,css}
/data/appdata_ocsy9nheifei/css:
total 20
drwxr-xr-x 2 pi pi 4096 Jun 11 22:39 core
drwxr-xr-x 2 pi pi 4096 Jun 11 22:39 files
drwxr-xr-x 2 pi pi 4096 Jun 11 22:39 files_sharing
drwxr-xr-x 2 pi pi 4096 Jun 11 22:39 files_texteditor
drwxr-xr-x 2 pi pi 4096 Jun 11 22:37 theming

/data/appdata_ocsy9nheifei/js:
total 40
drwxrwxrwx 2 root root 4096 Jun 11 22:01 activity
drwxrwxrwx 2 root root 4096 Jun 11 22:02 comments
drwxrwxrwx 2 root root 4096 Jun 11 22:06 core
drwxrwxrwx 2 root root 4096 Jun 11 22:01 files
drwxrwxrwx 2 root root 4096 Jun 11 22:04 files_sharing
drwxrwxrwx 2 root root 4096 Jun 11 22:06 files_texteditor
drwxrwxrwx 2 root root 4096 Jun 11 22:04 files_versions
drwxrwxrwx 2 root root 4096 Jun 11 22:06 gallery
drwxrwxrwx 2 root root 4096 Jun 11 22:01 notifications
drwxrwxrwx 2 root root 4096 Jun 11 22:07 systemtags

The directories under /data/appdata_ocsy9nheifei/css were created by Nextcloud not me.

I both wanted to report this issue in case other users are hitting this since digging oneself out of it wasn’t wasy and also because I’m not quite sure if everything is now in a good condition or not…

The output of your Nextcloud log in Admin > Logging:

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

<?php
$CONFIG = array (
  'instanceid' => 'ocsy9nheifei',
  'passwordsalt' => 'xxx',
  'secret' => 'xxx',
  'trusted_domains' => 
  array (
    0 => 'cloud.xxx',
  ),
  'datadirectory' => '/data',
  'overwrite.cli.url' => 'https://cloud.xxx',
  'dbtype' => 'mysql',
  'version' => '12.0.0.29',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'xxx',
  'dbpassword' => 'xxx',
  'logtimezone' => 'UTC',
  'logfile' => '/var/log/nextcloud.log',
  'installed' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_domain' => 'xxx',
  'mail_from_address' => 'nextcloud',
  'mail_smtpmode' => 'php',
  'maintenance' => false,
  'loglevel' => 2,
);

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


Remember, this information may be requested if it isn’t supplied; for fastest response please provide as much as you can :heart: Feel free to use a pastebin service, otherwise log files can be indented with 4 spaces on each line to present them in a friendlier way on the forum.

I want to mention a couple things for reference:

  1. It’s not recommended to set 777 for permissions. The recommendation is 750 for directories, and 640 for files. The owner and group should be the http user (www-data, etc)
  2. Apparently Nextcloud automatically resets the data directory permissions when you restart the web server, to 770
    Nextcloud "data" directory permissions resetting to 770

Thanks for the reminder. In this case this is a raspberry pi powered backup server I have at home sitting behind my firewall to which only I have access to, but still I agree that proper file permissions should be taken seriously. I went back and fixed them all. BTW now I noticed that Nextcloud has created many filed under these directories which I hadn’t seen before.

Makes sense, I just wanted to say that in case others with less experience see this and go on leaving things wide open.
I’m not sure about those extra files, but if you’re referring to the appdata files, my first guess would be that it’s related to performance (caching or css/JavaScript aggregation).

Just upgraded from 11 to 12 today. Encountered the same problem. Log did not show enough detailed info. Your info solved the problem. Thanks for the debug time and posting the solution.