TrueNAS Scale/Nextcloud Install Failure

I’m seriously scared of upgrading to the new version when it comes out with this new change from Kubernetes to Docker. I hope there’s a good migration plan in place!

Hi,
I had a similar error when trying to modify the installed nextcloud app from using the default “ixVolume (Dataset created automatically by the system)” directories to a custom “Host Path” directory.

error:
chmod: changing permissions of ‘/var/lib/postgresql/data’: Operation not permitted

I discovered that the permissions on the default directory was different than the permissions on the target directories. It even had the group for the pgData (postgres database directory) owned by a user that does not exist on my system, “docker”.
When I copied the files over, using the archive flag (-a), which retains the permissions on the directories and files being copied over, this worked.

I opened the Shell in “System Settings” and ran the following commands, some of which are specific to how I set up my hard drives and “Datasets”. These, you may need to change to reflect your datasets and directories.

#switch from the admin user to the root user, to be able to run subsequent commands
sudo -i

#change to the directory where I want all of the nextcloud stuff installed to.
cd /mnt/pool1/app/nextcloud

#change the permissions of this directory to be read/write/execute by all users, to eliminate permissions issues. For me, no other user will have shell access to this trueNas, so this is not a security concern for me.
chmod go+rwx *

#show a listing of the directories and default permissions on the default install
ls -al /mnt/pool1/ix-applications/releases/nextcloud/volumes/ix_volumes

#copy over the data while preserving permissions for all of the directories.
cp -ra /mnt/pool1/ix-applications/releases/nextcloud/volumes/ix_volumes/* .

I hope this helps someone else.

The one config that I still don’t understand, is the directory for:
Nextcloud data directory*: /var/www/html/data

I have no such directory when logging in as root, on the “System Settings” shell. It’s almost as this is a default placeholder directory, or a default that’s not used/not relevant for trueNas scale Dragonfish-24.04.2.3, or maybe something else that I don’t understand.

999:999 maps to netdata:docker on TrueNAS and different user:group names in the container, but as long as you set the ACL permissions for the IDs 999:999 both will be able to access the dataset. You can use the Enable ACL checkbox on the install wizard to add these IDs for the postgres host path.

So I changed the permissions as Moxy suggested and ensured all datasets were empty. I verified that /mnt/.ix-apps/app_mounts/nextcloud does not exist. I also tried changing the instance name. I’m still getting the same errors… any idea how to troubleshoot it?

Here are the errors I can see in the log:

2024/11/01 10:20:52] (ERROR) app_lifecycle.compose_action():56 - Failed 'up' action for 'nextcloud' app:  permissions Pulling

nextcloud Warning pull access denied for ix-nextcloud, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

cron Warning pull access denied for ix-nextcloud, repository does not exist or may require 'docker login': denied: requested access to the resource is denied

dependency failed to start: container ix-nextcloud-postgres-1 is unhealthy

Nextcloud and the web server are not aware they are running in a container, so the Nextcloud folders and files, including the data folder and its contents, need to be owned by www-data, regardless from where and how the storage is mounted.

To fix problems:

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

Postgress/DB also need fixing but different:

chown -R 999:999 /path/to/db/dataset

My nextcloud is now installed under EE 24.10 and running: