Missing Index Error after Installing Nextcloud 26.01 update

I am running the following:

Nextcloud 26.0.1 on Ubuntu Server 22.04 OS.
Apache2 and PHP 8.1.
PC = ASUS PN51-E1-BB7000XTD1
CPU = AMD Ryzen 7 5700U Mobile Processor, 1.8 GHz (12M Cache)
LAN = Realtek RTL8125B-CG
RAM = 64GB DDR4 3200
Secondary Data SSD Drive = 8TB
Boot Drive = 500GB NVME Samsung 980

I upgraded from Nextcloud 26.00 to 26.01 and now I have a Missing index “fs_parent” in table “oc_filecache” error shown below:

Before installation I got the./occ upgrade message shown below:

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.

Any advice well be welcomed.

I don’t see that there is anything to change in step 4. Step 4 is you’re done.

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.

Not exactly like that, at least not on Ubuntu.

Step 1 would be sudo -i or su -i , in order to become root.

But you don’t need the first two steps, you can use a single command instead:

sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices

Step 4 would be the output you should get, after you entered the command.

Nope. But I recommend to get familiar with it, at least a little. Makes your life much easier when managing your own server. :slight_smile:

bb7, thank you for your post. I hope you can answer a followup question I have before I run your single line command shown below:

sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices

I have run the command below to understand what is the permission landscape of my Nextrcloud OCC file:

slipstream@myserver:~$ /var/www/nextcloud$ ls -l

Below is the result I got and I see the Owner of my Nextcloud OCC file is a user named “www-data”.

-rw-r--r-- 1 www-data www-data 283 Apr 25 01:43 occ

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.

This is how my nextcloud folder looks like:

drwxr-x--- 14 www-data www-data  4096 Apr 24 17:43 .
drwxr-x---  4 www-data www-data  4096 Apr  7 17:42 ..
drwxr-x--- 45 www-data www-data  4096 Apr 20 10:54 3rdparty
drwxr-x--- 63 www-data www-data  4096 Apr 22 10:32 apps
-rw-r-----  1 www-data www-data 19327 Apr 19 15:38 AUTHORS
drwxr-x---  2 www-data www-data  4096 Apr 24 16:19 config
-rw-r-----  1 www-data www-data  4095 Apr 19 15:38 console.php
-rw-r-----  1 www-data www-data 34520 Apr 19 15:38 COPYING
drwxr-x--- 24 www-data www-data  4096 Apr 20 10:54 core
-rw-r-----  1 www-data www-data  6317 Apr 19 15:38 cron.php
drwxr-x---  2 www-data www-data 16384 Apr 20 10:54 dist
-rw-r-----  1 www-data www-data  4426 Apr 20 10:54 .htaccess
-rw-r-----  1 www-data www-data   156 Apr 19 15:38 index.html
-rw-r-----  1 www-data www-data  3456 Apr 19 15:38 index.php
drwxr-x---  6 www-data www-data  4096 Apr 20 10:54 lib
-rw-r-----  1 www-data www-data   283 Apr 19 15:38 occ
drwxr-x---  2 www-data www-data  4096 Apr 20 10:54 ocm-provider
drwxr-x---  2 www-data www-data  4096 Apr 20 10:54 ocs
drwxr-x---  2 www-data www-data  4096 Apr 20 10:54 ocs-provider
-rw-r-----  1 www-data www-data  3187 Apr 19 15:38 public.php
-rw-r-----  1 www-data www-data  5597 Apr 19 15:38 remote.php
drwxr-x---  4 www-data www-data  4096 Apr 20 10:54 resources
-rw-r-----  1 www-data www-data    26 Apr 19 15:38 robots.txt
-rw-r-----  1 www-data www-data  2452 Apr 19 15:38 status.php
drwxr-x---  3 www-data www-data  4096 Apr 20 10:54 themes
drwxr-x---  2 www-data www-data  4096 Apr 20 10:54 updater
-rw-r-----  1 www-data www-data   101 Apr 19 15:38 .user.ini
-rw-r-----  1 www-data www-data   383 Apr 19 15:42 version.php

You can run the following commands in order to get the correct owenership and permissions:

chown -R www-data:www-data /var/www/nextcloud
find /var/www/nextcloud/ -type d -exec chmod 750 {} \;
find /var/www/nextcloud/ -type f -exec chmod 640 {} \;

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.

slipstream@myserver:/var/www/nextcloud$ sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices

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
1 Like

sudo -u www-data php --define apc.enable_cli=1 /var/www/html/nextcloud/occ db:add-missing-indices

:wink:

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.

sudo -u www-data php --define apc.enable_cli=1 /var/www/html/nextcloud/occ db:add-missing-indices

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