server icon indicating copy to clipboard operation
server copied to clipboard

[13.0.0beta4] SMB mounts work poorly or not at all

Open waynehawken opened this issue 8 years ago • 24 comments

Steps to reproduce

  1. Mount SMB shares
  2. Enter a subfolder to the mounted SMB share
  3. Notice that nothing is listed

Expected behaviour

SMB shares should be listed, not only the root folders in that share.

Actual behaviour

We can mount SMB just fine with the smbclient in Ubuntu. Listing shows up as expected and all the files and folders are showing up as expected, not in Nextcloud though.

Server configuration detail

Operating system: Linux 4.4.0-104-generic #127-Ubuntu SMP Mon Dec 11 12:16:42 UTC 2017 x86_64

Webserver: Apache/2.4.18 (Ubuntu) (apache2handler)

Database: mysql 10.2.12

PHP version: 7.0.22-0ubuntu0.16.04.1 Modules loaded: Core, date, libxml, openssl, pcre, zlib, filter, hash, Reflection, SPL, session, standard, apache2handler, redis, mysqlnd, PDO, xml, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, iconv, imap, intl, json, ldap, exif, mcrypt, mysqli, pdo_mysql, pdo_pgsql, pdo_sqlite, pgsql, Phar, posix, readline, shmop, SimpleXML, smbclient, sockets, sqlite3, sysvmsg, sysvsem, sysvshm, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, libsmbclient, Zend OPcache

Nextcloud version: 13.0.0 Beta 4 - 13.0.0.9

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

Where did you install Nextcloud from: Tech and Me VM with installation help from @enoch85

Signing status

Array

List of activated apps
Enabled:
 - activity: 2.6.1
 - calendar: 1.5.7
 - comments: 1.3.0
 - contacts: 2.0.1
 - dav: 1.4.6
 - federatedfilesharing: 1.3.1
 - federation: 1.3.0
 - files: 1.8.0
 - files_external: 1.4.1
 - files_pdfviewer: 1.2.0
 - files_sharing: 1.5.0
 - files_texteditor: 2.5.1
 - files_trashbin: 1.3.0
 - files_versions: 1.6.0
 - files_videoplayer: 1.2.0
 - firstrunwizard: 2.2.1
 - gallery: 18.0.0
 - issuetemplate: 0.3.0
 - logreader: 2.0.0
 - lookup_server_connector: 1.1.0
 - nextcloud_announcements: 1.2.0
 - notifications: 2.1.2
 - oauth2: 1.1.0
 - password_policy: 1.3.0
 - previewgenerator: 1.0.9
 - provisioning_api: 1.3.0
 - richdocuments: 1.12.39
 - serverinfo: 1.3.0
 - sharebymail: 1.3.0
 - survey_client: 1.1.0
 - systemtags: 1.3.0
 - theming: 1.4.1
 - twofactor_backupcodes: 1.2.3
 - updatenotification: 1.3.0
 - user_ldap: 1.3.1
 - workflowengine: 1.3.0
Disabled:
 - admin_audit
 - encryption
 - user_external

Configuration (config/config.php)
{
    "passwordsalt": "***REMOVED SENSITIVE VALUE***",
    "secret": "***REMOVED SENSITIVE VALUE***",
    "trusted_domains": [
        "localhost",
        "10.2.0.143",
        "eqxnexcloud02",
        "collabora.spd.adventist.org",
        "files.spd.adventist.org"
    ],
    "datadirectory": "***REMOVED SENSITIVE VALUE***",
    "overwrite.cli.url": "https:\/\/eqxnexcloud02.sda.local\/",
    "dbtype": "mysql",
    "version": "13.0.0.9",
    "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,
    "mail_smtpmode": "smtp",
    "log_rotate_size": "10485760",
    "memcache.local": "\\OC\\Memcache\\Redis",
    "filelocking.enabled": true,
    "memcache.distributed": "\\OC\\Memcache\\Redis",
    "memcache.locking": "\\OC\\Memcache\\Redis",
    "redis": {
        "host": "***REMOVED SENSITIVE VALUE***",
        "port": 0,
        "timeout": 0,
        "dbindex": 0,
        "password": "***REMOVED SENSITIVE VALUE***"
    },
    "htaccess.RewriteBase": "\/",
    "loglevel": "2",
    "log_type": "file",
    "logfile": "\/var\/ncdata\/nextcloud.log",
    "logtimezone": "Australia\/Sydney",
    "ldapIgnoreNamingRules": false,
    "ldapProviderFactory": "\\OCA\\User_LDAP\\LDAPProviderFactory"
}

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

Are you using encryption: no

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

LDAP configuration (delete this part if not used)
With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your Nextcloud installation folder

**VERY BIG UNREADABLE OUTPUT**

Client configuration

Browser: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:57.0) Gecko/20100101 Firefox/57.0

Operating system: Windows Server 2012 R2 Datacenter

Logs

Browser log
Nothing relevant
Nextcloud log
Nothing relevant
Browser log

Nothing relevant

waynehawken avatar Jan 08 '18 20:01 waynehawken

cc @icewind1991

enoch85 avatar Jan 08 '18 20:01 enoch85

Same goes for 12.0.3 and 12.0.4.

waynehawken avatar Jan 08 '18 20:01 waynehawken

Related: https://github.com/nextcloud/server/issues/6597

enoch85 avatar Jan 08 '18 21:01 enoch85

I have this same issue since at least 12.0.3. Feedback below is based on 12.0.4.

I found that what is failing on my particular set up is the auth file being provided via the /proc/self/fd/3

When I change apps/files_external/3rdparty/icewind/smb/src/RawConnection.php function writeAuthentication to point to a physical file which I create with the content provided by getAuthStream() then everything "just works".

@icewind1991 I followed your test instructions regarding the example.php in https://github.com/icewind1991/SMB and that again "just works".

twrhills avatar Jan 10 '18 01:01 twrhills

Which version of smbclient are you using, I know that the smb wrapper shipped with 12.0.x doesn't like the /proc trick.

You can try applying https://github.com/nextcloud/server/pull/7774 and see if that fixes the issue for you

icewind1991 avatar Jan 10 '18 12:01 icewind1991

@icewind1991 Do we use the latest smbclient libs in 13.0.0beta4 as well, because it's exactly the same issue there as in 12.0.4.

enoch85 avatar Jan 10 '18 12:01 enoch85

And just to be clear, it's working perfectly fine without involving Nextcloud, in other words when using smbclient. It's the External Storage App that is dysfunctional.

enoch85 avatar Jan 10 '18 12:01 enoch85

if you're experiencing the issue with 13 then it's most likely a separate one as @twrhills has

Try running the steps described in https://github.com/nextcloud/server/issues/6597#issuecomment-355997264 to narrow down the issue to either the smb library or the NC integration of it

icewind1991 avatar Jan 10 '18 13:01 icewind1991

@icewind1991 I already tried to reach you on IRC when I was debugging it, but you didn't answer. :)

My question there was where to put all the info, I mean "test" must be replaced with the real values to get a valid result right?

enoch85 avatar Jan 10 '18 19:01 enoch85

Yes, on line 8/10 you put the server address, user name and password in that order

then on line 13 the name of the share

icewind1991 avatar Jan 11 '18 11:01 icewind1991

@icewind1991 Great!

@waynehawken Maybe we can schedule a meeting for this?

enoch85 avatar Jan 11 '18 12:01 enoch85

@enoch85 - happy to set up another - it is probably fastest - however looking at the details we aren't providing user/pwd details in the config as we are using at runtime accounts and per user authentication to the shares. Providing a single user account in the backend would defeat this authentication purpose would it not?

waynehawken avatar Jan 11 '18 21:01 waynehawken

@waynehawken Aah you're right. Forgot about that. I don't remember, did it work when we used a single account or not?

@icewind1991 This is a little bit special case as the users authenticate with LDAP and permissions to the different CIFS shares are set in AD. So testing just one account might not provide fair result, and in @waynehawken setup we have about 10 000 users if I'm not mistaken.

enoch85 avatar Jan 12 '18 06:01 enoch85

ok - have had to do something as it has been unusable for us for an extended time period. Have build a new v11 VM and reverted back to 11.03 - problems are gone & SMB working fine again. There is something buggy in at least v12.3 - possibly 12.02 and maybe 12.01, but we have been trying to work around the issue for so long now that failed/change history doesn't align with end user reports enough.

waynehawken avatar Jan 23 '18 06:01 waynehawken

11.03 - problems are gone & SMB working fine again. There is something buggy in at least v12.3 - possibly 12.02 and maybe 12.01

Yup, I can confirm that I had multiple customers that complained about this since 11.X.X cc @icewind1991

enoch85 avatar Jan 23 '18 09:01 enoch85

Same here with NC 13.0.0, having this kind of problems since I was using Owncloud back to 2015. Samba shares doesn't work proprely at all, bad files' size shown, files truncated when downloaded etc.

During these years I tried to:

  • Migrated owncloud to NC (13.0.0)
  • Updated the PHP wrapper for samba (with PECL, smbclient 0.9.0).
  • Applied #7556
  • Didn't applied #7774 (icewind/smb to 2.0.3) because I saw in the conf that I use icewind/smb 2.0.4
  • And I did a lot of tests while watching nginx/samba/php/NC logs, the only strange thing I noticed during a share download was in nginx error.log, but I am not enough a good Linux user to understand and make appropriates Google searches about it, or even if these errors have a thing to do with this issue.

2018/03/03 11:04:33 [error] 758#758: *74 FastCGI sent in stderr: "PHP message: PHP Warning: smbclient_state_errno(): supplied resource is not a valid smbclient state resource in /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/NativeState.php on line 45 PHP message: PHP Fatal error: Uncaught Error: Access to undeclared static property: Icewind\SMB\NativeState::$exceptionMap in /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/NativeState.php:49 Stack trace: #0 /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/NativeState.php(61): Icewind\SMB\NativeState->handleError(NULL) #1 /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/NativeState.php(263): Icewind\SMB\NativeState->testResult(false, Resource id #56) #2 /var/www/owncloud/apps/files_external/3rdparty/icewind/smb/src/NativeStream.php(64): Icewind\SMB\NativeState->close(Resource id #56) #3 [internal function]: Icewind\SMB\NativeStream->stream_close() #4 /var/www/owncloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php(124): fclose(Resource id #60) #5 /var/www/owncloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php(107): Icewind\Streams\Wrapper->stream_close() #6 [internal function]: Icewind\Streams\CallbackWrapper->stream_close()" while reading upstream, client: xx.xxx.xxx.xx, server: aaaaa.aaaaa.com, request: "GET /owncloud/index.php/s/Qm7Z9K6BsLNtFEF/download HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "xxx.xxxxx.com:443"

I was thinking about a memory problem, I only have 2 Go ram on an XU4 Odroid, but it doesn't seems, I tried to share and download a > 8 Go file using Webdav and there was no problem.

Witmann avatar Mar 06 '18 14:03 Witmann

IMHO I think this should be looked at. We have a lot of Windows users that use SMB, and that it's broken since 11.0.X is just sad. Dunno if this has priority on the todo-list?

enoch85 avatar Mar 06 '18 19:03 enoch85

Issues with big files using smb shares exists at least since 2015 (as I know) in OC or NC, unfortunatly maybe Samba is not very popular among NC users so I guess it's not realy a priority :s.

Witmann avatar Mar 09 '18 21:03 Witmann

@icewind1991

With NC11 no longer supported, but this functionality is still not working in v12 or v13, is there any timeline or plans to resolve this or should we be looking for a replacement product and moving to something else?

waynehawken avatar Jun 04 '18 05:06 waynehawken

Hi @waynehawken and others. I think this matter would be resolved pretty quickly after a discussion with Nextcloud looking at this: https://nextcloud.com/enterprise/

enoch85 avatar Jun 04 '18 06:06 enoch85