Issues with primary Storage on CIFS share from Windows

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 12.0.2):16.0.1 (Latest docker image)
Operating system and version (eg, Ubuntu 17.04): Alpine Linux
Apache or nginx version (eg, Apache 2.4.25):
PHP version (eg, 7.1):

The issue you are facing:

Nextcloud stoarge is set to a Windows SMB share which is mounted at /mnt/fsDockerStorage . Below are the two volumes being mounted in docker container:
- /mnt/localDockerStorage/nextcloud/data:/var/www/html
- /mnt/fsDockerStorage/nextcloud/FileStorage:/var/www/storage
This seems to be working for most part except when creating new text files from NC web, creating new text files shows the error:
“An error occured! Cannot read the file”
and then text editor will close. Now I can click on the created txt file and text editor will open up fine(although it take 5-6 seconds first time) and I can edit and save and it works fine.
I tried to use the external storage option and mounted the same CIFS share, creating txt files in this works fine, no errors at all.
No other files or creating directories are affected. Files uploaded from web works fine as well.

Another place where I see this is when uploading from mobile(NC Android app v 3.6.2), auto uploads give an error that server is in maintenance mode, or sometimes “Malformed server configuration” shows up. Uploads eventually goes through though. I might have to open a separate request for this issue but thought it might be related. Also this issue does not get resolved even if autoupload folder is set to the external CIFS share.

Is this the first time you’ve seen this error? (Y/N): Y (This is a new NC setup)

Steps to replicate it:

  1. Setup NC with storage on Windows CIFS share
  2. Create new text file from web

The output of your Nextcloud log in Admin > Logging:

Oldest on Top:
[PHP] Error: fopen(/var/www/storage/RedactedUID/files/2/test/New text file.txt): failed to open stream: Stale file handle at /var/www/html/lib/private/Files/Storage/Local.php#284

GET /core/preview?fileId=3978&c=73fd6dcf7dbc97c5d4d013a2cddbb092&x=250&y=250&forceIcon=0
from 10.0.0.5 by RedactedUID at 2019-05-30T20:43:49+00:00

[PHP] Error: chmod(): Operation not permitted at /var/www/html/lib/private/Log/File.php#141

GET /core/preview?fileId=3978&c=73fd6dcf7dbc97c5d4d013a2cddbb092&x=250&y=250&forceIcon=0
from 10.0.0.5 by RedactedUID at 2019-05-30T20:43:49+00:00

[PHP] Error: file_get_contents(/var/www/storage/RedactedUID/files/2/test/New text file.txt): failed to open stream: Stale file handle at /var/www/html/lib/private/Files/Storage/Local.php#216

GET /apps/files_texteditor/ajax/loadfile?filename=New+text+file.txt&dir=%2F2%2Ftest
from 10.0.0.5 by RedactedUID at 2019-05-30T20:43:49+00:00

[PHP] Error: chmod(): Operation not permitted at /var/www/html/lib/private/Log/File.php#141

GET /apps/files_texteditor/ajax/loadfile?filename=New+text+file.txt&dir=%2F2%2Ftest
from 10.0.0.5 by RedactedUID at 2019-05-30T20:43:49+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'htaccess.RewriteBase' => '/',
  'check_data_directory_permissions' => false,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'apps_paths' => 
  array (
    0 => 
    array (
      'path' => '/var/www/html/apps',
      'url' => '/apps',
      'writable' => false,
    ),
    1 => 
    array (
      'path' => '/var/www/html/custom_apps',
      'url' => '/custom_apps',
      'writable' => true,
    ),
  ),
  'instanceid' => 'xxxxxxx',
  'passwordsalt' => 'xxxxxxx',
  'secret' => 'xxxxxxxxxx',
  'trusted_domains' => 
  array (
    0 => 'IPxxx:8080',
  ),
  'datadirectory' => '/var/www/storage',
  'dbtype' => 'mysql',
  'version' => '16.0.1.1',
  'overwrite.cli.url' => 'IPxxxx:8080',
  'overwritehost' => 'URL',
  'overwriteprotocol' => 'https',
  'dbname' => 'xxxxx',
  'dbhost' => 'xxxx',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'xxxx',
  'dbpassword' => 'xxxxxx',
  'installed' => true,
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'maintenance' => false,
);

Hello.

files rights and mount points rights need to be check.
Looks like a right access error.

Hey,

Thank you for looking into this. All the files/folders inside the Storage has 777 permissions (drwxrwxrwx) so I dont think permissions will cause that. Also on the NTFS side I have tried giving everyone full permissions (just to test).

check also ownership of directory/files and mount points.

your problem looks very much like

Unfortunatly, i dont use docker.

Mount points have the same permissions as well (777), could it be that permissions needs to be specifically added for “www-data” ? I dont see a reason though as everyone has full permissions.