Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error creating templates folder when root folder is read only #25787

Closed
szaimen opened this issue Feb 24, 2021 · 6 comments · Fixed by #26396
Closed

error creating templates folder when root folder is read only #25787

szaimen opened this issue Feb 24, 2021 · 6 comments · Fixed by #26396
Labels
1. to develop Accepted and waiting to be taken care of bug

Comments

@szaimen
Copy link
Contributor

szaimen commented Feb 24, 2021

How to use GitHub

  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

  1. Make your Nextcloud root folder read only by mounting a local external storage to Nextcloud, making it read only and naming it /.
  2. Create a second local external storage, name it differently and make it writeable.
  3. Inside this second local external storage mount and inside the files app, click on set up templates folder, and press Enter to create it
  4. The files app reloads but the template folder isn't created
  5. until I reload the website, I don't have the possibility to set up the templates folder again

Expected behaviour

It should create the templates folder

Actual behaviour

It doesn't create the templates folder and just bugs out with two log messages inside the nextcloud logs:

[no app in context] Warning: Invalid data provided to provideInitialState by files

GET /apps/files/?dir=/User1_folder
from ip-address by admin at 2021-02-24T20:07:33+01:00
{
  "reqId": "TQFKJpVgiiI53Fk2cInz",
  "level": 3,
  "time": "2021-02-24T20:07:27+01:00",
  "remoteAddr": "edited",
  "user": "admin",
  "app": "files_templates",
  "method": "POST",
  "url": "/ocs/v2.php/apps/files/api/v1/templates/path",
  "message": {
    "Exception": "OCP\\Files\\NotFoundException",
    "Message": "/admin/files/User1_folder/Templates",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
        "line": 140,
        "function": "get",
        "class": "OC\\Files\\Node\\Root",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Template/TemplateManager.php",
        "line": 300,
        "function": "get",
        "class": "OC\\Files\\Node\\Folder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files/lib/Controller/TemplateController.php",
        "line": 67,
        "function": "initializeTemplateDirectory",
        "class": "OC\\Files\\Template\\TemplateManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 218,
        "function": "path",
        "class": "OCA\\Files\\Controller\\TemplateController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 127,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 157,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/ocs/v1.php",
        "line": 63,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/ocs/v2.php",
        "line": 24,
        "args": [
          "/var/www/nextcloud/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Files/Node/Root.php",
    "Line": 205,
    "CustomMessage": "Failed to initialize templates directory to user language en for "
  },
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36",
  "version": "21.0.0.18",
  "id": "6036a41357c5c"
}

Server configuration

Operating system:
Ubuntu 20.04

Web server:
Apache

Database:
Postgresql 12

PHP version:
7.4-fpm

Nextcloud version:
NC 20.0.0

Updated from an older Nextcloud/ownCloud or fresh install:
updated from 20.0.7

Where did you install Nextcloud from:
Nextcloud VM

Signing status:

Signing status
Login as admin user into your Nextcloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results here.

List of activated apps:

App list
Enabled:
  - accessibility: 1.7.0
  - activity: 2.14.3
  - admin_audit: 1.11.0
  - calendar: 2.1.3
  - cloud_federation_api: 1.4.0
  - comments: 1.11.0
  - contacts: 3.4.3
  - contactsinteraction: 1.2.0
  - dashboard: 7.1.0
  - dav: 1.17.1
  - deck: 1.3.0
  - extract: 1.3.0
  - federatedfilesharing: 1.11.0
  - federation: 1.11.0
  - files: 1.16.0
  - files_antivirus: 3.1.2
  - files_external: 1.12.0
  - files_pdfviewer: 2.1.0
  - files_rightclick: 1.0.0
  - files_sharing: 1.13.1
  - files_trashbin: 1.11.0
  - files_versions: 1.14.0
  - files_videoplayer: 1.10.0
  - firstrunwizard: 2.10.0
  - forms: 2.1.0
  - integration_whiteboard: 0.0.13
  - logreader: 2.6.0
  - lookup_server_connector: 1.9.0
  - mail: 1.8.3
  - news: 15.3.2
  - nextcloud_announcements: 1.10.0
  - notes: 4.0.2
  - notifications: 2.9.0
  - oauth2: 1.9.0
  - password_policy: 1.11.0
  - previewgenerator: 3.1.1
  - privacy: 1.5.0
  - provisioning_api: 1.11.0
  - recommendations: 1.0.0
  - serverinfo: 1.11.0
  - settings: 1.3.0
  - sharebymail: 1.11.0
  - spreed: 11.0.0
  - support: 1.4.0
  - survey_client: 1.9.0
  - systemtags: 1.11.0
  - theming: 1.12.0
  - twofactor_backupcodes: 1.10.0
  - updatenotification: 1.11.0
  - user_status: 1.1.1
  - viewer: 1.5.0
  - weather_status: 1.1.0
  - whiteboard: 0.0.3
  - workflowengine: 2.3.0
Disabled:
  - encryption
  - maps
  - onlyoffice
  - photos
  - tasks
  - text
  - user_ldap

Nextcloud configuration:

Config report
{
    "system": {
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "192.168.178.61",
            "***REMOVED SENSITIVE VALUE***",
            "***REMOVED SENSITIVE VALUE***",
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "21.0.0.18",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "upgrade.disable-web": "true",
        "log_type": "file",
        "logfile": "\/var\/log\/nextcloud\/nextcloud.log",
        "loglevel": "2",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "mail_smtpmode": "smtp",
        "remember_login_cookie_lifetime": "2419200",
        "log_rotate_size": "0",
        "trashbin_retention_obligation": "auto, 180",
        "versions_retention_obligation": "auto, 365",
        "simpleSignUpLink.shown": false,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "filelocking.enabled": true,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 0,
            "timeout": 0.5,
            "dbindex": 0,
            "password": "***REMOVED SENSITIVE VALUE***"
        },
        "logtimezone": "Europe\/Berlin",
        "htaccess.RewriteBase": "\/",
        "maintenance": false,
        "enable_previews": true,
        "preview_max_x": "2048",
        "preview_max_y": "2048",
        "jpeg_quality": "60",
        "share_folder": "\/Shared",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "LOGIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "enabledPreviewProviders": {
            "11": "OC\\Preview\\PNG",
            "12": "OC\\Preview\\JPEG",
            "13": "OC\\Preview\\GIF",
            "14": "OC\\Preview\\BMP",
            "15": "OC\\Preview\\MarkDown",
            "16": "OC\\Preview\\MP3",
            "17": "OC\\Preview\\TXT",
            "18": "OC\\Preview\\Movie"
        },
        "data-fingerprint": "0a77a86cf278bcd2bf3a959b93b38ff4",
        "default_phone_region": "de",
        "app_install_overwrite": [
            "whiteboard"
        ]
    }
}

Are you using external storage, if yes which one: local/smb/sftp/...
local

Are you using encryption: yes/no
no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...
no

LDAP configuration (delete this part if not used)

LDAP config
With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser: Chromium 88 based browser

Operating system: Windows 10

Logs

Web server error log

Web server error log
Insert your webserver log here

Nextcloud log (data/nextcloud.log)

Nextcloud log
Insert your Nextcloud log here

Browser log

Browser log
Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log
c) ...
@szaimen szaimen added bug 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Feb 24, 2021
@szaimen
Copy link
Contributor Author

szaimen commented Feb 24, 2021

cc @juliushaertl @icewind1991

@szaimen
Copy link
Contributor Author

szaimen commented Feb 24, 2021

Okay, I've just debugged that further and it seems related to the fact that my root directory is read only.
I've adjusted the report accordingly.
When the root folder is readable, the creation works also on local external storage.
What I wonder is why it fails even in a subfolder when the root directory is read only?

@szaimen szaimen changed the title error creating templates folder on local external storage error creating templates folder when root folder is read only Feb 24, 2021
@szaimen
Copy link
Contributor Author

szaimen commented Feb 24, 2021

BTW: if the root folder is read only, I am also not able to create a new file from template also if the templates folder was created successfully before (by making it writeable for the moment of creating it). I get this error in this case: (the error message states the the folder doesn't has create permission, but only the root folder is read only and not the external storage folder that I am trying to create a new file from template in)

{
  "reqId": "gg8BvZX55oAh5cl387NW",
  "level": 3,
  "time": "2021-02-24T20:52:50+01:00",
  "remoteAddr": "edited",
  "user": "admin",
  "app": "no app in context",
  "method": "POST",
  "url": "/ocs/v2.php/apps/files/api/v1/templates/create",
  "message": {
    "Exception": "OCP\\Files\\NotPermittedException",
    "Message": "No create permission for path",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/lib/private/Files/Template/TemplateManager.php",
        "line": 157,
        "function": "newFile",
        "class": "OC\\Files\\Node\\Folder",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/apps/files/lib/Controller/TemplateController.php",
        "line": 56,
        "function": "createFromTemplate",
        "class": "OC\\Files\\Template\\TemplateManager",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 218,
        "function": "create",
        "class": "OCA\\Files\\Controller\\TemplateController",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 127,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 157,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/nextcloud/ocs/v1.php",
        "line": 63,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/nextcloud/ocs/v2.php",
        "line": 24,
        "args": [
          "/var/www/nextcloud/ocs/v1.php"
        ],
        "function": "require_once"
      }
    ],
    "File": "/var/www/nextcloud/lib/private/Files/Node/Folder.php",
    "Line": 200,
    "CustomMessage": "No create permission for path"
  },
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36",
  "version": "21.0.0.18",
  "id": "6036aee73b15e"
}

@szaimen
Copy link
Contributor Author

szaimen commented Feb 24, 2021

I am not familar with the Nextcloud codebase but it sounds to me like the root path for a certain user is always checked when creating a new file from template or setting up a templates folder which results in no create rights although the folder that I am trying to create the new file/folder in is writeable. => it bugs out.

@szaimen
Copy link
Contributor Author

szaimen commented Feb 25, 2021

cc @nextcloud/server-triage

@juliusknorr juliusknorr added 1. to develop Accepted and waiting to be taken care of and removed 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Mar 8, 2021
juliusknorr added a commit that referenced this issue Mar 31, 2021
@juliusknorr
Copy link
Member

juliusknorr commented Mar 31, 2021

@szaimen In relation to nextcloud/android#8010 I've added another commit to also handle the template directory creation in #26396, testing is very welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants