Nextcloud Data Folder Invalid Permissions Setup

Nextcloud version: 24.0.1
Operating system and version: Ubuntu 22.04.2 LTS
Apache or nginx version: Apache 2.4.52-1ubuntu4.5
PHP version: PHP 8.1+92ubuntu1

The issue you are facing:
I was reinstalling nextcloud from scratch on an updated Ubuntu VM on my Proxmox server. My problem is that my folder I use for /data is hosted by a FreeNAS server and is an NFS share. When I completed the installation and set up the webserver I saw the following error in the admin panel:

It was not possible to execute the cron job via CLI. The following technical errors have appeared:
Your data directory is invalid. Ensure there is a file called “.ocdata” in the root of the data directory.
Your data directory is not writable. Permissions can usually be fixed by giving the web server write access to the root directory. See Installation wizard — Nextcloud latest Administration Manual latest documentation.

So I went to the VM and saw that the ownership was as follows:
drwxrwx— 8 nobody nogroup 14 May 19 00:25 data

So when I tried to sudo chown www-user for the user and group of the folder I got the following error but recursively for every file inside of /data:
chown: changing ownership of ‘data’: Invalid argument
Using the ID command on the Ubuntu VM shows:
uid=33(www-data) gid=33(www-data) groups=33(www-data)

And on FreeNAS the /data folder and id information is:
drwxrwx— 8 www-data www-data 14 May 18 17:25 data
uid=33(www-data) gid=33(www-data) groups=33(www-data)

My fstab mount looks like: /var/www/html/nextcloud/data nfs auto,nofail,noatime,nolock,intr,tcp,actimeo=1800 0 0

And both the Ubuntu NFS VM client and the FreeNAS NFS server are both on NFSv4

I can also use the following command no problem and have it create the file successfully.
sudo -u www-data touch data/test.txt

I am still new to a lot of this stuff so I have 50 tabs open trying to find tid bits to get this one issue to resolve so that it is online before I even begin to start on the original issue I had with the http polling url.

Is this the first time you’ve seen this error?: Yes

Steps to replicate it:

  1. Replicating it is just trying to unmount and remount the drive
  2. Or trying to change permissions just to keep getting the long list of invalid argument for every file in data
  3. Recreated a new VM but the permissions error is present on the new VM before I even hit nextclouds installation steps, so I am just missing some basic understanding of the NFS system that is preventing me from getting nextcloud to function.

I left out all of the extra logs as they do not provide much extra information outside of this. Nextcloud is running happily except for the fact that it cant write into the /data folder so if I can fix that I should be good to go back to the original error hunting I was on. I can add any additional content needed on request but please be specific on where i can find it or how to obtain it if you need something extra.

sudo chown www-data:www-data /var/www/html/nextcloud/data

Using that command or the -R version always gets me the Invalid Argument error pasted below or above, it just will not let me give permission of the shared drive to the client VM this is running on despite the uid and gid’s all matching.

chown: changing ownership of ‘/var/www/html/nextcloud/data’: Invalid argument

I found the option in FreeNAS for enabling the NFS3 scheme for IDmapping and once I enabled that it removed the UID and GID mapping requirements. So I was able to then run the chown commands once I unmounted and remounted the data folder. So checking the option in the NFS service on FreeNAS for “NFSv3 Ownership Model” allowed me to ignore the idmapping and start applying my own permissions client side.

1 Like