Truenas Scale Fix Nextcloud Database Missing Indices

I have been running Nextcloud for years and absolutely love it. Recently, I decided to ditch my standalone instance in favor of the IX app for TrueNAS Scale. After having run it for some time I finally got annoyed enough with some of the warnings that were showing up in “Security & setup warnings.” One of these issues is that Nextcloud constantly told me that the database was missing indices.

Of course, I hit the Google and found a ton of solutions, but none of them worked. They all had instructions to use sudo to change user to www-data but sudo isn’t a recognized command inside the container shell. After digging around for a couple of hours, I finally created a list of instructions that would solve the missing indices issue.

  1. Log into the shell of your container from TrueNAS Scale by clicking on the app from the Apps page and looking for the shell icon
  2. Choose the container with a string of digits that also displays “nextcloud” in the Containers*
  3. at the command prompt type “whoami”
    • This will likely return “root” and this is the wrong user for us
  4. Type “su -l www-data -s /bin/bash”
    • This will change you to the www-data user
    • Verify by typing “whoami”
  5. Type “php /var/www/html/occ db:add-missing-indices”

And you are done!

About Joe D

I have always had a passion for everything computing. In early 2000, I decided to take my passion to the web. Thus, C.O.D. was born. Through the years we have made many great friends at C.O.D. and hope to continue our journey for years to come.

Check Also

Build Your Own NAS 2015 Parts List

In 2013, we published an article on building your own NAS for an affordable storage …

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.