Error in LOG: chmod(): No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#91

{“reqId”:“n5dZH7kjTaRIPnvMZki4”,“level”:3,“time”:“2021-05-03T21:19:34+02:00”,“remoteAddr”:“xxx.xxx.xxx.xxx”,“user”:“user”,“app”:“PHP”,“method”:“GET”,“url”:"/index.php/core/preview.png?file=Chiemgau%20Brandes%20Mai%202021/21-05-02%2011-17-20%201126.jpg&x=1024.0&y=1024.0&a=1&mode=cover",“message”:{“Exception”:“Error”,“Message”:“chmod(): No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#91”,“Code”:0,“Trace”:[{“function”:“onError”,“class”:“OC\Log\ErrorHandler”,“type”:"::",“args”:[2,“chmod(): No such file or directory”,"/var/www/nextcloud/lib/private/Files/Storage/Local.php",91,{“path”:“appdata_oc29jvsmqdsv/preview/4/d/7/9/6/6/8/114693”,“sourcePath”:"/var/nextcloud/data/appdata_oc29jvsmqdsv/preview/4/d/7/9/6/6/8/114693",“result”:false}]},{“file”:"/var/www/nextcloud/lib/private/Files/Storage/Local.php",“line”:91,“function”:“chmod”,“args”:["/var/nextcloud/data/appdata_oc29jvsmqdsv/preview/4/d/7/9/6/6/8/114693",493]},{“file”:"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php",“line”:85,“function”:“mkdir”,“class”:“OC\Files\Storage\Local”,“type”:"->",“args”:[“appdata_oc29jvsmqdsv/preview/4/d/7/9/6/6/8/114693”]},{“file”:"/var/www/nextcloud/lib/private/Files/View.php",“line”:1168,“function”:“mkdir”,“class”:“OC\Files\Storage\Wrapper\Wrapper”,“type”:"->",“args”:[“appdata_oc29jvsmqdsv/preview/4/d/7/9/6/6/8/114693”]},{“file”:"/var/www/nextcloud/lib/private/Files/View.php",“line”:272,“function”:“basicOperation”,“class”:“OC\Files\View”,“type”:"->",“args”:[“mkdir”,"/appdata_oc29jvsmqdsv/preview/4/d/7/9/6/6/8/114693",[“create”,“write”]]},{“file”:"/var/www/nextcloud/lib/private/Files/Node/Folder.php",“line”:175,“function”:“mkdir”,“class”:“OC\Files\View”,“type”:"->",“args”:["/appdata_oc29jvsmqdsv/preview/4/d/7/9/6/6/8/114693"]},{“file”:"/var/www/nextcloud/lib/private/Files/AppData/AppData.php",“line”:157,“function”:“newFolder”,“class”:“OC\Files\Node\Folder”,“type”:"->",“args”:[“4/d/7/9/6/6/8/114693”]},{“file”:"/var/www/nextcloud/lib/private/Preview/Storage/Root.php",“line”:75,“function”:“newFolder”,“class”:“OC\Files\AppData\AppData”,“type”:"->",“args”:[“4/d/7/9/6/6/8/114693”]},{“file”:"/var/www/nextcloud/lib/private/Preview/Generator.php",“line”:471,“function”:“newFolder”,“class”:“OC\Preview\Storage\Root”,“type”:"->",“args”:[“114693”]},{“file”:"/var/www/nextcloud/lib/private/Preview/Generator.php",“line”:132,“function”:“getPreviewFolder”,“class”:“OC\Preview\Generator”,“type”:"->",“args”:[{“class”:“OC\Files\Node\File”}]},{“file”:"/var/www/nextcloud/lib/private/Preview/Generator.php",“line”:109,“function”:“generatePreviews”,“class”:“OC\Preview\Generator”,“type”:"->",“args”:[{“class”:“OC\Files\Node\File”},[{“width”:1024,“height”:1024,“crop”:false,“mode”:“cover”}],“image/jpeg”]},{“file”:"/var/www/nextcloud/lib/private/PreviewManager.php",“line”:190,“function”:“getPreview”,“class”:“OC\Preview\Generator”,“type”:"->",“args”:[{“class”:“OC\Files\Node\File”},1024,1024,false,“cover”,null]},{“file”:"/var/www/nextcloud/core/Controller/PreviewController.php",“line”:170,“function”:“getPreview”,“class”:“OC\PreviewManager”,“type”:"->",“args”:[{“class”:“OC\Files\Node\File”},1024,1024,false,“cover”]},{“file”:"/var/www/nextcloud/core/Controller/PreviewController.php",“line”:107,“function”:“fetchPreview”,“class”:“OC\Core\Controller\PreviewController”,“type”:"->",“args”:[{“class”:“OC\Files\Node\File”},1024,1024,true,true,“cover”]},{“file”:"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",“line”:218,“function”:“getPreview”,“class”:“OC\Core\Controller\PreviewController”,“type”:"->",“args”:[“Chiemgau Brandes Mai 2021/21-05-02 11-17-20 1126.jpg”,1024,1024,true,true,“cover”]},{“file”:"/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",“line”:127,“function”:“executeController”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OC\Core\Controller\PreviewController”},“getPreview”]},{“file”:"/var/www/nextcloud/lib/private/AppFramework/App.php",“line”:157,“function”:“dispatch”,“class”:“OC\AppFramework\Http\Dispatcher”,“type”:"->",“args”:[{“class”:“OC\Core\Controller\PreviewController”},“getPreview”]},{“file”:"/var/www/nextcloud/lib/private/Route/Router.php",“line”:302,“function”:“main”,“class”:“OC\AppFramework\App”,“type”:"::",“args”:[“OC\Core\Controller\PreviewController”,“getPreview”,{“class”:“OC\AppFramework\DependencyInjection\DIContainer”},{"_route":“core.Preview.getPreview”}]},{“file”:"/var/www/nextcloud/lib/base.php",“line”:993,“function”:“match”,“class”:“OC\Route\Router”,“type”:"->",“args”:["/core/preview.png"]},{“file”:"/var/www/nextcloud/index.php",“line”:37,“function”:“handleRequest”,“class”:“OC”,“type”:"::",“args”:}],“File”:"/var/www/nextcloud/lib/private/Log/ErrorHandler.php",“Line”:92,“CustomMessage”:"–"},“userAgent”:“Mozilla/5.0 (iOS) Nextcloud-iOS/3.4.2”,“version”:“21.0.1.1”,“id”:“60905b8d3ef40”}

Nextcloud version (eg, 20.0.5): 21.0.1.1
Operating system and version (eg, Ubuntu 20.04): DEBIAN 10 (buster)
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.38 (Debian)
PHP version (eg, 7.4): 7.3

1 Like

I have the similar problem. Advises?

Error PHP Error: chmod(): No such file or directory at /usr/share/nginx/nextcloud/lib/private/Files/Storage/Local.php#91

<<closure>>

OC\Log\ErrorHandler::onError()

/usr/share/nginx/nextcloud/lib/private/Files/Storage/Local.php - line 91:

chmod()

/usr/share/nginx/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 85:

OC\Files\Storage\Local->mkdir()

/usr/share/nginx/nextcloud/apps/files_accesscontrol/lib/StorageWrapper.php - line 77:

OC\Files\Storage\Wrapper\Wrapper->mkdir()

/usr/share/nginx/nextcloud/lib/private/Files/View.php - line 1168:

OCA\FilesAccessControl\StorageWrapper->mkdir()

/usr/share/nginx/nextcloud/lib/private/Files/View.php - line 272:

OC\Files\View->basicOperation()

/usr/share/nginx/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 189:

OC\Files\View->mkdir()

/usr/share/nginx/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 1210:

OCA\DAV\Connector\Sabre\Directory->createDirectory()

/usr/share/nginx/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 560:

Sabre\DAV\Server->createCollection()

/usr/share/nginx/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:

Sabre\DAV\CorePlugin->httpMkcol()

/usr/share/nginx/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 472:

Sabre\DAV\Server->emit()

/usr/share/nginx/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 253:

Sabre\DAV\Server->invokeMethod()

/usr/share/nginx/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 321:

Sabre\DAV\Server->start()

/usr/share/nginx/nextcloud/apps/dav/lib/Server.php - line 332:

Sabre\DAV\Server->exec()

/usr/share/nginx/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:

OCA\DAV\Server->exec()

/usr/share/nginx/nextcloud/remote.php - line 167:

I was able to solve this for myself. The nextcloud linux user did not have permission to write to my external storage. I fixed it with this command in the linux terminal:
sudo chown nextcloud: /media/storage