解决Nextcloud / Owncloud 无法删除目录(或文件)

2018年04月29日 运维 暂无评论 阅读 57 次

1. 现象

删除目录或文件时提示:

无法删除文件 “***”

Error deleting file "***"

2. 解决方法

查看数据目录下nextcloud.log,可能有三种情况:

情况A

{"reqId":"0DijSqEkfOg2iyh9VD8J","remoteAddr":"xx.xx.xx.xx","app":"webdav","message":"Exception: {\"Message\":\"HTTP\\\/1.1 423 \\\"path\\\/file.extension\\\" is locked\",\"Exception\":\"OCA\\\\DAV\\\\Connector\\\\Sabre\\\\Exception\\\\FileLocked\",\"Code\":0,\"Trace\":\"#0

此时是因为文件或目录被锁,可按以下操作暂时解决问题:本文来自https://www.cmdgy.com

1)进入维护模式

php /path/to/nextcloud/web/occ maintenance:mode --on

2)使用mysql命令行工具,在owncloud/nextcloud所在数据库中执行

DELETE FROM oc_file_locks WHERE 1

3)退出维护模式

php /path/to/nextcloud/web/occ maintenance:mode --off

4)确保cron正常运行。

情况B

{"reqId":"***","level":3,"time":"2018-04-28T16:19:53+00:00","remoteAddr":"127.0.0.1","user":"***","app":"PHP","method":"DELETE","url":"\/remote.php\/webdav\***","message":"unlink(\/mnt\/***): Permission denied at ***/lib\/private\/Files\/Storage\/Local.php#112","userAgent":"Mozilla\/5.0 ,"manuscript from cmdgy.com, version":"13.0.1.1"}

此时待删除的①文件、②目录、③目录中有文件 对于php进程无写入权限。

使用chown -R修复数据目录的权限解决。

情况C

{"reqId":"***","level":3,"time":"2018-04-28T16:26:32+00:00","remoteAddr":"127.0.0.1","user":"***","app":"PHP","method":"DELETE","url":"\/remote.php\/webdav\***","message":"rename(): The first argument to copy() function cannot be a directory at ***/lib\/private\/Files\/Storage\/Local.php#270","userAgent":"Mozilla\/5.0 manuscript from cmdgy.com ","version":"13.0.1.1"}

{"reqId":"***","level":3,"time":"2018-04-28T16:26:32+00:00","remoteAddr":"127.0.0.1","user":"***","app":"PHP","method":"DELETE","url":"\/remote.php\/webdav\***","message":"rename(***files_trashbin\/files\/***): Invalid cross-device link at \/***\/lib\/private\/Files\/Storage\/Local.php#270","userAgent":"Mozilla\/5.0 manuscript from cmdgy.com","version":"13.0.1.1"}

此时需检查文件目录是否通过mount -bind方式挂载。

cat /etc/fstab | grep bind

如是,将导致nextcloud/owncloud的回收站机制失效。此时网页端和客户端均有删除失败提示,但实际上目录已经删除。为恢复回收站机制,需要取消mount -bind方式挂载目录。

给我留言

您必须 登录 才能发表留言!

站点定制:GY TECH. 网站设计:Ality
Copyright © 桂圆 TECH. 保留所有权利.  
耗时0.326秒执行了29次数据库检索
此破站已苟活1585天1小时25分28秒!

用户登录