I’m perplexed over this configuration error where NextCloud’s initial configuration cannot write to the defined data directory. I’ve checked ownership and permissions on the directory to be correctly assigned to the “apache” user. I can even touch/create a file on the mount from the CLI with no issue.
What is NC doing to validate the ability to create/write to the directory?
The solution was to just comment out is_writable() routines in lib/legacy/OC_Util.php and lib/Console/Application.php routines. Also would need to include lib/private/Setup.php. The bug on is_writable must still be prevalent in PHP 8.2. Also saw this as well: Write errors for nfs mount
The NC version installed must be the latest – version 27. Setup doesn’t reveal which version is installed.
Thanks for your reply. The NFS server doesn’t care who the user is as long as the user is defined on the NFS client (in this case the NC server). What is stored on the filesystem is the related ID number of the user. The NSS is relied upon to resolve the alpha name to ID number. If that NFS filesystem is mounted on another NFS client with another name associated to that ID number, the name will resolve to that name. As illustrated above, the “apache” user is able write to the NFS filesystem.
The problem is with PHP 7.x through 8.2 where is_writable() function has a bug related to NFS filesystems. What I’ve seen as a fix is to just comment out the validation routines using is_writable(). I’m doing that on the Setup.php but will look to implement a workaround (possibly just using fopen() and unlink() on a temporary file which supposedly works). I’ll have to setup a test instance to work out a solution and effectively test it. It will be slow as I’m not that proficient in PHP programming This is a good learning experience, though this bug should have been resolved by either PHP and/or NC/OC.
Please help me to understand. PHP would have to depend on the OS/filesystem semantics which would be the same whether local EXT or network based NFS for the way it is presented by the OS to the application. The only exception would be a timeout, but this mount is hard mounted and shouldn’t be an issue.
If fopen(), fwrite() and fclose() would work, then is_writable() isn’t doing its job to correctly to stat the filesystem, thus the longtime bug.