Nextcloud Docker: Locked files prevent scanning


I hope I chose the right category. I have nc up in a docker container. I can modify every folder from web.
However, I made the mistake of manually moving files to the database and then scanning for new files. This apparently bricked my nc. I cannot rescan because there are 10 locked files.
when I run
sudo docker exec --user www-data nc php occ files:scan steve

I get:
Starting scan for user 1 out of 1 (steve) Exception during scan: "files/11895d4ed06904a44032005f73b4d1c6"("home::steve::scanner::") is locked #0 /var/www/html/lib/private/Files/Storage/Common.php(752): OC\Lock\DBLockingProvider->acquireLock('files/11895d4ed...', 2, 'home::steve::sc...') #1 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(592): OC\Files\Storage\Common->acquireLock('scanner::', 2, Object(OC\Lock\DBLockingProvider)) #2 /var/www/html/lib/private/Files/Cache/Scanner.php(334): OC\Files\Storage\Wrapper\Wrapper->acquireLock('scanner::', 2, Object(OC\Lock\DBLockingProvider)) #3 /var/www/html/lib/private/Files/Utils/Scanner.php(260): OC\Files\Cache\Scanner->scan('', true, 3) #4 /var/www/html/apps/files/lib/Command/Scan.php(158): OC\Files\Utils\Scanner->scan('/steve', true, NULL) #5 /var/www/html/apps/files/lib/Command/Scan.php(214): OCA\Files\Command\Scan->scanFiles('steve', '/steve', Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false) #6 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #7 /var/www/html/core/Command/Base.php(169): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #8 /var/www/html/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /var/www/html/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #12 /var/www/html/console.php(100): OC\Console\Application->run() #13 /var/www/html/occ(11): require_once('/var/www/html/c...') #14 {main} +---------+-------+--------------+ | Folders | Files | Elapsed time | +---------+-------+--------------+ | 0 | 0 | 00:00:00 | +---------+-------+--------------+

I also don’t understand the errors, as they are no files, but rather php commands or configs (??)

So I found this thread File is locked - how to unlock and tried to follow these steps. However I don’t have the knowledge to understand and follow the steps.
I tried to:

  • sudo docker exec --user www-data nc php occ files:cleanup

  • Empty table oc_file_locks: Use tools such as phpmyadmin or connect directly to your database and run (the default table prefix is oc_, this prefix can be different or even empty):
    DELETE FROM oc_file_locks WHERE 1
    I could not find the file oc_file_locks , neither did I understand how phpmyadmin can be acessed.

  • I also tried to use the mysql command, but I could not find any installed related command in my container.

Thanks to anyone who bothers reading!

1 Like

Okey the problem resolved itself. I think the problem stemmed from syncing with the windows Desktop client and killing the process or something similiar.
I used the client on windows and let it sync for today, which took quite some time and I think the file locks resolved once it retried syncing.
Again, I have no clue whatsoever.

1 Like