Steps to reproduce
- download nextcloud server archive, extract all the files into the document root directory of Apache2
- mount external NFS to
datadir
- visit the Nextcloud webpage. In the setup process, enter
datadir into the Data folder section.
- Click
Finish setup, then it prompt 'Can't create or write into the data directory datadir'
Server configuration
Operating system: Ubuntu 18.04
Web server: Apache2
Database: Mysql 5.7
PHP version: 7.2
Nextcloud version: (see Nextcloud admin page) 16.0.1
Updated from an older Nextcloud/ownCloud or fresh install: fresh install
Where did you install Nextcloud from: download the archive from 'https://nextcloud.com/install/#instructions-server'
Troubleshooting
This error occurs because of line 302~304 of /lib/private/Setup.php. In the function install, it will validate the data directory. However, there are some bugs of the function is_writable facing NFS mounts.
In /lib/private/legacy/util.php, about line 793, there is a comment that is_writable doesn't work for NFS mounts, so try to write a file and check if it exists. So I think the function is_writable should not be used in this project. Or maybe we can write a new function in this project to check whether a directory is writable or not by trying to write a file.
Now I fix it by commenting line 302~304 of Setup.php. However, the function is_writable is called 19 times in 9 files:
- /lib/base.php
- /lib/private/Files/Storage/Local.php
- /lib/private/IntegrityCheck/Checker.php
- /lib/private/IntegrityCheck/Helpers/FileAccessHelper.php
- /lib/private/legacy/image.php
- /lib/private/legacy/util.php
- /lib/private/Log/File.php
- /lib/private/Setup.php
- /lib/private/TempManager.php
I'm not sure if there will be some other bugs because of the usage of this function. I think we can consider replacing all the is_writable in these files to our own writability check function.
Steps to reproduce
datadirdatadirinto theData foldersection.Finish setup, then it prompt 'Can't create or write into the data directory datadir'Server configuration
Operating system: Ubuntu 18.04
Web server: Apache2
Database: Mysql 5.7
PHP version: 7.2
Nextcloud version: (see Nextcloud admin page) 16.0.1
Updated from an older Nextcloud/ownCloud or fresh install: fresh install
Where did you install Nextcloud from: download the archive from 'https://nextcloud.com/install/#instructions-server'
Troubleshooting
This error occurs because of line 302~304 of /lib/private/Setup.php. In the function
install, it will validate the data directory. However, there are some bugs of the functionis_writablefacing NFS mounts.In /lib/private/legacy/util.php, about line 793, there is a comment that is_writable doesn't work for NFS mounts, so try to write a file and check if it exists. So I think the function
is_writableshould not be used in this project. Or maybe we can write a new function in this project to check whether a directory is writable or not by trying to write a file.Now I fix it by commenting line 302~304 of Setup.php. However, the function
is_writableis called 19 times in 9 files:I'm not sure if there will be some other bugs because of the usage of this function. I think we can consider replacing all the
is_writablein these files to our own writability check function.