Nextcloud – Error modifying certain files or folders: locked error



Yesterday I came across a problem in which I tried to modify (rename, delete, …) a folder and it returned an error.

Nextcloud logs (/var/www/nextcloud/data/nextcloud.log) showed the following:

"reqId":"Pf4KW9q1WDVe1YdmG0Mt","level":3,"time":"2019-09-10T16:36:53+00:00","remoteAddr":"63.223.129.127","user":"user1","app":"no app in context","method":"DELETE","url":"\/remote.php\/dav\/files\/user1\/ALBUMS\/New%20folder","message":{"Exception":"OCP\\Lock\\LockedException","Message":"\"files\/8010dab5adf49336ecdaf75a2008d5ab\" is locked","Code":0,"Trace":[{"file":"\/var\/www\/html\/nextcloud\/lib\/private\/Files\/Storage\/Common.php","line":779,"function":"changeLock","class":"OC\\Lock\\DBLockingProvider","type":"->","args":["files\/8010dab5adf49336ecdaf75a2008d5ab",2]},{"file":"\/var\/www\/html\/nextcloud\/lib\/private\/Files\/Storage\/Wrapper\/Wrapper.php","line":615,"function":"changeLock","class":"OC\\Files\\Storage\\Common","type":"->","args":["Nueva carpeta",2,{"__class__":"OC\\Lock\\DBLockingProvider"}

Solution

Enter maintenance mode

sudo -u www-data php7.2 occ maintenance:mode --on

Then, all entries of the table oc_file_locks must be deleted from the nextcloud database. Use either the command line client or the phpmyadmin client:

MariaDB [nextcloud]> delete from oc_file_locks where 1;

Turn off maintenance mode

sudo -u www-data php occ maintenance:mode --off

Now you should be able to modify your file or folder!

Leave a Reply

Your email address will not be published. Required fields are marked *