OCC Completely Missing

I’ve been using NC for several years now very reliably. When upgrades occur, I occassionally do encounter the “occ db:add-missing-indices” error and have used the occ command on those occassions to fix the problem (and typically, yes, I do have to chmod the occ file in order for the command to work). With one of the recent updates, I again encountered the need to fix the missing indices but the occ file is now totally missing (it is typically located in the …\www\nextcloud\ folder (along with a small handfull of other files and folders). Now there are just the 3 typical folders but no files. I have noticed in the past that, during an update, a backup of this directory - and several others - is created and the system seems to keep the past 5 or 6 backups before deleting older ones. But now that backup directory is totally nonexistent, so I’m not sure if the occ command and/or the backups have just been relocated elsewhere or if there is some other problem going on.

If it helps, I am running NC as a docker in the UNRAID OS.


Which Docker image are you using?

Thanks for responding. I am running linuxserver’s Repository docker.

I think you must not chmod occ because it is not really executed. php is executed.

sudo -u www-data php occ db:add-missing-indices
(not docker version, docker differs)


You can find here some examples to execute php occ … in docker.

You can find the file occ e.g. with:

find /path/to -name occ

Yes it is correct. You can find big directorys with ncdu. Maybe you find your backups. Please test your backup with restore from time to time. Nextcloud does not backup user files. Make your own backup from Nextcloud installation, Nextcloud configuration, Nextcloud database and user data. I think you can use docker features.

LinuxServer.io has their own update approach and I believe aliases occ somehow. The specifics escape me. You might check their docs and dedicated forum.

You did say something else though that makes me wonder if you’re updating in an unsupported way. Their current update process is 100% based on updating the docker image (via docker compose pull). Which is fairly typical for Docker environments.

Are you updating in some other way (such as by trying to run the Nextcloud Updater)? That might explain some of the challenges you’re running into. AFAIK Linuxserver.io doesn’t even include the standard Updater in their images these days.

Thanks for the complete and thorough reply. Agree that occ is not an executable, but for php to be able to access it, the user (“www-data” in your case and “abc” in mine) must have access to it. I’m not sure what the access settings are by default, but it certainly isn’t -rwxrwxrwx, so running the chmod is almost always typcial in my case.

If you are familiar with Spaceinvader One’s Youtube channel, you might want to look at “How to Fix Various Nextcloud Errors” (https://www.youtube.com/watch?v=ZQAzJ7znNFM&t=206s) starting at the 2:17 index which shows the typical steps that I usually go through to clear various occ related errors. The files that he lists at the 2:47 point are what I typically see, but currently I only see 3 folders and no files (including occ).

Using the find command that you suggested returned nothing.

I have used backup and restore from time to time – though it has been quite a while since I have done so since the normal updates have been very reliable in the recent past. Yes, I am aware that the backup only addresses the actual NC application files and directories and not the user related directories/files so I do use other backup utilities to handle those tasks.

Thanks again for following up.

Yes, in the past I would use the incorporated updater (as I recall, it was located in the administration settings tab inside NC) when noting the current running version and highlighting that a new version was available with a link to start the update – vis the docker updater used by most other dockers. However, I did notice a version or two ago, that the admin settings screen changed a bit and that by using the usual docker update method now appears to update NC. So (hopefully) I’m doing this correctly.