Upgrade to 8.2.11 via occ fails with 'data directory not writable for ownCloud'

Hi there,
I hope someone can help me on this issue. As I still have the problem, that the data dir is reported not to be writable I did some additional research in the meantime and figured out there could be an issue with the php function ‘is_writable’. Obviously in some cases the function returns not writable even if this is not true. If I run the following script:

<?php
  $dir = '/var/oc_data';
  if (is_writable($dir)) {
    echo $dir, ' is writable';
  } else {
    echo $dir, ' is NOT writable';
  }
?>

it returns ‘NOT writable’.

Unfortunately I don’t understand which php scripts are used during update process which may use this function.
Any thoughts on that?

Thank you in advance for your help.

Steps to reproduce

  1. Prepare update as described under https://doc.owncloud.org/server/8.2/admin_manual/maintenance/manual_upgrade.html
  2. Start sudo -u www-data php occ upgrade

Expected behaviour

Update to new version should be done

Actual behaviour

Update hangs with:
Data directory (/var/oc_data) not writable by ownCloud
Permissions can usually be fixed by giving the webserver write access to the root directory.
Even switching of the maintenance mode is not possible and end up in the same error message.
file/directory permissions and ownership for /var/www/owncloud and the data directory as well have been set up as recommended in the owncloud documentation (strong permissions).

Server configuration

Operating system:
Linux pcsl04 4.14.82-v7+ #1165 SMP Wed Nov 21 16:42:28 GMT 2018 armv7l
Raspbian Linux on Raspberry Pi

Web server:
nginx/1.6.2

Database:
mySQL 5.5.62-0+deb8u1 - (Raspbian)

PHP version:
5.6.38-0+deb8u1

ownCloud version: (see ownCloud admin page)
8.2.9

Updated from an older ownCloud or fresh install:
updated from older versions

Where did you install ownCloud from:
Manuel installation vom owncloud website

Signing status (ownCloud 9.0 and above):

The content of config/config.php:

$CONFIG = array (
  'instanceid' => '<DELETED>',
  'passwordsalt' => '<DELETED>',
  'secret' => '<DELETED>',
  'trusted_domains' =>
  array (
    0 => 'pcsl04.fritz.box',
    1 => 'XXXXXX.selfhost.eu',
    2 => 'owncloud.XXXXXX.de',
  ),
  'filesystem_check_changes' => 1,
  'datadirectory' => '/var/oc_data',
  'tempdirectory' => '/var/oc_data/tmp',
  'overwrite.cli.url' => 'https://pcsl04.fritz.box',
  'dbtype' => 'mysql',
  'version' => '8.2.9.4',
  'dbname' => 'owncloud',
  'dbhost' => '192.168.XXX.XXX',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'owncloud',
  'dbpassword' => '<DELETED>',
  'logtimezone' => 'Europe/Berlin',
  'installed' => true,
  'theme' => '',
  'loglevel' => 0,
  'maintenance' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'mail_smtpmode' => 'smtp',
  'mail_from_address' => '<DELETED>',
  'mail_domain' => 'gmx.de',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'mail.gmx.net',
  'mail_smtpport' => '587',
  'mail_smtpname' => '<DELETED>',
  'mail_smtppassword' => '<DELETED>',
);

List of activated apps:
All apps have been disabled before starting the upgrade process

Are you using external storage, if yes which one: local/smb/sftp/…
NFS remote storage is used for the PIs root directory and for the data directory as well. The data directory is a separate NFS mount

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/…

Client configuration

Browser:
Google chrome

Operating system:
Windows 10

Logs

ownCloud log (data/owncloud.log)

{"reqId":"NN2w15BcrHQ6LC44sCFG","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","level":1,"time":"2018-11-28T15:05:02+01:00","method":"--","url":"--"}
{"reqId":"8MfAW\/PXau1UyW0gvB7\/","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for local cache","level":1,"time":"2018-11-28T15:10:02+01:00","method":"--","url":"--"}
{"reqId":"8MfAW\/PXau1UyW0gvB7\/","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","level":1,"time":"2018-11-28T15:10:02+01:00","method":"--","url":"--"}
{"reqId":"GOKmPkfM4AeK1VAImIQO","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for local cache","level":1,"time":"2018-11-28T15:15:02+01:00","method":"--","url":"--"}
{"reqId":"GOKmPkfM4AeK1VAImIQO","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","level":1,"time":"2018-11-28T15:15:03+01:00","method":"--","url":"--"}
{"reqId":"nBpwtasYZlwRwmMlukup","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for local cache","level":1,"time":"2018-11-28T15:20:02+01:00","method":"--","url":"--"}
{"reqId":"nBpwtasYZlwRwmMlukup","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","level":1,"time":"2018-11-28T15:20:02+01:00","method":"--","url":"--"}
{"reqId":"qpVqnD8RWogejnWAsBjt","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for local cache","level":1,"time":"2018-11-28T15:24:44+01:00","method":"--","url":"--"}
{"reqId":"qpVqnD8RWogejnWAsBjt","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","level":1,"time":"2018-11-28T15:24:44+01:00","method":"--","url":"--"}
{"reqId":"yb928TflS1EEXHyfPzHp","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for local cache","level":1,"time":"2018-11-28T15:25:02+01:00","method":"--","url":"--"}
{"reqId":"yb928TflS1EEXHyfPzHp","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","level":1,"time":"2018-11-28T15:25:02+01:00","method":"--","url":"--"}
{"reqId":"Ij2n2UbayZBnLFMiATaA","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for local cache","level":1,"time":"2018-11-28T15:30:02+01:00","method":"--","url":"--"}
{"reqId":"Ij2n2UbayZBnLFMiATaA","remoteAddr":"","app":"cli","message":"Memcache \\OC\\Memcache\\APCu not available for distributed cache","level":1,"time":"2018-11-28T15:30:02+01:00","method":"--","url":"--"}

Can you make a ls -la on the data dir?

Yes I can.
Even writing to that directory is possible.
sudo -u www-data touch /var/oc_data/test creats a file named test.

is this the same data dir that is in the config.php?

and in the oc_storages?

yes, the same dir is mentioned in config.php and oc_storages table.

I found a solution (or a workaround) for the problem on my own. I found out, that the error message has been generated by the script /var/www/owncloud/lib/private/util.php
As I had earlier manuelly checked that the data directory is writable, I just commented the check out like that during the update:

//                      } else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) {
//                              //common hint for all file permissions error messages
//                              $permissionsHint = $l->t('Permissions can usually be fixed by '
//                                      . '%sgiving the webserver write access to the root directory%s.',
//                                      array('<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">', '</a>'));
//                              $errors[] = array(
//                                      'error' => 'Data directory (' . $CONFIG_DATADIRECTORY . ') not writable by ownCloud',
//                                      'hint' => $permissionsHint
//                              );

I know this is not a perfect solution, but it was the only option I saw.

So this issue can be closed.

Many thanks for your help.

Hey,

i think it could be quite interesting why PHP internal functions like:

https://secure.php.net/manual/en/function.is-writable.php
https://secure.php.net/manual/en/function.is-readable.php

are not telling the truth. :confused:

Is there something special in your setup causing this behavior?

hi tom,
to be honest, I don’t know. I started with owncloud on this server I think with version 6.x and did several manual updates since then. As far as I know there is nothing special. It might be an issue with my 5.6 version of PHP. Perhaps it will be better with PHP 7, but I did not find the time to set up a new server instance.