Nextcloud Data dir error (no file upload)

A recent update of NextCloudPi broke my config, because i can not upload anymore files to my NextCloud server. But i still can download all the files.

my datadirectory is:

/media/myCloudDrive/ncdata

but after the update it was:

/media/root/myCloudDrive/ncdata

So the server reported missing files in the data directory of course.

So i changed the paths in /var/www/nextcloud/config/config.php for the following params:

'tempdirectory' => '/media/myCloudDrive/ncdata/tmp'
'logfile' => '/media/myCloudDrive/ncdata/nextcloud.log'
'datadirectory' => '/media/myCloudDrive/ncdata'

After this i rebooted and the server worked again, so i thought, everything is fine except the upload. I guess i have missed one parameter here.

------------------------------------------------Meta info ---------------------------------------------------
Nextcloud version : 18.0.1.3
Operating system and version : Armbian buster with Linux 5.4.21-meson64
Apache or nginx version : ??
PHP version : PHP 7.3.11-1~deb10u1

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

Steps to replicate it:

  1. Open Desktop App or Website
  2. Upload a non empty file

The output of your Nextcloud log in Admin > Logging:

In the Webinterface or Desktop App? Cant see it, sorry

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

cat /var/www/nextcloud/config/config.php
<?php
$CONFIG = array (
  'passwordsalt' => '+gu6VJoXsK1',
  'secret' => '/F6++5MRbP',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '192.168.178.21',
    5 => 'nextcloudpi.local',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
  ),
  'datadirectory' => '/media/myCloudDrive/ncdata',
  'dbtype' => 'mysql',
  'version' => '18.0.1.3',
  'overwrite.cli.url' => 'https://nextcloud-lalala123.de/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'KVjo=',
  'installed' => true,
  'instanceid' => 'ocxlb',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'gh=',
  ),
  'tempdirectory' => '/media/myCloudDrive/ncdata/tmp',
  'mail_smtpmode' => 'sendmail',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'admin',
  'preview_max_x' => '2048',
  'preview_max_y' => '2048',
  'jpeg_quality' => '60',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'logfile' => '/media/myCloudDrive/ncdata/nextcloud.log',
  'loglevel' => '2',
  'log_type' => 'file',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'nextcloud-adsd1234.de',
);

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

[Sun Mar 08 20:12:29.325519 2020] [proxy_fcgi:error] [pid 2557:tid 281472728543632] [client 87.122.228.217:50001] AH01071: Got error '}'
[Sun Mar 08 20:13:01.430529 2020] [proxy_fcgi:error] [pid 2556:tid 281471956808080] [client 87.122.228.217:50003] AH01071: Got error 'PHP message: PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 83PHP message: {"reqId":"XmVRzV6rCSpvb8RtFhOYnwAAAA4","level":3,"time":"2020-03-08T20:13:01+00:00","remoteAddr":"87.122.228.217","user":"--","app":"PHP","method":"GET","url":"/status.php","message":"fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log at /var/www/nextcloud/lib/private/Log/File.php#83","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}PHP message: {"reqId":"XmVRzV6rCSpvb8RtFhOYnwAAAA4","level":2,"time":"2020-03-08T20:13:01+00:00","remoteAddr":"87.122.228.217","user":"--","app":"no app in context","method":"GET","url":"/status.php","message":"Temporary directory /media/myCloudDrive/ncdata/tmp is not present or writable","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}PHP message: PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 83PHP message: {"reqId":"XmVRzV6rCSpvb8RtFhOYnwAAAA4","level":3,"time":"2020-03-08T20:13:01+00:00","remoteAddr":"87.122.228.217","user":"--","app":"PHP","method":"GET","url":"/status.php","message":"fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log at /var/www/nextcloud/lib/private/Log/File.php#83","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}PHP message: {"reqId":"XmVRzV6rCSpvb8RtFhOYnwAAAA4","level":2,"time":"2020-03-08T20:13:01+00:00","remoteAddr":"87.122.228.217","user":"--","app":"no app in context","method":"GET","url":"/status.php","message":"Temporary directory /media/root/myCloudDrive/ncdata/tmp is not present or writable","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}PHP message: PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 83PHP message: {"reqId":"XmVRzV6rCSpvb8RtFhOYnwAAAA4","level":3,"time":"2020-03-08T20:13:01+00:00","remoteAddr":"87.122.228.217","user":"--","app":"PHP","method":"GET","url":"/status.php","message":"fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log at /var/www/nextcloud/lib/private/Log/File.php#83","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}PHP message: {"reqId":"XmVRzV6rCSpvb8RtFhOYnwAAAA4","level":2,"time":"2020-03-08T20:13:01+00:00","remoteAddr":"87.122.228.217","user":"--","app":"no app in context","method":"GET","url":"/status.php","message":"Temporary directory /media/root/myCloudDrive/ncdata/tmp is not present or writable","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}'
[Sun Mar 08 20:13:01.431007 2020] [proxy_fcgi:error] [pid 2556:tid 281471956808080] [client 87.122.228.217:50003] AH01071: Got error 'PHP message: PHP Warning:  fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log in /var/www/nextcloud/lib/private/Log/File.php on line 83PHP message: {"reqId":"XmVRzV6rCSpvb8RtFhOYnwAAAA4","level":3,"time":"2020-03-08T20:13:01+00:00","remoteAddr":"87.122.228.217","user":"--","app":"PHP","method":"GET","url":"/status.php","message":"fileperms(): stat failed for /media/myCloudDrive/ncdata/nextcloud.log at /var/www/nextcloud/lib/private/Log/File.php#83","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}PHP message: {"reqId":"XmVRzV6rCSpvb8RtFhOYnwAAAA4","level":3,"time":"2020-03-08T20:13:01+00:00","remoteAddr":"87.122.228.217","user":"--","app":"PHP","method":"GET","url":"/status.php","message":"chmod(): No such file or directory at /var/www/nextcloud/lib/private/Log/File.php#84","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"'
[Sun Mar 08 20:13:01.434811 2020] [proxy_fcgi:error] [pid 2556:tid 281471956808080] [client 87.122.228.217:50003] AH01071: Got error '}'
[Sun Mar 08 20:14:39.510313 2020] [access_compat:error] [pid 2556:tid 281472661434768] [client 87.122.228.217:50015] AH01797: client denied by server configuration: /var/www/nextcloud/config
[Sun Mar 08 20:14:45.239079 2020] [access_compat:error] [pid 2556:tid 281471671587216] [client 87.122.228.217:54982] AH01797: client denied by server configuration: /var/www/nextcloud/config

Logfile /media/myCloudDrive/ncdata/nextcloud.log

{"reqId":"XmVSflHKtYc5AZF2weRCXQAAAEs","level":3,"time":"2020-03-08T20:15:58+00:00","remoteAddr":"87.122.228.217","user":"ncp","app":"PHP","method":"PUT","url":"/remote.php/dav/uploads/ncp/3394095104/00000000","message":"fread(): file created in the system's temporary directory at /var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php#91","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}
{"reqId":"XmVSflHKtYc5AZF2weRCXQAAAEs","level":3,"time":"2020-03-08T20:15:58+00:00","remoteAddr":"87.122.228.217","user":"ncp","app":"PHP","method":"PUT","url":"/remote.php/dav/uploads/ncp/3394095104/00000000","message":"fread(): Unable to create temporary file, Check permissions in temporary files directory. at /var/www/nextcloud/3rdparty/icewind/streams/src/Wrapper.php#91","userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}
{"reqId":"XmVSflHKtYc5AZF2weRCXQAAAEs","level":3,"time":"2020-03-08T20:15:58+00:00","remoteAddr":"87.122.228.217","user":"ncp","app":"no app in context","method":"PUT","url":"/remote.php/dav/uploads/ncp/3394095104/00000000","message":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 10000000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 8192 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php","line":47,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["00000000",null]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1096,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","type":"->","args":["00000000",null]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":525,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["uploads/ncp/3394095104/00000000",null,null]},{"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https://nextcloud-lalala123.de/remote.php/dav/uploads/ncp/3394095104/00000000","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPut"],[{"absoluteUrl":"https://nextcloud-lalala123.de/remote.php/dav/uploads/ncp/3394095104/00000000","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PUT",[{"absoluteUrl":"https://nextcloud-lalala123.de/remote.php/dav/uploads/ncp/3394095104/00000000","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https://nextcloud-lalala123.de/remote.php/dav/uploads/ncp/3394095104/00000000","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":319,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/remote.php","line":165,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":229,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}
{"reqId":"XmVSflHKtYc5AZF2weRCXQAAAEs","level":4,"time":"2020-03-08T20:15:58+00:00","remoteAddr":"87.122.228.217","user":"ncp","app":"webdav","method":"PUT","url":"/remote.php/dav/uploads/ncp/3394095104/00000000","message":{"Exception":"Sabre\\DAV\\Exception\\BadRequest","Message":"Expected filesize of 10000000 bytes but read (from Nextcloud client) and wrote (to Nextcloud storage) 8192 bytes. Could either be a network problem on the sending side or a problem writing to the storage on the server side.","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":156,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/nextcloud/apps/dav/lib/Upload/UploadFolder.php","line":47,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["00000000",null]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":1096,"function":"createFile","class":"OCA\\DAV\\Upload\\UploadFolder","type":"->","args":["00000000",null]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":525,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["uploads/ncp/3394095104/00000000",null,null]},{"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"absoluteUrl":"https://nextcloud-lalala123.de/remote.php/dav/uploads/ncp/3394095104/00000000","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/EventEmitterTrait.php","line":105,"function":"call_user_func_array","args":[[{"__class__":"Sabre\\DAV\\CorePlugin"},"httpPut"],[{"absoluteUrl":"https://nextcloud-lalala123.de/remote.php/dav/uploads/ncp/3394095104/00000000","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":479,"function":"emit","class":"Sabre\\Event\\EventEmitter","type":"->","args":["method:PUT",[{"absoluteUrl":"https://nextcloud-lalala123.de/remote.php/dav/uploads/ncp/3394095104/00000000","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":254,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"absoluteUrl":"https://nextcloud-lalala123.de/remote.php/dav/uploads/ncp/3394095104/00000000","__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":319,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/nextcloud/remote.php","line":165,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php","Line":229,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows) mirall/2.6.4stable-Win64 (build 20200303) (Nextcloud)","version":"18.0.1.3"}

@nachoparker
i have this in /media:

root@odroidn2:/media# ll
total 24
drwxr-xr-x  1 www-data root   12 Mar  8 19:33 myCloudDrive
drwxr-xr-x  3 www-data root 4096 Mar  8 20:02 myCloudDriveSD
lrwxrwxrwx  1 root     root   19 Mar  8 20:13 USBdrive -> /media/myCloudDrive
lrwxrwxrwx  1 root     root   21 Mar  8 20:13 USBdrive1 -> /media/myCloudDriveSD

root just popped up after the update, i changed the config php and renamed it to root_bak, seems to be a copy of myCloudDriveSD.

What is the location of youre data? Is that

  1. ‘datadirectory’ => ‘/media/myCloudDrive/ncdata’,
  2. ‘datadirectory’ => ‘/media/root/myCloudDrive/ncdata’,

If it is number two, than change de location of that in the config.php

If it is number two, than change de location of that in the config.php

Its number one, i already changed that. Before this the server was offline. Now its online again, but i can not upload anything.

The current config.php is listed in the post above.