TrueNAS Scale/Nextcloud Install Failure

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.

1 Like

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:

Hi there, I’m facing an issue when installing the nextcloud on my Truenas Scale, when installing, it stops at the app.create at 60% in the process of installation. This is the error code that it shows:

Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 509, in run
await self.future
File “/usr/lib/python3/dist-packages/middlewared/job.py”, line 556, in __run_body
rv = await self.middleware.run_in_thread(self.method, *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 1367, in run_in_thread
return await self.run_in_executor(io_thread_pool_executor, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/main.py”, line 1364, in run_in_executor
return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/concurrent/futures/thread.py”, line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/service/crud_service.py”, line 268, in nf
rv = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/schema/processor.py”, line 55, in nf
res = f(*args, **kwargs)
^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/schema/processor.py”, line 183, in nf
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/crud.py”, line 203, in do_create
return self.create_internal(job, app_name, version, data[‘values’], complete_app_details)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/crud.py”, line 248, in create_internal
raise e from None
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/crud.py”, line 241, in create_internal
compose_action(app_name, version, ‘up’, force_recreate=True, remove_orphans=True)
File “/usr/lib/python3/dist-packages/middlewared/plugins/apps/compose_utils.py”, line 57, in compose_action
raise CallError(
middlewared.service_exception.CallError: [EFAULT] Failed ‘up’ action for ‘nextcloud’ app, please check /var/log/app_lifecycle.log for more details

Help me out…

These are my configuration:
HP Z230 Workstation + i7 4790 + 32GB RAM DDR3 1333Hz
Truenas Scale, Version : ElectricEel-24.10.1

Hi guys, is there a definitive solution to this bug? @Moxy’s fix above (namely changing permissions for the postgres and html datasets to www-data) doesn’t appear to work for me :slightly_frowning_face:

Hello there, is there a procedure on how to install Nextcloud properly on host path instead of ix volume ?
I cannot install the app the first time, the folders are not created so I have no permissions to fix.
Thanks for you help

I f-ed around with trying to set permissions and stuff for hours. Following this and that guide, asking chatgpt to no avail.
Then i found a little checkmark under where I set the three host paths, called Set Automatic Permission, and voila! It worked first try…

1 Like

Just a quick note on the Set Automatic Permissions toggle. I believe it may apply only to the Postgres Host Path. If you toggle Enable ACL on Postgres Data Storage, the Set Automatic Permissions disappears, but if you enable it on any of the other Storage Host Paths it does not.

You just saved me a few hours for sure