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.
- 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
- Choose the container with a string of digits that also displays “nextcloud” in the Containers*
- at the command prompt type “whoami”
- This will likely return “root” and this is the wrong user for us
- Type “su -l www-data -s /bin/bash”
- This will change you to the www-data user
- Verify by typing “whoami”
- Type “php /var/www/html/occ db:add-missing-indices”
And you are done!