Occ no longer works

Steps to reproduce

  1. enter into directory owncloud /var/ww/owncloud
  2. call occ with this command: sudo -u www-data php occ
  3. Display error

Expected behaviour

When i run occ i have this error: An unhandled exception has been thrown:
OCP\AppFramework\QueryException: Could not resolve CardDavBackend! Class CardDavBackend does not exist in /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php:98
Stack trace:
#0 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(113): OC\AppFramework\Utility\SimpleContainer->resolve('CardDavBackend')
#1 /var/www/owncloud/apps/dav/appinfo/registercommand.php(36): OC\AppFramework\Utility\SimpleContainer->query('CardDavBackend')_
#2 /var/www/owncloud/lib/private/Console/Application.php(115): require('/var/www/ownclo...')
#3 /var/www/owncloud/console.php(105): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /var/www/owncloud/occ(11): requireonce('/var/www/ownclo...')_

Server configuration

Operating system: Ubuntu Server 16.04.3 LTS

Web server: Apache 2.4.18

Database: MySQL

PHP version: 7.0.22

ownCloud version: ownCloud 10.0.4 (stable)

Updated from an older ownCloud or fresh install: Updated from an older ownCloud

Where did you install ownCloud from: owncloud.org

Integrity Failder Link Gist: https://gist.github.com/riccardopirani/5477f0f657545937800648c51949b61a

The content of config/config.php: it's almost 15 gb

List of activated apps:
-- occ not work --
List of app enable Image: https://imgur.com/a/RcnJ8

Are you using external storage, if yes which one:smb

Are you using encryption: no

Client configuration

Browser: chrome

Operating system: windows

https://doc.owncloud.org/server/10.0/admin_manual/maintenance/upgrade.html read and follow the steps in order to update properly your ownCloud instance.

I'm pretty sure you've messed up with the update, that's why the integrity check is crying. Hopefully is something you can recover from, but be careful with what you're doing.

I can not control integrity because it does not work

well, how did you upgrade? Were you following the steps provided in the link @jvillafanez posted?

Are you serious? If yes: there seems to be something terribly wrong. That file should not be bigger than 1-2 kbytes....

Looks like you have inside your ownCloud-folder another complete ownCloud folder. Looks like there went something wrong with copying files.

I'm facing the same issue.
Yesterday I updated from 9.1.8 to 10.0.7 as described in the docs:
- backup database and owncloud software directory
- backup data directory (have it outside of software directory)
- delete old owncloud software directory
- extract new owncloud software to old location
- copy config.php from backup to extracted software directory
- switch on maintenance mode, occ upgrade.

The docs are not quite good about what to pay attention regarding switch to owncloud market, contacts and calender and so on...
but somehow I could manage to get owncloud running again. Calender and Contacts sync also work like expected.

Only issue I currently see is the above mentioned error when I run e.g. occ status

already tried to uninstall contacts and calendar and re-install it... but didn't help... still get the error when running occ status.

To me this looks like some sort still existing but outdated / old files of a previous installation / version, either on the filesystem or in some sort of cache of PHP, redis or similar.

I renamed the old owncloud directory and extracted the new version to the old location. So there can't be any old files from previous installation.

And when I execute occ from command line, where should there be a cache?!??

Maybe this is something you need to research? I think there could be all sort of caches involved like e.g. redis, memcached and similar.

And if i'm checking i'm checking my local ownCloud 10.0.7 installation i don't have a file like:

/var/www/owncloud/apps/dav/appinfo/registercommand.php

like @rikidevelop has posted in the initial description. I think this could be another example for having old files staying around on e.g the filesystem.

all the files mentioned in the error message exist in my installation:

~ > stat /path/to/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php /path/to/owncloud/apps/dav/appinfo/register_command.php /path/to/owncloud/lib/private/Console/Application.php /path/to/owncloud/console.php
  File: '/path/to/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php'
  Size: 4919            Blocks: 16         IO Block: 4096   regular file
Device: 803h/2051d      Inode: 53524611    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 2700/user)   Gid: ( 3691/user)
Access: 2018-03-20 21:51:04.151284895 +0100
Modify: 2018-03-20 23:38:35.494478066 +0100
Change: 2018-03-20 23:38:35.494478066 +0100
 Birth: -
  File: '/path/to/owncloud/apps/dav/appinfo/register_command.php'
  Size: 1607            Blocks: 8          IO Block: 4096   regular file
Device: 803h/2051d      Inode: 16694661    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 2700/user)   Gid: ( 3691/user)
Access: 2018-03-20 21:51:02.875284369 +0100
Modify: 2018-03-20 21:51:02.875284369 +0100
Change: 2018-03-20 21:51:02.875284369 +0100
 Birth: -
  File: '/path/to/owncloud/lib/private/Console/Application.php'
  Size: 5908            Blocks: 16         IO Block: 4096   regular file
Device: 803h/2051d      Inode: 4295853619  Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 2700/user)   Gid: ( 3691/user)
Access: 2018-03-20 21:51:04.159284898 +0100
Modify: 2018-03-20 23:38:35.086477901 +0100
Change: 2018-03-20 23:38:35.086477901 +0100
 Birth: -
  File: '/path/to/owncloud/console.php'
  Size: 4353            Blocks: 16         IO Block: 4096   regular file
Device: 803h/2051d      Inode: 1075021847  Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 2700/user)   Gid: ( 3691/user)
Access: 2018-03-20 21:51:01.015283604 +0100
Modify: 2018-03-20 23:38:22.918473000 +0100
Change: 2018-03-20 23:38:22.918473000 +0100
 Birth: -

I think the _ in filename register_command.php in the initial post of @rikidevelop maybe was removed by the forum software.

hm, did a little strace:

access("/path/to/owncloud/apps/dav/appinfo/register_command.php", F_OK) = 0
lstat("/path/to/owncloud/apps/dav/appinfo/register_command.php", {st_mode=S_IFREG|0644, st_size=1607, ...}) = 0
open("/path/to/owncloud/apps/dav/appinfo/register_command.php", O_RDONLY) = 7
fstat(7, {st_mode=S_IFREG|0644, st_size=1607, ...}) = 0
fstat(7, {st_mode=S_IFREG|0644, st_size=1607, ...}) = 0
fstat(7, {st_mode=S_IFREG|0644, st_size=1607, ...}) = 0
mmap(NULL, 1607, PROT_READ, MAP_SHARED, 7, 0) = 0x7fe68b3e9000
munmap(0x7fe68b3e9000, 1607)            = 0
close(7)                                = 0
access("/path/to/owncloud/lib/composer/composer/../pear/pear-core-minimal/src/CardDavBackend.php", F_OK) = -1 ENOENT (No such file or directory)
write(1, "An unhandled exception has been "..., 40An unhandled exception has been thrown:
) = 40
write(1, "OCP\\AppFramework\\QueryException:"..., 921OCP\AppFramework\QueryException: Could not resolve CardDavBackend! Class CardDavBackend does not exist in /path/to/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php:98
Stack trace:
#0 /path/to/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(113): OC\AppFramework\Utility\SimpleContainer->resolve('CardDavBackend')
#1 /path/to/owncloud/apps/dav/appinfo/register_command.php(36): OC\AppFramework\Utility\SimpleContainer->query('CardDavBackend')
#2 /path/to/owncloud/lib/private/Console/Application.php(114): require('/manpfmdc/www.p...')
#3 /path/to/owncloud/console.php(105): OC\Console\Application->loadCommands(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#4 /path/to/owncloud/occ(11): require_once('/manpfmdc/www.p...')
#5 {main}) = 921
close(2)                                = 0

after it tries to open /path/to/owncloud/lib/composer/pear/pear-core-minimal/src/CardDavBackend.php it throws the exception...

And i think at least for the register_command.php this is the source of your problem. If i'm downloading https://download.owncloud.org/community/owncloud-10.0.7.tar.bz2 and check the archive or check my local installation of ownCloud 10.0.7 i can't find a register_command.php in apps/dav/appinfo/

1 Like

Thanks for you reply.
It animated me to try it once again with a completely fresh owncloud directory.

And even I already tried that approach, now it works.

So: thanks a lot for your patience :slight_smile:

1 Like