NotPermittedException after moving data folder to a new device

Nextcloud version (eg, 12.0.2): 18.0.3
Operating system and version (eg, Ubuntu 17.04): Raspbian GNU/Linux 10 (buster)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38 (Raspbian)
PHP version (eg, 7.1): PHP 7.3.14-1~deb10u1 (cli)

The issue you are facing:
I moved my data folder to a new SSD and edited the config.php. I can access for example my news via Android app, but I can’t access the web interface: internal server error.

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

Steps to replicate it:

  1. Try to open the web nextcloud interface via browser.

The output of your Nextcloud log in Admin > Logging:

{"reqId":"XoxIIcOD7j@3BrLHUSC5yAAASRE","level":3,"time":"2020-04-07T09:30:56+00:00","remoteAddr":"109.91.135.63","user":"ncp","app":"index","method":"GET","url":"/index.php/apps/files/","message":{"Exception":"OCP\\Files\\NotPermittedException","Message":"","Code":0,"Trace":[{"file":"/var/www/nextcloud/lib/private/Files/SimpleFS/SimpleFile.php","line":108,"function":"putContent","class":"OC\\Files\\Node\\File","type":"->","args":[":root {\n--icon-confirm-fade-000: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iwLjMwMjd6IiBmaWxsPSIjMDAwIi8+PC9zdmc+Cg==);--icon-search-fffffe: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcSIgZmlsbD0iI2ZmZmZmZSIvPjwvZz48L3N2Zz4K);--icon-add-000: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC1di0yaDV2LTVoMnY1bDUtLjAyOFY4Ljk4aC01eiIgZmlsbD0iIzAwMCIvPjwvc3ZnPgo=);--icon-add-fff: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iGQ9Ik05LjAyIDEzLjk4aC0ydi01aC01di0yaDV2LTVoMnY1bDUtLjAyOFY4Ljk4aC01eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPgo=);--icon-address-000: url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgd2lkdGg9IjE2IiB2ZXJzaW9uPSIxL

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

<?php
$CONFIG = array (
  'passwordsalt' => 'XXX',
  'secret' => 'XXX',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    11 => '2a02:908:212:ed40:8618:a611:c43f:8d2c',
    1 => '192.168.0.87',
    5 => 'nextcloudpi.local',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
    20 => 'example.com',
    21 => '192.168.0.87',
  ),
  'datadirectory' => '/media/ssd_nextcloud/ncdata/',
  'dbtype' => 'mysql',
  'version' => '18.0.3.0',
  'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'XXX',
  'installed' => true,
  'instanceid' => 'oc6cnssj6shs',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
	'overwrite.cli.url' => 'http://localhost',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'XXX',
  'dbpassword' => 'XXX',
  'installed' => true,
  'instanceid' => 'oc6cnssj6shs',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>                                                                                                                             array (                                                                                                                                  'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'XXX',
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'XXX',
  'mail_domain' => 'XXX',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'tempdirectory' => '/media/ssd_nextcloud/ncdata/tmp',
  'logfile' => '/media/ssd_nextcloud/ncdata/nextcloud.log',
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_smtphost' => 'XXX',
  'mail_smtpport' => '587',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'XXX',
  'mail_smtppassword' => 'XXX',
  'updater.release.channel' => 'stable',
  'theme' => '',
  'loglevel' => 2,
);

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

[Tue Apr 07 11:29:53.429068 2020] [ssl:warn] [pid 801:tid 3069288976] AH01909: localhost:4443:0 server certificate does NOT include an$[Tue Apr 07 11:29:53.429278 2020] [ssl:error] [pid 801:tid 3069288976] AH02217: ssl_stapling_init_cert: can't retrieve issuer certific$[Tue Apr 07 11:29:53.429297 2020] [ssl:error] [pid 801:tid 3069288976] AH02604: Unable to configure certificate localhost:4443:0 for s$[Tue Apr 07 11:29:53.430239 2020] [mpm_event:notice] [pid 801:tid 3069288976] AH00489: Apache/2.4.38 (Raspbian) OpenSSL/1.1.1d configu$[Tue Apr 07 11:29:53.430259 2020] [core:notice] [pid 801:tid 3069288976] AH00094: Command line: '/usr/sbin/apache2'

More info:

MariaDB [nextcloud]> select * from oc_storages;
+------------+-------------------------------------+-----------+--------------+
| numeric_id | id                                  | available | last_checked |
+------------+-------------------------------------+-----------+--------------+
|          1 | home::ncp                           |         1 |         NULL |
|          2 | local::/var/www/nextcloud/data/     |         1 |         NULL |
|          4 | home::XXX1                          |         1 |         NULL |
|          5 | home::XXX2                          |         1 |         NULL |
|          6 | local::/media/ssd_nextcloud/ncdata/ |         1 |         NULL |
+------------+-------------------------------------+-----------+--------------+
5 rows in set (0.001 sec)
sudo -u www-data php /var/www/nextcloud/occ files:scan --all
Cannot load Zend OPcache - it was already loaded
Starting scan for user 1 out of 3 (XXX1)
Starting scan for user 2 out of 3 (ncp)
Starting scan for user 3 out of 3 (XXX2)
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 252     | 4670  | 00:03:11     |
+---------+-------+--------------+

New error in the log:

{
	"reqId": "Xo7p-1QtmeerDRE5tu9BqQAACQM",
	"level": 3,
	"time": "2020-04-09T09:26:05+00:00",
	"remoteAddr": "109.91.135.63",
	"user": "ncp",
	"app": "cssresourceloader",
	"method": "GET",
	"url": "/index.php/apps/files/",
	"message": "Could not find resource css/server.css to load",
	"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4102.0 Safari/537.36",
	"version": "18.0.3.0"
}

New error:

{
	"reqId": "YpNMoWtTJosj2YidCGV2",
	"level": 3,
	"time": "2020-04-09T10:07:58+00:00",
	"remoteAddr": "",
	"user": "--",
	"app": "no app in context",
	"method": "",
	"url": "--",
	"message": {
		"Exception": "OCP\\Files\\NotPermittedException",
		"Message": "",
		"Code": 0,
		"Trace": [
			{
				"file": "/var/www/nextcloud/lib/private/Files/SimpleFS/SimpleFile.php",
				"line": 149,
				"function": "delete",
				"class": "OC\\Files\\Node\\File",
				"type": "->",
				"args": []
			},
			{
				"file": "/var/www/nextcloud/lib/private/Template/SCSSCacher.php",
				"line": 381,
				"function": "delete",
				"class": "OC\\Files\\SimpleFS\\SimpleFile",
				"type": "->",
				"args": []
			},
			{
				"file": "/var/www/nextcloud/lib/private/Repair/ClearFrontendCaches.php",
				"line": 63,
				"function": "resetCache",
				"class": "OC\\Template\\SCSSCacher",
				"type": "->",
				"args": []
			},
			{
				"file": "/var/www/nextcloud/lib/private/Repair.php",
				"line": 104,
				"function": "run",
				"class": "OC\\Repair\\ClearFrontendCaches",
				"type": "->",
				"args": [
					{
						"__class__": "OC\\Repair"
					}
				]
			},
			{
				"file": "/var/www/nextcloud/core/Command/Maintenance/Repair.php",
				"line": 126,
				"function": "run",
				"class": "OC\\Repair",
				"type": "->",
				"args": []
			},
			{
				"file": "/var/www/nextcloud/3rdparty/symfony/console/Command/Command.php",
				"line": 255,
				"function": "execute",
				"class": "OC\\Core\\Command\\Maintenance\\Repair",
				"type": "->",
				"args": [
					{
						"__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
					},
					{
						"__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
					}
				]
			},
			{
				"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
				"line": 915,
				"function": "run",
				"class": "Symfony\\Component\\Console\\Command\\Command",
				"type": "->",
				"args": [
					{
						"__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
					},
					{
						"__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
					}
				]
			},
			{
				"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
				"line": 272,
				"function": "doRunCommand",
				"class": "Symfony\\Component\\Console\\Application",
				"type": "->",
				"args": [
					{
						"__class__": "OC\\Core\\Command\\Maintenance\\Repair"
					},
					{
						"__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
					},
					{
						"__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
					}
				]
			},
			{
				"file": "/var/www/nextcloud/3rdparty/symfony/console/Application.php",
				"line": 148,
				"function": "doRun",
				"class": "Symfony\\Component\\Console\\Application",
				"type": "->",
				"args": [
					{
						"__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
					},
					{
						"__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
					}
				]
			},
			{
				"file": "/var/www/nextcloud/lib/private/Console/Application.php",
				"line": 214,
				"function": "run",
				"class": "Symfony\\Component\\Console\\Application",
				"type": "->",
				"args": [
					{
						"__class__": "Symfony\\Component\\Console\\Input\\ArgvInput"
					},
					{
						"__class__": "Symfony\\Component\\Console\\Output\\ConsoleOutput"
					}
				]
			},
			{
				"file": "/var/www/nextcloud/console.php",
				"line": 99,
				"function": "run",
				"class": "OC\\Console\\Application",
				"type": "->",
				"args": []
			},
			{
				"file": "/var/www/nextcloud/occ",
				"line": 11,
				"args": [
					"/var/www/nextcloud/console.php"
				],
				"function": "require_once"
			}
		],
		"File": "/var/www/nextcloud/lib/private/Files/Node/File.php",
		"Line": 137,
		"CustomMessage": "SCSSCacher: unable to delete file: 6c1e-e2f6-style.css"
	},
	"userAgent": "--",
	"version": "18.0.3.0"
}

I really fall into despair. Nextcloud is a nice idea, but the maintenance is bigger then the benefit. And now I’m stucked and there is no support :disappointed_relieved:

Hi GambaJo,

there is a HowTo on this forum. Have a look at it and try the steps mentioned in that HowTo.

EDIT: I had another look at your posted config.php and noticed that there a multiple duplicate parameters, is that wanted? If not, It would be best to cleanup the config.php a little and remove duplicate parameters.

Yes, I found this thread already and tried everything, even permissions to 777, but this sounds wrong to me.
But all this didn’t worked.

I found the solution:
First I formated the partition where the data was. Then I recreated the files from my backup.
Then an error with the JSCombiner came up, and this was the solution:

  • delete js folder: rm -r appdata_*/js
  • recreate occ files:scan-app-data
  • repair: occ maintenance:repair
2 Likes