Skip to content

Data directory check fails in the installation process for NFS mounts #15994

Description

@SamJia

Steps to reproduce

  1. download nextcloud server archive, extract all the files into the document root directory of Apache2
  2. mount external NFS to datadir
  3. visit the Nextcloud webpage. In the setup process, enter datadir into the Data folder section.
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmapbugneeds infostaleTicket or PR with no recent activity

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions