PHP chmod() Permission error

I have the nextcloud docker running in pi4 and storing it’s data in an external ntfs drive.
I have already given all permission to write and read for all the folders inside of this folder.
However, it seems like nextcloud still have some issues when running it. What am I missing?

Error	PHP	chmod(): Operation not permitted at /var/www/html/lib/private/Log/File.php#86
Warning	no app in context	Invalid cliBasedCronUser data provided to provideInitialState by settings
Error	PHP	Trying to access array offset on value of type bool at /var/www/html/apps/settings/lib/Settings/Admin/Server.php#76


Which docker image are you using? AIO, LinuxServer, Nextcloud, something else?

Could you confirm those with ls -la or similar. Did you map them as docker volumes?

Try searching these errors against the forum and wider internet. Should turn up a bunch of info that could answer the issue for you. Tried searching part of this and found: cliBasedCronUser & Server.php error - #3 by werto165

Yea it seems like a common issue. I have been searching for few days, but unfortunately I can’t find an answer that I understand what to do. I’m using nextcloud’s docker image directly, and I did map my nextcloud/html folder to the docker.
Here is an image from portainer, where I setup my nextcloud as a stack:

Here is the ls -la result

To be more specific on what I don’t understand, here are two solutions might related to my problem:

usually you use ‘sudo -u www-data’ to run as user www-data (uid:33) and just sudo to run as root (uid:0)
Nextcloud Upgrade to 24.0.7 breaking tables - #4 by Vincent_Stans

sudo chown -R http:http /usr/share/webapps/nextcloud/config
sudo chmod 750 /usr/share/webapps/nextcloud/config
Chmod(): Operation not permitted at /usr/share/webapps/nextcloud/lib/private/Log/File.php#84 - #11 by mGurusamy

Both of them has some sort of hint saying I need to set the ownership correctly; however, the ownership of both of my problematic files are already set to 777. I even set the check_data_directory_permissions to false in config.php. My understanding is that anyone should be able to access it, but why can’t nextcloud?

Seeing another error now that might related to this:

The error will come out whenever I try to scroll through photos

Ok, so I gave up putting the data in my ntfs external drive, now the error is gone.
Originally I have everything on my external drive, including the html folder from nextcloud, and mariadb’s data folder with its backup folder. Now I only have mariadb’s back up folder in my external drive, and everything else in the ext4 main drive.
I guess Nextcloud is not very friendly with mounting things on ntfs drive. If I want to fix this issue in the future, I would probably research more on how they deal with ntfs drive in windows.
Leaving this thread for future users. GL

Are you sure you properly configured the ntfs drive on your server using ntfs-3g and fstab?

That filesystem is not natively supported in Linux, so definitely better to avoid if possible.

What would be the proper configuration nextcloud expect for mariadb? I mean I thought all read write permission (777) would take care of everything.
For experiment purpose, I moved mariadb to ntfs, and the error “could not create new folder” appears again.