Hi,
the problem rose when we had a system crash and had to restore a couple of corrupted directories from backup. They were in Nexcloud data directory structures.
After moving files we wanted to trigger rescan.
It cannot be done with maintenance:mode --on, because “There are no commands defined in the “files” namespace.”
When running
sudo -u www-data php occ files:scan --all
Got
Path not found: /Administrator
Path not found: /User
for every user. Tried to solve it with
sudo -u www-data php occ files:scan --all --home-only
Ok, no such errors but at one user got (maybe not related):
Exception during scan: An exception occurred while executing a query: SQLSTATE[40P01]: Deadlock detected: 7 ERROR: deadlock detected
DETAIL: Process 120449 waits for ShareLock on transaction 12509447; blocked by process 120436.
Process 120436 waits for ShareLock on transaction 12509444; blocked by process 120449.
HINT: See server log for query details.
CONTEXT: while locking tuple (17699,101) in relation "oc_filecache"
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1814): Doctrine\DBAL\Driver\API\PostgreSQL\ExceptionConverter->convert()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1749): Doctrine\DBAL\Connection->handleDriverException()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1163): Doctrine\DBAL\Connection->convertExceptionDuringQuery()
#3 /var/www/nextcloud/lib/private/DB/Connection.php(295): Doctrine\DBAL\Connection->executeStatement()
#4 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(354): OC\DB\Connection->executeStatement()
#5 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/nextcloud/lib/private/Files/Cache/Cache.php(386): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(418): OC\Files\Cache\Cache->update()
#8 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(403): OC\Files\Cache\Scanner->scanChildren()
#9 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(347): OC\Files\Cache\Scanner->scanChildren()
#10 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(269): OC\Files\Cache\Scanner->scan()
#11 /var/www/nextcloud/apps/files/lib/Command/Scan.php(164): OC\Files\Utils\Scanner->scan()
#12 /var/www/nextcloud/apps/files/lib/Command/Scan.php(219): OCA\Files\Command\Scan->scanFiles()
#13 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\Files\Command\Scan->execute()
#14 /var/www/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()
#15 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()
#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#18 /var/www/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run()
#19 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#20 /var/www/nextcloud/occ(11): require_once('...')
#21 {main}
In ExceptionConverter.php line 91:
An exception occurred while executing a query: SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored u
ntil end of transaction block
In Exception.php line 30:
SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
In Statement.php line 101:
SQLSTATE[25P02]: In failed sql transaction: 7 ERROR: current transaction is aborted, commands ignored until end of transaction block
Tried to scan one user with:
sudo -u www-data php occ files:scan -p=/mnt/ncdata/userA userA
Ended with:
Unknown user 1 =
Eventually some, or maybe all files, were rescanned, but what is the proper way to act in such situations?
I’ve seen related [solved] 'Path not found' after migration to new Server and Files:scan --path=xxx sometimes could not find directorys
Nextcloud version (eg, 20.0.5): 27.0.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.2 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.52
PHP version (eg, 7.4): PHP 8.1.2