nextcloud / nextcloud/server

"occ maintenance:install" fails, if path to data dir contains a symlink

Open
#12,247 9 comments 0 reactions 1 assignee View on GitHub

@icewind1991 is already working on this.

Since Mar 4, 2020.

0. Needs triage 25-feedback bug feature: install and update hotspot: filename handling
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

Steps to reproduce
  1. Download and place current Nextcloud 14.0.3
  2. Use occ maintenance:install to install Nextcloud, choosing a data directory with is inside a symlink. E.g. /mnt/data is a symlink, pointing to /mnt/external, then choose --data-dir /mnt/data/ncdata as install option.
Expected behaviour

Install should finish without error message.

Actual behaviour

Install throws error:

In Local.php line 387:

  Following symlinks is not allowed


maintenance:install [--database DATABASE] [--database-name DATABASE-NAME] [--database-host DATABASE-HOST] [--database-port DATABASE-PORT] [--database-user DATABASE-USER] [--database-pass [DATABASE-PASS]] [--database-table-prefix [DATABASE-TABLE-PREFIX]] [--database-table-space [DATABASE-TABLE-SPACE]] [--admin-user ADMIN-USER] [--admin-pass ADMIN-PASS] [--data-dir DATA-DIR]
  • The install actually works fine. config.php is fully configured with data dir containing the chosen path with symlink inside.
  • WebUI opens, creating/uploading files works well, data dir is used as expected.
  • Only the skeleton files/folders are not copied to the data dir, so when logging into Nextcloud the first time, the data dir is empty.
Further info
  • This is due to the code line from the error message. It's aim is to disable symlink from INSIDE the data dir to OUTSIDE it. However both is not the case, thus the check is done incorrectly.
  • In the past this did work, so I guess it's due to a recent change. I just checked on Nextcloud 13.0.7 and there it works well with exactly the same setup.
Server configuration

Operating system:
Debian Stretch

Web server:
Does not matter, same with Apache2, Nginx, Lighttpd

Database:
MariaDB 10.1

PHP version:
PHP7.0

Nextcloud version:
14.0.3

Updated from an older Nextcloud/ownCloud or fresh install:
Fresh install

Where did you install Nextcloud from:
Official download source

Signing status:
No failures

List of activated apps:
Default on fresh install, irrelevant

Nextcloud configuration:

Config report
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "*"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "14.0.3.0",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0
        },
        "overwrite.cli.url": "http:\/\/localhost\/nextcloud",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false
    }
}
  • However, does not matter, since error appears on install step before doing any config changes.
  • But it shows, that everything is configured as expected, some additions from our install script (memcache, locking, 4byte support).

Are you using external storage, if yes which one:
No, but using symlinks usually has the intention to move userdata to an external drive, either after Nextcloud was installed already or prior to this, but having an always correct data dir path, even that the actual (symlinked) location changes from one drive/location to another.

Are you using encryption: no

Are you using an external user-backend, if yes which one: no

€: @nextcloud-bot nice try, but nothing is related 😉

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.