Nextcloud update failure

Yeah honestly I dont get notifications when an upgrade is going to happen or at least I dont check often since the auto updates. I from time to will update apps in nextcloud, but since I am not timing it I am not certain what is the best practice. What is odd to me is that i have two users on here one as a overall admin and I was able to log in fine on that, but not on the one I primarily use.

Pushed an update with upgrade improvement (726). All updates are automatic so you should not do anything.

not sure what happened, but this update seems to have corrupted my Nextcloud instance. it’s still up and running and I can get to everything. But when I get into the files, directories are moved around and missing. almost like something got scrambled.

Is this correct?

snap run nextcloud.occ config:system:get datadirectory

If you list the directory shown above do you see your files?

ls -ls [datadirectory]

If you see them but not on nextcloud you can run this command:

snap run nextcloud.occ files:scan --all

And check again

the only difference in this update was the addition of this command as suggested by Nextcloud doc:

db:add-missing-primary-keys

snap run nextcloud.occ config:system:get datadirectory

/opt/disk/internal/nextcloud

snap run nextcloud.occ files:scan --all

An unhandled exception has been thrown:
Error: Invalid callback OCA\Files\Command\Scan::cancelOperation, cannot access protected method OCA\Files\Command\Scan::cancelOperation() in /snap/nextcloud/726/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:101
Stack trace:
#0 /snap/nextcloud/726/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1153): Doctrine\DBAL\Driver\PDO\Statement->execute()
#1 /snap/nextcloud/726/nextcloud/lib/private/DB/Connection.php(295): Doctrine\DBAL\Connection->executeStatement('UPDATE "oc_file...', Array, Array)
#2 /snap/nextcloud/726/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(354): OC\DB\Connection->executeStatement('UPDATE "oc_file...', Array, Array)
#3 /snap/nextcloud/726/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#4 /snap/nextcloud/726/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(326): OC\DB\QueryBuilder\QueryBuilder->execute()
#5 /snap/nextcloud/726/nextcloud/lib/private/Lock/DBLockingProvider.php(189): OC\DB\QueryBuilder\QueryBuilder->executeStatement()
#6 /snap/nextcloud/726/nextcloud/lib/private/Files/Storage/Common.php(798): OC\Lock\DBLockingProvider->releaseLock('files/215721961...', 1)
#7 /snap/nextcloud/726/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(618): OC\Files\Storage\Common->releaseLock('files/Joplin/92...', 1, Object(OC\Lock\DBLockingProvider))
#8 /snap/nextcloud/726/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php(618): OC\Files\Storage\Wrapper\Wrapper->releaseLock('files/Joplin/92...', 1, Object(OC\Lock\DBLockingProvider))
#9 /snap/nextcloud/726/nextcloud/lib/private/Files/Cache/Scanner.php(262): OC\Files\Storage\Wrapper\Wrapper->releaseLock('files/Joplin/92...', 1, Object(OC\Lock\DBLockingProvider))
#10 /snap/nextcloud/726/nextcloud/lib/private/Files/Cache/Scanner.php(457): OC\Files\Cache\Scanner->scanFile('files/Joplin/92...', 3, 1452550, false, true, Array)
#11 /snap/nextcloud/726/nextcloud/lib/private/Files/Cache/Scanner.php(397): OC\Files\Cache\Scanner->handleChildren('files/Joplin', true, 3, 1452550, true, 33015175)
#12 /snap/nextcloud/726/nextcloud/lib/private/Files/Cache/Scanner.php(400): OC\Files\Cache\Scanner->scanChildren('files/Joplin', true, 3, 1452550, true, -1)
#13 /snap/nextcloud/726/nextcloud/lib/private/Files/Cache/Scanner.php(400): OC\Files\Cache\Scanner->scanChildren('files', true, 3, 1452545, true, -1)
#14 /snap/nextcloud/726/nextcloud/lib/private/Files/Cache/Scanner.php(347): OC\Files\Cache\Scanner->scanChildren('', true, 3, 34, true, -1)
#15 /snap/nextcloud/726/nextcloud/lib/private/Files/Utils/Scanner.php(269): OC\Files\Cache\Scanner->scan('', true, 3)
#16 /snap/nextcloud/726/nextcloud/apps/files/lib/Command/Scan.php(164): OC\Files\Utils\Scanner->scan('/root', true, NULL)
#17 /snap/nextcloud/726/nextcloud/apps/files/lib/Command/Scan.php(219): OCA\Files\Command\Scan->scanFiles('root', '/root', false, Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)
#18 /snap/nextcloud/726/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /snap/nextcloud/726/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /snap/nextcloud/726/nextcloud/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /snap/nextcloud/726/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /snap/nextcloud/726/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /snap/nextcloud/726/nextcloud/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /snap/nextcloud/726/nextcloud/console.php(100): OC\Console\Application->run()
#25 /snap/nextcloud/726/nextcloud/occ(11): require_once('/snap/nextcloud...')

Are you normally using external disk or not?
Currently you are on internal?

no external, just a single internal 500gb ssd

it’s interesting, i have ~50gb of data but my nextcloud screen says this:
zero

can you run these

df -h
snap refresh nextcloud
snap run nextcloud.occ files:scan --all

df -h

Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           787M   81M  707M  11% /run
/dev/sda2       469G  111G  339G  25% /
tmpfs           3.9G   20K  3.9G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/loop2      189M  189M     0 100% /snap/users/272
/dev/loop4      127M  127M     0 100% /snap/plex/174
/dev/loop3      263M  263M     0 100% /snap/syncthing/103
/dev/loop1      120M  120M     0 100% /snap/platform/1944
/dev/loop0      405M  405M     0 100% /snap/calibre/73
/dev/loop5      189M  189M     0 100% /snap/users/262
/dev/loop7      408M  408M     0 100% /snap/calibre/83
/dev/loop9      129M  129M     0 100% /snap/plex/160
/dev/loop11     187M  187M     0 100% /snap/users/244
/dev/loop6       63M   63M     0 100% /snap/bitwarden/82
/dev/loop12     425M  425M     0 100% /snap/crowdsec/103
/dev/loop14      67M   67M     0 100% /snap/bitwarden/97
/dev/loop15      69M   69M     0 100% /snap/bitwarden/100
/dev/loop13     130M  130M     0 100% /snap/plex/170
/dev/loop16     103M  103M     0 100% /snap/files/158
/dev/loop18     402M  402M     0 100% /snap/nextcloud/720
/dev/loop19     120M  120M     0 100% /snap/platform/1951
/dev/loop8      402M  402M     0 100% /snap/nextcloud/726

snap refresh nextcloud

snap "nextcloud" has no updates available

snap run nextcloud.occ files:scan --all
same error as above

could you send logs please

i’ll send them later tonight. but i’ve got good backups and everything else on my device seems to be working fine, i’ll probably just uninstall/reinstall Nextcloud and restore the data. run that for a bit and see if this issues pops up again.

edit - uninstalled Nextcloud then reinstalled. must be something wrong with my system because all apps now are dead. i’ll flush everything and start over… project for this weekend sometime. but thanks Boris for the troubleshooting.

did a fresh setup, re-imaged the SSD, activated. installed file browser and users, all good. but Nextcloud won’t install. tried several times and rebooted. no luck. just sent logs.

The error shows:

Username is invalid because files already exist for this user

Few users reported this Nextcloud error but reimaged their devices before we could find what is the root cause, in their case fresh install fixed it.

I think it complains about user installer already has files on disk.
Could you run these commands?

snap run nextcloud.occ config:system:get datadirectory
ls -la /opt/disk/external/nextcloud

I think if there is an installer dir and it is not one of your users, you can remove it and install again:

rm -rf /opt/disk/external/nextcloud/installer

odd thing though, I did re-image and start from scratch so there shouldn’t be any usernames or nextcloud on the disk. just sent updated log.

is there a way to instal nextcloud from the command line?

Did you do what I suggested?
Can you show the output?

error: cannot find current revision for snap nextcloud: readlink /snap/nextcloud/current: no such file or directory
ls: cannot access '/opt/disk/external/nextcloud': No such file or directory

sorry you are on internal disk:

ls -la /data/nextcloud/installer

remove installer if it is there:

rm -rf /data/nextcloud/installer

that did it, back up and running.

Ok good we found it, let me fix it in the next update