Nextcloud version: 13.0.1
Operating system and version: debian 9
Apache or nginx version: apache 2.4.25
PHP version: 7.0.30
I had a disk failure on my server and had to reinstall it from scratch. I’m trying to restore my nextcloud instance, but I’m failling to do it. It’s not the first time I have to restore my installation, but the first time on a newly reinstalled server, though.
After having some troubles, I use the information on restoring of the documentation.
So, basically, I restored the source file with the config
directory, the data directory, and the database. I restored the apache configuration and restarted it.
But when accessing my installation through the web, I get an Internal server error. The apache log are talking about permissions denied, so I’ve checked the permission on the directories and the files, also for the data
directory, which is outside of my /var/www/nexcloud/
directory. In fact, the data
directory is on a NAS, mounted through NFS. But I think that the permission are right. Except that Nextcloud is complaining about it.
Indeed, when I run sudo -u www-data php occ
the output is as follow:
Your data directory is invalid
Ensure there is a file called ".ocdata" in the root of the data directory.
Cannot create "data" directory
This can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/13/go.php?to=admin-dir_permissions
An unhandled exception has been thrown:
Exception: Environment not properly prepared. in /var/www/cloud/lib/private/Console/Application.php:148
Stack trace:
#0 /var/www/cloud/console.php(89): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#1 /var/www/cloud/occ(11): require_once('/var/www/cloud/...')
#2 {main}
I saw that there are some topics here related to that specific message, but couldn’t find any help in these threads.
The permissions on the source directory of my installation:
drwxr-x--- 13 www-data www-data 4.0K aoû 2 15:15 .
drwxr-xr-x 26 root root 4.0K aoû 2 15:01 ..
drwxr-x--- 33 www-data www-data 4.0K avr 3 08:41 3rdparty
drwxr-x--- 45 www-data www-data 4.0K mai 17 22:17 apps
-rw-r----- 1 www-data www-data 12K avr 3 08:41 AUTHORS
drwxr-x--- 2 www-data www-data 4.0K aoû 2 15:03 config
-rw-r----- 1 www-data www-data 3.6K avr 3 08:41 console.php
drwxr-x--- 17 www-data www-data 4.0K avr 3 08:41 core
-rw-r----- 1 www-data www-data 4.9K avr 3 08:41 cron.php
-rw-r----- 1 www-data www-data 2.8K avr 3 09:02 .htaccess
-rw-r----- 1 www-data www-data 179 avr 3 08:41 index.html
-rw-r----- 1 www-data www-data 3.4K avr 3 08:41 index.php
drwxr-x--- 6 www-data www-data 4.0K avr 3 08:41 lib
-rw-r----- 1 www-data www-data 283 avr 3 08:41 occ
drwxr-x--- 2 www-data www-data 4.0K avr 3 08:41 ocs
drwxr-x--- 2 www-data www-data 4.0K avr 3 08:41 ocs-provider
-rw-r----- 1 www-data www-data 3.2K avr 3 08:41 public.php
-rw-r----- 1 www-data www-data 5.3K avr 3 08:41 remote.php
drwxr-x--- 4 www-data www-data 4.0K avr 3 08:41 resources
-rw-r----- 1 www-data www-data 26 avr 3 08:41 robots.txt
drwxr-x--- 14 www-data www-data 4.0K avr 3 08:41 settings
-rw-r----- 1 www-data www-data 2.3K avr 3 08:41 status.php
drwxr-x--- 3 www-data www-data 4.0K avr 3 08:41 themes
drwxr-x--- 2 www-data www-data 4.0K avr 3 08:41 updater
-rw-r----- 1 www-data www-data 159 avr 3 09:02 .user.ini
-rw-r----- 1 www-data www-data 362 avr 3 08:41 version.php
The permissions on my data directory:
drwxrwx--- 17 www-data www-data 26 avr 23 11:10 .
drwx------ 7 root root 4.0K aoû 2 15:15 ..
drwxr-xr-x 12 www-data www-data 12 avr 2 08:48 appdata_5251034f3b47f
drwxr-xr-x 11 www-data www-data 11 fév 10 13:21 user1
drwxr-xr-x 9 www-data www-data 9 mar 12 2017 user2
drwxr-xr-x 2 www-data www-data 3 avr 3 08:52 files_external
drwxr-xr-x 3 www-data www-data 3 fév 7 2014 gallery
-rwxrwx--- 1 www-data www-data 324 avr 3 08:52 .htaccess
-rw-r--r-- 1 www-data www-data 131 jun 18 2016 htaccesstest.txt
drwxrwx--- 14 www-data www-data 14 mar 15 2017 user3
-rwxrwx--- 1 www-data www-data 0 avr 3 08:52 index.html
drwxrwx--- 14 www-data www-data 14 jun 30 2017 user4
drwxr-xr-x 2 www-data www-data 2 nov 30 2015 .locks
drwxr-xr-x 7 root www-data 7 mai 18 08:57 user5
-rw-r----- 1 www-data www-data 553 sep 17 2015 mount.json
-rw-r----- 1 root www-data 2.0M jui 1 19:14 nextcloud.log
-rw-r----- 1 www-data www-data 1.6G avr 3 08:53 nextcloud.log.1
-rw-r--r-- 1 www-data www-data 0 avr 3 08:52 .ocdata
-rw-r--r-- 1 www-data www-data 0 fév 22 2015 owncloud.db
drwxr-xr-x 2 www-data www-data 3 fév 24 2014 owncloud_private_key
drwxr-xr-x 10 www-data www-data 10 jun 28 10:52 user6
drwxr-xr-x 2 www-data www-data 6 mar 15 2014 public-keys
drwxr-xr-x 3 www-data www-data 4 mai 31 2015 updater_backup
-rw-r--r-- 1 www-data www-data 1.6K jan 22 2017 updater.log
drwxrwx--- 9 www-data www-data 9 mar 12 2017 user7
drwxr-xr-x 11 www-data www-data 11 oct 1 2017 user8
My config file:
<?php
$CONFIG = array (
'instanceid' => '5251034f3b47f',
'passwordsalt' => 'xxxx',
'datadirectory' => '/xxx/nextcloud-data',
'dbtype' => 'mysql',
'version' => '13.0.1.1',
'dbname' => 'xxx',
'dbhost' => 'localhost',
'dbtableprefix' => 'oc_',
'dbuser' => 'xxx',
'dbpassword' => 'xxx',
'installed' => true,
'loglevel' => 2,
'log_rotate_size' => 209715200,
'theme' => '',
'maintenance' => false,
'trusted_domains' =>
array (
0 => 'id-libre.org',
),
'share_folder' => '/Shared',
'knowledgebaseenabled' => true,
'remember_login_cookie_lifetime' => 1296000,
'session_lifetime' => 86400,
'session_keepalive' => true,
'forcessl' => true,
'asset-pipeline.enabled' => false,
'secret' => 'xxxx',
'mail_smtpmode' => 'php',
'mail_from_address' => 'cloud',
'mail_domain' => 'id-libre.org',
'overwrite.cli.url' => '/cloud',
'trashbin_retention_obligation' => 'auto',
'enable_previews' => true,
'filelocking.enabled' => 'true',
'memcache.local' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => 'localhost',
'port' => 6379,
'timeout' => 0,
),
);
Any help in order to understand why I’m failling is very much appreciated, and of course I’ll try to give any useful information.