NC12 - Internal Server Error after login


I have installed Nextcloud 12 on my Ubuntu Server 16.04 and first everything was working fine. I could create folders from the UI, upload files and even upload files from the android client. I only had a “minor” problem: When I tried to open a shared link, I received an Internal Error. I have described the error in more detail here:

I thought that maybe a reboot would fix the problem, but it only made things worse. Now I get a similar error right after the login. That means that I can see the login screen, enter my credentials, get redirected to “/apps/files” and instead of seeing the homepage, I get the same “Internal Server Error” message. This time the logs are a bit different though. I still get a “NotPermittedException”, but now on a delete operation. I have looked at the filesystem and already executed “chown -R www-data:www-data” on my web folder as well as data folder. So I assume that the filesystem should be fine.

I have also looked into the logs and tried to do some debugging, but since I am not really a PHP expert, this is all could find so far:

As stated in the logs, the exception is thrown by the delete operation in the file SimpleFile.php. The exception however is actually thrown inside File.php. Here the permissions are validated, which fails and thus the exception is thrown. I have looked into the data that is used for the validation and its origin is the $data attribute inside the file FileInfo.php. I have written the content into the logs using $logger->debug(data[‘permissions’]); and the value that was logged was simply “d”.

I am stuck at this point as the $data attribute is injected into the class and I don’t know where this actually happens. I assume its done using the composer component, but I don’t really know how this works. Therefore I would really appreciate your help!

I have even formatted the log… :wink:

“message”:“Exception: {“Exception”:“OCP\Files\NotPermittedException”,
“Code”:0,“Trace”:"#0 /var/www/nextcloud/lib/private/Files/SimpleFS/SimpleFile.php(107): OC\Files\Node\File->delete()
\n#1 /var/www/nextcloud/lib/private/Template/SCSSCacher.php(252): OC\Files\SimpleFS\SimpleFile->delete()
\n#2 /var/www/nextcloud/lib/private/Template/SCSSCacher.php(164): OC\Template\SCSSCacher->resetCache()
\n#3 /var/www/nextcloud/lib/private/Template/SCSSCacher.php(109): OC\Template\SCSSCacher->variablesChanged()
\n#4 /var/www/nextcloud/lib/private/Template/CSSResourceLocator.php(99): OC\Template\SCSSCacher->process(’/var/www/nextcl…’, ‘core/css/server…’, ‘core’)
\n#5 /var/www/nextcloud/lib/private/Template/CSSResourceLocator.php(56): OC\Template\CSSResourceLocator->cacheAndAppendScssIfExist(’/var/www/nextcl…’, ‘core/css/server…’)
\n#6 /var/www/nextcloud/lib/private/Template/ResourceLocator.php(75): OC\Template\CSSResourceLocator->doFind(‘css/server’)
\n#7 /var/www/nextcloud/lib/private/TemplateLayout.php(225): OC\Template\ResourceLocator->find(Array)
\n#8 /var/www/nextcloud/lib/private/TemplateLayout.php(170): OC\TemplateLayout::findStylesheetFiles(Array)
\n#9 /var/www/nextcloud/lib/private/legacy/template.php(205): OC\TemplateLayout->__construct(‘user’, ‘files’)
\n#10 /var/www/nextcloud/lib/public/AppFramework/Http/TemplateResponse.php(157): OC_Template->fetchPage()
\n#11 /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(113): OCP\AppFramework\Http\TemplateResponse->render()
\n#12 /var/www/nextcloud/lib/private/AppFramework/App.php(114): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Files\Controller\ViewController), ‘index’)
\n#13 /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php(47): OC\AppFramework\App::main(‘ViewController’, ‘index’, Object(OC\AppFramework\DependencyInjection\DIContainer), Array)
\n#14 [internal function]: OC\AppFramework\Routing\RouteActionHandler->__invoke(Array)
\n#15 /var/www/nextcloud/lib/private/Route/Router.php(299): call_user_func(Object(OC\AppFramework\Routing\RouteActionHandler), Array)
\n#16 /var/www/nextcloud/lib/base.php(1000): OC\Route\Router->match(’/apps/files/’)
\n#17 /var/www/nextcloud/index.php(40): OC::handleRequest()
\n#18 {main}",
“userAgent”:“Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36”,

Thanks in advance!

I was finally able to find a solution.

The root cause of the error is the fact that I have moved my data folder after the installation using the steps described by @wclang here Is there a safe and reliable way to move data directory out of web root?.

The solution to my problem was to cleanup the database. I had to deactivate the old data directory inside the table oc_storages and I had to delete all the content from the table oc_filecache. Afterwards I restarted Apache and finally when I logged in, the error had disappeared :slight_smile:


Please @sirea could you gives us the command that you used to do this.
I have the same problem than you, I also changed the location of my data folder.
Thank you !!!

root@XXXXXXXX:/mysql -u root -p
Enter password:
mysql> Use nextcloud

I had verified if all data directory
inside the table oc_storages is correct

I had to delete all the content from the table oc_filecache


Thanks, this helped solve the same problem for me after I moved all my data from local storage to an NFS share on my FreeNAS. Now everything’s back up and running fine.

Thank you. I just truncate oc_filecache table

So great!! truncating the oc_filecache table fixed it. I just registered to say thanks :slight_smile:

Thanks!! It did work!!!

thank you was going nuts

I’d like to add, that with nc on ubuntu with snap there’s an almost trivial solution to this here: Permissions Issue with Data Storage "Snap" - Solved