From a different post I found the steps below which says it will fix the problem. Can anybody in the community please help me modify Step #4 so it applies to my specific problem which is a Missing index Fs_parent in table oc_filecache.
Step #1
Open super user bash
sudo bash
Step # 2
Go to the NextCloud folder:
cd /var/www/nextcloud
Step #3
Run the following command:
sudo -u www-data php occ db:add-missing-indices
Step #4
And finally the prompt should show something like this:
Check indices of the share table.
Adding additional parent index to the share table, this can take some time…
Share table updated successfully.
Adding additional mtime index to the filecache table, this can take some time…
Filecache table updated successfully.
My error is a Fs_parent in table oc_filecache error. I am just asking if the 4 steps are the correct steps to apply for fixing a Fs_parent in table oc_filecache type error. Is there another fix alternative that does not involve using bash? Any advice welcome.
My question to you is as follows. Is it necessary to run a chmod command before running your single line command? And if yes, should I run a 777 or a 750 version of the chmod command? I do not have strong Ubuntu command line experience so I am not 100% certain if the “www-data” user needs to be changed to my “slipstream” user account before executing your single line command. Any advice will be greatly appreciated. Thank you.
slipstream@myserver:~$ /var/www/nextcloud/ chmod 777 occ
Or should the version below be used? slipstream@myserver:~$ /var/www/nextcloud/ chmod 750 occ
No, and 777 is a bad idea. All files and folders under /var/www should exclusively be owned by the user www-data. The permissions should be 640 for files and 750 for folders.
bb77, thank you for your help. You were correct. No need to use the chown command before executing the one line command for the purpose of changing the OCC file permission. However, I did get the error shown below after running your command for the first time:
An unhandled exception has been thrown:
OCP\HintException: [0]: Memcache \OC\Memcache\APCu not available for local cache (Is the matching PHP module installed and enabled?)
But after some Googling I learned the fix was to add an “apc.enable_cli = 1” line at the bottom end of the PHP.ini file located at /etc/php/8.1/cli folder location. After that I ran the command below: sudo systemctl restart apache2
Below is the result I got after executing your command line a second time:
slipstream@myserver:/var/www/nextcloud$ sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
Check indices of the share table.
Check indices of the filecache table.
Adding additional parent index to the filecache table, this can take some time...
Filecache table updated successfully.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Check indices of the schedulingobjects table.
Check indices of the oc_properties table.
Check indices of the oc_jobs table.
Check indices of the oc_direct_edit table.
Check indices of the oc_preferences table.
Check indices of the oc_mounts table.
I then opened my Nextcloud v26.0.1 and I was happy to see my database missing indices error no longer appears as a problem. Again thanks for your help.
Lastly, do you have any idea why the change I had to make to my PHP.ini file was necessary in the first place? Why is the “apc.enable_cli = 1” line of code missing in the Php.ini file and has to be manually typed in as opposed to just removing a comment character? I am just curious to know so I could learn what is the logic behind leaving “apc.enable_cli = 1” out of the PHP.ini configuration entirely because without it Nextcloud seems to be handicapped.
For all who read along here. I do not Ubuntu. But it is possible to use the above command directly from slipstream and not from root because in Ubuntu there is no security sudo restriction. The "admin" e.g. slipstream can execute all sudo commands inclunding change to www-data (sudo -u www-data)
Yes, this is definitely possible, in both Ubuntu and in Debian. The default configuration of /etc/sudoers in both systems is identical and allows any member of the sudo group to execute any command:
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
I also ran into this issue after upgrading to 26.0.1, however, I am using nextcloud as a docker with unraid. I would be greatly appreciate it if there was someone who could advise how to enter the command using in Unraid Terminal.
docker exec -it --user www-data nextcloud_app.1.i3ith380nzphfyfze67r7mogs php --define apc.enable_cli=1 /var/www/html/occ db:add-missing-indices
Check indices of the share table.
Check indices of the filecache table.
Adding additional parent index to the filecache table, this can take some time...
Filecache table updated successfully.
Check indices of the twofactor_providers table.
Check indices of the login_flow_v2 table.
Check indices of the whats_new table.
Check indices of the cards table.
Check indices of the cards_properties table.
Check indices of the calendarobjects_props table.
Check indices of the schedulingobjects table.
Check indices of the oc_properties table.
Check indices of the oc_jobs table.
Check indices of the oc_direct_edit table.
Check indices of the oc_preferences table.
Check indices of the oc_mounts table.
For anyone ending up here and is running Nextcloud from linuxserver.io the command is: docker exec -it nextcloud /bin/bash to get to bash in the container and then occ db:add-missing-indices