nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.65k stars 3.99k forks source link

Files on SMB-share corrupted while up- and downloading #26457

Closed ShinjiLE closed 3 years ago

ShinjiLE commented 3 years ago

Steps to reproduce

Using SMB Share

Expected behaviour

Files uploaded and downloaded without corruption

Actual behaviour

Datablocks are truncated to 8192 Bytes

Server configuration detail

Operating system: Linux 5.11.6-1-default #1 SMP Thu Mar 11 16:11:36 UTC 2021 (7358b30) x86_64

Webserver: Apache (fpm-fcgi)

Database: mysql 10.5.9

PHP version:

7.4.16 Modules loaded: Core, date, libxml, pcre, filter, hash, Reflection, SPL, session, SimpleXML, standard, xml, cgi-fcgi, mysqlnd, apcu, bcmath, bz2, ctype, curl, dom, enchant, mbstring, fileinfo, ftp, gd, gettext, gmp, ice, iconv, imagick, intl, json, lzf, exif, memcached, mysqli, openssl, pcntl, PDO, pdo_mysql, pdo_sqlite, zlib, posix, readline, redis, smbclient, sockets, sqlite3, tidy, tokenizer, uuid, xmlreader, xmlwriter, zip, Phar, libsmbclient, Zend OPcache

Nextcloud version: 21.0.1 RC1 - 21.0.1.0

Updated from an older Nextcloud/ownCloud or fresh install:

Where did you install Nextcloud from: unknown

Signing status Array ( )
List of activated apps ``` Enabled: - activity: 2.14.3 - admin_audit: 1.11.0 - announcementcenter: 5.0.0 - bookmarks: 4.1.0 - calendar: 2.2.0 - checksum: 1.1.2 - cloud_federation_api: 1.4.0 - comments: 1.11.0 - contacts: 3.5.1 - contactsinteraction: 1.2.0 - dashboard: 7.1.0 - dav: 1.17.1 - deck: 1.3.2 - duplicatefinder: 0.0.6 - event_update_notification: 1.2.0 - extract: 1.3.1 - federatedfilesharing: 1.11.0 - federation: 1.11.0 - files: 1.16.0 - files_external: 1.12.0 - files_fulltextsearch: 21.0.0 - files_fulltextsearch_tesseract: 20.0.1 - files_markdown: 2.3.3 - files_pdfviewer: 2.1.0 - files_rightclick: 1.0.0 - files_sharing: 1.13.1 - files_texteditor: 2.14.0 - files_trashbin: 1.11.0 - files_versions: 1.14.0 - files_videoplayer: 1.10.0 - firstrunwizard: 2.10.0 - fulltextsearch: 21.0.0 - fulltextsearch_elasticsearch: 21.0.0 - groupfolders: 9.0.0 - impersonate: 1.8.0 - integration_github: 1.0.0 - integration_mastodon: 1.0.0 - integration_twitter: 1.0.0 - issuetemplate: 0.7.0 - logreader: 2.6.0 - lookup_server_connector: 1.9.0 - maps: 0.1.8 - metadata: 0.13.0 - music: 1.1.0 - news: 15.3.2 - nextcloud_announcements: 1.10.0 - notes: 4.0.4 - notifications: 2.9.0 - notify_push: 0.1.6 - oauth2: 1.9.0 - passman: 2.3.7 - password_policy: 1.11.0 - phonetrack: 0.6.7 - photos: 1.3.0 - polls: 1.8.1 - previewgenerator: 3.1.1 - pride: 0.0.3 - 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 - side_menu: 1.23.1 - social: 0.4.2 - spreed: 11.1.1 - support: 1.4.0 - survey_client: 1.9.0 - systemtags: 1.11.0 - tasks: 0.13.6 - telephoneprovider: 1.0.3 - text: 3.2.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 - workflowengine: 2.3.0 Disabled: - accessibility - apporder - bruteforcesettings - circles - encryption - epubreader - files_linkeditor - files_trackdownloads - flowupload - integration_discourse - nextbackup - suspicious_login - talk_matterbridge - talk_simple_poll - user_ldap ```
Configuration (config/config.php) ``` { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "nextcloud.mybase.selfhost.de", "cloudnext.mybase.selfhost.de" ], "trusted_proxies": "***REMOVED SENSITIVE VALUE***", "default_phone_region": "DE", "datadirectory": "***REMOVED SENSITIVE VALUE***", "tempdirectory": "\/var\/tmp\/nextcloudtemp", "overwrite.cli.url": "https:\/\/nextcloud.mybase.selfhost.de", "knowledgebaseenabled": true, "dbtype": "mysql", "version": "21.0.1.0", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "updater.release.channel": "beta", "appstore.experimental.enabled": true, "maintenance": false, "loglevel": 3, "debug": false, "htaccess.RewriteBase": "\/", "activity_use_cached_mountpoints": true, "session_keepalive": true, "session_lifetime": 86400, "versions_retention_obligation": "auto", "trashbin_retention_obligation": "auto", "enable_previews": true, "preview_max_x": 2560, "preview_max_y": 1600, "preview_max_filesize_image": 200, "preview_libreoffice_path": "\/usr\/bin\/libreoffice", "preview_office_cl_parameters": " --headless --nologo --nofirststartwizard --invisible --norestore --convert-to pdf --outdir ", "enabledPreviewProviders": [ "OC\\Preview\\PNG", "OC\\Preview\\JPEG", "OC\\Preview\\GIF", "OC\\Preview\\BMP", "OC\\Preview\\XBitmap", "OC\\Preview\\MP3", "OC\\Preview\\TXT", "OC\\Preview\\MarkDown", "OC\\Preview\\TIFF", "OC\\Preview\\SVG", "OC\\Preview\\Postscript", "OC\\Preview\\OpenDocument", "OC\\Preview\\PDF", "OC\\Preview\\Font", "OC\\Preview\\Epub", "OC\\Preview\\StarOffice", "OC\\Preview\\HEIC", "OC\\Preview\\KRITA" ], "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_smtpauthtype": "LOGIN", "mail_domain": "***REMOVED SENSITIVE VALUE***", "log_type": "syslog", "logfile": "\/var\/log\/nextcloud.log", "logfilemode": 416, "log_rotate_size": 104857600, "syslog_tag": "Nextcloud", "memcache.distributed": "\\OC\\Memcache\\Memcached", "memcache.local": "\\OC\\Memcache\\Redis", "filelocking.enabled": "true", "filelocking.ttl": 3600, "memcache.locking": "\\OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 6379, "timeout": 0, "dbindex": 0, "password": "***REMOVED SENSITIVE VALUE***" }, "memcached_servers": [ [ "192.168.1.10", 11211 ], [ "192.168.1.50", 11211 ] ], "data-fingerprint": "790e9a77b6ee76b2af214c8f58d75dfd", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpauth": 1, "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "mail_smtpsecure": "tls", "mysql.utf8mb4": true, "allow_user_to_change_display_name": true, "auth.bruteforce.protection.enabled": true, "ldapIgnoreNamingRules": false, "ldapProviderFactory": "OCA\\User_LDAP\\LDAPProviderFactory", "theme": "", "app_install_overwrite": [ "fulltextsearch", "fulltextsearch_elasticsearch", "files_fulltextsearch", "files_fulltextsearch_tesseract", "passman", "pride", "checksum", "files_markdown", "telephoneprovider", "circles", "camerarawpreviews", "files_external_gdrive", "music", "facerecognition", "groupfolders", "side_menu", "metadata", "issuetemplate" ], "updater.secret": "***REMOVED SENSITIVE VALUE***" } ```

Are you using external storage, if yes which one: smb

Are you using encryption:

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

Client configuration

Browser: Mozilla/5.0 (X11; Linux x86_64; rv:86.0) Gecko/20100101 Firefox/86.0

Operating system:

Logs

Web server error log ``` Insert your web server log here ```
Nextcloud log ``` Apr 08 10:37:33 rin libsmbclient[2213]: {"reqId":"ipoKR7FMx5eRhV7BUHwF","level":3,"time":"2021-04-08T08:37:33+00:00","remoteAddr":"84.134.23.233","user":"shinji","app":"PHP","method":"GET","url":"/index.php/apps/files/api/v1/thumbnail/256/256/Bilder/Photos/2021/04/IMG_20210408_103713.jpg","message":"{\"Exception\":\"Error\",\"Message\":\"fread(): Icewind\\\\SMB\\\\Native\\\\NativeReadStream::stream_read - read 253952 bytes more data than requested (262144 read, 8192 max) - excess data will be lost at /srv/www/vhosts/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php#55\",\"Code\":0,\"Trace\":[{\"function\":\"onError\",\"class\":\"OC\\\\Log\\\\ErrorHandler\",\"type\":\"::\",\"args\":[2,\"fread(): Icewind\\\\SMB\\\\Native\\\\NativeReadStream::stream_read - read 253952 bytes more data than requested (262144 read, 8192 max) - excess data will be lost\",\"/srv/www/vhosts/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php\",55,{\"count\":8192}]},{\"file\":\"/srv/www/vhosts/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php\",\"line\":55,\"function\":\"fread\",\"args\":[null,8192]},{\"file\":\"/srv/www/vhosts/nextcloud/apps/files_external/3rdparty/icewind/streams/src/CallbackWrapper.php\",\"line\":96,\"function\":\"stream_read\",\"class\":\"Icewind\\\\Streams\\\\Wrapper\",\"type\":\"->\",\"args\":[8192]},{\"function\":\"stream_read\",\"class\":\"Icewind\\\\Streams\\\\CallbackWrapper\",\"type\":\"->\",\"args\":[8192]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/Preview/ProviderV2.php\",\"line\":92,\"function\":\"file_put_contents\",\"args\":[\"/tmp/oc_tmp_XQQFAM\",null]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/Preview/Image.php\",\"line\":50,\"function\":\"getLocalFile\",\"class\":\"OC\\\\Preview\\\\ProviderV2\",\"type\":\"->\",\"args\":[{\"__class__\":\"OC\\\\Files\\\\Node\\\\File\"}]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/Preview/GeneratorHelper.php\",\"line\":63,\"function\":\"getThumbnail\",\"class\":\"OC\\\\Preview\\\\Image\",\"type\":\"->\",\"args\":[{\"__class__\":\"OC\\\\Files\\\\Node\\\\File\"},2560,1600]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/Preview/Generator.php\",\"line\":244,\"function\":\"getThumbnail\",\"class\":\"OC\\\\Preview\\\\GeneratorHelper\",\"type\":\"->\",\"args\":[{\"__class__\":\"OC\\\\Preview\\\\JPEG\"},{\"__class__\":\"OC\\\\Files\\\\Node\\\\File\"},2560,1600]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/Preview/Generator.php\",\"line\":140,\"function\":\"getMaxPreview\",\"class\":\"OC\\\\Preview\\\\Generator\",\"type\":\"->\",\"args\":[{\"__class__\":\"OC\\\\Files\\\\SimpleFS\\\\SimpleFolder\"},{\"__class__\":\"OC\\\\Files\\\\Node\\\\File\"},\"image/jpeg\",\"\"]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/Preview/Generator.php\",\"line\":109,\"function\":\"generatePreviews\",\"class\":\"OC\\\\Preview\\\\Generator\",\"type\":\"->\",\"args\":[{\"__class__\":\"OC\\\\Files\\\\Node\\\\File\"},[{\"width\":256,\"height\":256,\"crop\":true,\"mode\":\"fill\"}],\"image/jpeg\"]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/PreviewManager.php\",\"line\":190,\"function\":\"getPreview\",\"class\":\"OC\\\\Preview\\\\Generator\",\"type\":\"->\",\"args\":[{\"__class__\":\"OC\\\\Files\\\\Node\\\\File\"},256,256,true,\"fill\",null]},{\"file\":\"/srv/www/vhosts/nextcloud/apps/files/lib/Controller/ApiController.php\",\"line\":130,\"function\":\"getPreview\",\"class\":\"OC\\\\PreviewManager\",\"type\":\"->\",\"args\":[{\"__class__\":\"OC\\\\Files\\\\Node\\\\File\"},256,256,true]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":218,\"function\":\"getThumbnail\",\"class\":\"OCA\\\\Files\\\\Controller\\\\ApiController\",\"type\":\"->\",\"args\":[256,256,{\"__class__\":\"OC\\\\Files\\\\Node\\\\File\"}]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/AppFramework/Http/Dispatcher.php\",\"line\":127,\"function\":\"executeController\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Files\\\\Controller\\\\ApiController\"},\"getThumbnail\"]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/AppFramework/App.php\",\"line\":157,\"function\":\"dispatch\",\"class\":\"OC\\\\AppFramework\\\\Http\\\\Dispatcher\",\"type\":\"->\",\"args\":[{\"__class__\":\"OCA\\\\Files\\\\Controller\\\\ApiController\"},\"getThumbnail\"]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/private/Route/Router.php\",\"line\":302,\"function\":\"main\",\"class\":\"OC\\\\AppFramework\\\\App\",\"type\":\"::\",\"args\":[\"APIController\",\"getThumbnail\",{\"__class__\":\"OC\\\\AppFramework\\\\DependencyInjection\\\\DIContainer\"},{\"x\":\"256\",\"y\":\"256\",\"file\":\"Bilder/Photos/2021/04/IMG_20210408_103713.jpg\",\"_route\":\"files.API.getThumbnail\"}]},{\"file\":\"/srv/www/vhosts/nextcloud/lib/base.php\",\"line\":993,\"function\":\"match\",\"class\":\"OC\\\\Route\\\\Router\",\"type\":\"->\",\"args\":[\"/apps/files/api/v1/thumbnail/256/256/Bilder/Photos/2021/04/IMG_20210408_103713.jpg\"]},{\"file\":\"/srv/www/vhosts/nextcloud/index.php\",\"line\":37,\"function\":\"handleRequest\",\"class\":\"OC\",\"type\":\"::\",\"args\":[]}],\"File\":\"/srv/www/vhosts/nextcloud/lib/private/Log/ErrorHandler.php\",\"Line\":92,\"CustomMessage\":\"--\"}","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.15.1","version":"21.0.1.0"} ```
Browser log Insert your browser log here, this could for example include: a) The javascript console log b) The network log c) ...

720-1455-max

wwebers commented 3 years ago

i have traced the error to a change in apps/files_external/3rdparty/icewind/smb from 3.3.1 to 3.4 limited. https://github.com/icewind1991/SMB/releases

Awesome. Meanwhile my tentative workaround is as already stated:

  1. uninstall php-smbclient library
  2. uninstall php-icewind-smb library (if installed)
  3. replace icewind files with those of 2.0.8

Now, nearly everything works fine again.

Helipil0t commented 3 years ago

I can confirm with a fresh install of version 21.0.1. Uninstalling php-smbclient seems to have solved the issue for me. Any ideas what's the downside of not having php-smbclient? Hopefully this issue can be solved upstream.

CacheMinimal commented 3 years ago

Any ideas what's the downside of not having php-smbclient? Hopefully this issue can be solved upstream.

See https://github.com/nextcloud/server/issues/26457#issuecomment-816963375

Has anyone managed to isolate the cause down to a particular file (or files) in apps/files_external/3rdparty/icewind/smb? I have been busy firefighting but it may well help @icewind1991 track down the issue more quickly.

Helipil0t commented 3 years ago

I misspoke. Despite having uninstalled php-smbclient I am still having the same issues. I had an older sync that was up to date which made me think things were ok. Once I threw a new file on there and tried syncing again I received the same errors.

So I reinstalled php-smbclient and tried a fresh install of 20.0.9 with a new database and got the same issues. Then tried 20.0.8 and it works perfectly. So the issue has existed since 20.0.9 as far as I can tell.

wwebers commented 3 years ago

This is odd. It seems helping for direct downloaded files via web client or via webdav. But still fails for while using the Android Nextcloud client.

This "external storage" app seem pretty messed up things (where never my favorite).

Update after one day, now even the Android client works again. Wierd.

DmDS commented 3 years ago

Has anyone managed to isolate the cause down to a particular file (or files) in apps/files_external/3rdparty/icewind/smb? I have been busy firefighting but it may well help @icewind1991 track down the issue more quickly.

apps/files_external/3rdparty/icewind/smb/src/Native/NativeReadStream.php

szaimen commented 3 years ago

This "external storage" app seem pretty messed up things (where never my favorite).

Actually, because of that I would always recommend to mount external files via the OS and use local external storage to access them since this works since years without any problem.

Helipil0t commented 3 years ago

Yeah that might be the direction I take with my setup. Add a mount point in my fstab as www-data user and be done with it.
Thanks for the recommendation.

wwebers commented 3 years ago

This "external storage" app seem pretty messed up things (where never my favorite).

Actually, because of that I would always recommend to mount external files via the OS and use local external storage to access them since this works since years without any problem.

As I already mentioned: Mount points with the need of user authentication is not that simple if one also has some ambition in security and doesn't like hard-coded passwords lying around in config files ;) Thus I mentioned a Kerberos based setup. But I never did that for a PHP-based web applicationen like NextCloud. Wonder if there's some tutorial out there...

MEitelwein commented 3 years ago

Switching to smbclient only fixed it for me on 20.0.9 without downgrading icewind. I disabled php-smbclient for now smbclient/stable,now 2:4.9.5+dfsg-5+deb10u1 amd64

manjman commented 3 years ago

This "external storage" app seem pretty messed up things (where never my favorite).

Actually, because of that I would always recommend to mount external files via the OS and use local external storage to access them since this works since years without any problem.

This is maybe the best use case for a small home setup, but when AD or ldap is involved and you want to mirror your Windows Server Fileshares with permissions and everything working in nextcloud for your users to access, the external Storage module is neat and should get a bit more love in my opinion. We are not talking Big Business setups here, but mounting smb shares through the external storage module is a perfect use case for small business setups too when using on premise AD or something like that.

binarydad commented 3 years ago

Has anyone managed to isolate the cause down to a particular file (or files) in apps/files_external/3rdparty/icewind/smb? I have been busy firefighting but it may well help @icewind1991 track down the issue more quickly.

apps/files_external/3rdparty/icewind/smb/src/Native/NativeReadStream.php

I too can confirm this is the fix. Someone posted a link to the version change here: https://github.com/icewind1991/SMB/releases. Downloading and replacing the files from the "src" directory inside /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src (in my case) fixed the issue.

I threw a copy of the files to replace here: https://cloud.binarydad.com/s/qiigRq39kHDtncL. I simply replaced all the files to be safe.

danielnachtrub commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

snetat commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

thanks, works with my installation.

mshamash commented 3 years ago

Thanks @danielnachtrub, fixed the issue for me too. Hope this gets an official fix in the next Nextcloud update

wty21cn commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

Thanks, this fix the issue

scrable commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

Worked for me as well, thank you!

NetBaron78 commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

Worked for me too! big thanks!

muchachagrande commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

It worked for me too. Thank you!!

Taomyn commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

thanks, works with my installation.

It also fixed things for me but I still saw numerous SMB errors which needed me to apply the following code fix as well: https://github.com/nextcloud/server/pull/25540/commits/1f95f9b4791880e8d054b27fd4b9f50a7434cc65:

Error: Undefined offset: 1 at /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php#226

I know it's not directly related to this issue, but there's also a chance others are also experiencing the same additional errors.

icewind1991 commented 3 years ago

Should be fixed with ~https://github.com/nextcloud/server/pull/26046~ https://github.com/nextcloud/server/pull/26627

waja commented 3 years ago

Should be fixed with #26046

@icewind1991 Isn‘t this a merge of 3.4.0 and the fix is in 3.4.1?

theroch commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

Thx this fixes the error

CacheMinimal commented 3 years ago

It also fixed things for me but I still saw numerous SMB errors which needed me to apply the following code fix as well: 1f95f9b:

Error: Undefined offset: 1 at /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php#226

I know it's not directly related to this issue, but there's also a chance others are also experiencing the same additional errors.

I can see this was committed somewhere, but the linked commit does not seem to show where. I cannot find this fix in either master: https://github.com/nextcloud/server/blob/9a69b8839389f133db55a41e1c2ba4435fd50c19/apps/files_external/lib/Lib/Storage/SMB.php#L222 or the v21.0.1 tag https://github.com/nextcloud/server/blob/bd555dbe8568b2509bd7d82fabbe38d76c86afbe/apps/files_external/lib/Lib/Storage/SMB.php#L226 Is there a PR active to make sure it gets into the next release?

Michael2222 commented 3 years ago

Hello,

I have the same problem, but not with SMB. I use sftp in the "external storage support" and the office documents are also corrupt. But if I access to the file directly to my Diskstation, the file are fine.

Regards Michael nextcloud 21.0.1

Derkades commented 3 years ago

Hello,

I have the same problem, but not with SMB. I use sftp in the "external storage support" and the office documents are also corrupt. But if I access to the file directly to my Diskstation, the file are fine.

Regards Michael nextcloud 21.0.1

See this comment https://github.com/nextcloud/server/issues/26457#issuecomment-822037320

smartersolutions-ohio commented 3 years ago

Same problem after update 20.0.8.1 to 21.0.1.1 Debian 10, Apache 2.4, PHP 7.3

@muchahagrande, good hint! I have /var/www/apps/files_external/3rdparty/icewind (only icewind dir) restored from version 20.0.8.1 and now it works again

Hi I was wondering if you could offer a step by step guide to performing this restore? I appreciate your help on this.

snetat commented 3 years ago

Same problem after update 20.0.8.1 to 21.0.1.1 Debian 10, Apache 2.4, PHP 7.3 @muchahagrande, good hint! I have /var/www/apps/files_external/3rdparty/icewind (only icewind dir) restored from version 20.0.8.1 and now it works again

Hi I was wondering if you could offer a step by step guide to performing this restore? I appreciate your help on this.

https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

wwebers commented 3 years ago

It also fixed things for me but I still saw numerous SMB errors which needed me to apply the following code fix as well: 1f95f9b: Error: Undefined offset: 1 at /var/www/html/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php#226 I know it's not directly related to this issue, but there's also a chance others are also experiencing the same additional errors.

I can see this was committed somewhere, but the linked commit does not seem to show where. I cannot find this fix in either master: https://github.com/nextcloud/server/blob/9a69b8839389f133db55a41e1c2ba4435fd50c19/apps/files_external/lib/Lib/Storage/SMB.php#L222

or the v21.0.1 tag https://github.com/nextcloud/server/blob/bd555dbe8568b2509bd7d82fabbe38d76c86afbe/apps/files_external/lib/Lib/Storage/SMB.php#L226

Is there a PR active to make sure it gets into the next release?

Yes, it is: PR https://github.com/nextcloud/server/pull/26704/

smartersolutions-ohio commented 3 years ago

Just for help @RisedSky . You don't need to extract icewind from an old backup. Instead, you may download the previous Nextcloud version from the web page: https://download.nextcloud.com/server/releases/nextcloud-21.0.0.tar.bz2 Extract icewind from this archive.

Hi there, really struggling to resolve this issue. I just came upon your suggestion and would like to give this a try, however I am at a standstill due to lack of experience. Let me explain: Running HassonIT appliance latest version 21.0.1 within VMplayer I have downloaded the 21.0.0.tar.bz2 as suggested but now I need to replace the files but I'm now stuck. I need to know how to get the files from local Windows machine to the VM I have created a "Shared" folder and copied the required folder "icewind" to this but now I need to mount this within the VM and still copy the required files and folders from this to the "icewind" folder within the nextcloud installation.

Any help would be appreciated. I'm not an advanced user but not a newbie either. Thank you so much for your time.

MrHasse commented 3 years ago

@smartersolutions-ohio

Since you are using the VM, just use webmin (local IP and then port 10000, ex 192.168.1.10:10000) then on right side press tools and then file manager. Easy way to upload/replace files.

smartersolutions-ohio commented 3 years ago

@smartersolutions-ohio

Since you are using the VM, just use webmin (local IP and then port 10000, ex 192.168.1.10:10000) then on right side press tools and then file manager. Easy way to upload/replace files.

Thank you - that resolved my issue and you are true gentleman. Very much appreciated.

resoli commented 3 years ago

Same here.

Michael2222 commented 3 years ago

Hello, I have the same problem, but not with SMB. I use sftp in the "external storage support" and the office documents are also corrupt. But if I access to the file directly to my Diskstation, the file are fine. Regards Michael nextcloud 21.0.1

See this comment #26457 (comment)

Hello,

I do not understand! Your issues number is the same of this issue??

Regards Michael

midnight-pm commented 3 years ago

I've found an issue in icewind's StringBuffer and created a PR at the SMB repo. For a quick fix: https://blog.nuvotex.de/nextcloud-smb-stringbuffer/

Thank you for this! This resolved it for me - pending an official patch.

Supergamerx3000 commented 3 years ago

Yes in Nextcloud 20.0.8 and 21.0.0 the PDF Viewer works from external storage and from Nextcloud Storage

but in Nextcloud 20.0.9 and Nextcloud 21.0.1 i get this error from external storage loaded pdf

PDF.js v2.4.456 (build: 228a591c)

network error

I imported my backup to Nextcloud 20.0.8 and the PDF Viewer worked fine

ShinjiLE commented 3 years ago

With version 21.0.2RC1 it seems to be solved

glorenzutti commented 3 years ago

Any changelog for 21.0.2RC1 ?

ShinjiLE commented 3 years ago

Any changelog for 21.0.2RC1 ?

Only the changelog in GIT . But Icewind mentioned in https://github.com/nextcloud/server/issues/26457#issuecomment-822492940 it is fixed in the library . And now it has included in the current release candidate .

Supergamerx3000 commented 3 years ago

and in Nextcloud RC 20.0.10?

Michael2222 commented 3 years ago

With version 21.0.2RC1 it seems to be solved

It is also resolved the problem with sftp ?? => All office files corrupted #26303

lgnch commented 3 years ago

I know this is closed but for those stuck, this is confirmed as a fault in 20.0.9 as well as 21. 21.0.2RC1 confirmed as working, but it does break the pdf viewer which loses connection to the file on open. 20.0.10RC1 also fixes the same issued which is identical in 20.0.9, again with the same pdf viewer fault. Disabling pdf viewer allows download of the file so its a workaround for now.

amipatel428 commented 3 years ago

After upload file in next cloud the image is 0kb the size . solve this

RisedSky commented 3 years ago

After upload file in next cloud the image is 0kb the size . solve this

have you done the update to the latest version of nextcloud ?

dariodsa commented 2 years ago

I had that issues with external storages (Local share). As I concluded error was in stream_copy_to_stream function which nextcloud use if you have 64-bit architecture. I manually changed the if condition so now my Nextcloud use 32-bit architecture way of downloading. That resolved my problems, but I can't deduce why is there issue with stream_copy_to_stream.

GuyPaddock commented 2 years ago

@dariodsa Your issue sounds like the one I wrote up earlier today - #31361. Can you take a look?

MarcS1975 commented 2 years ago

Guys. I am really so grateful I found this thread. Replacing the old icewind files fixed the issue for me. After upgrading from NC 21 to 23.03, all SMB links failed to connect. I tried everything and could not fix this issue. So thank you thank you guys so much !!!

dariodsa commented 2 years ago

If you are having that kind of issue, why dont you consinder local smb mount which you will expose over Local storage? In that case you are avoiding that module.

On Sat, 16 Apr 2022, 01:47 MarcS1975, @.***> wrote:

Guys. I am really so grateful I found this thread. Replacing the old icewind files fixed the issue for me. After upgrading from NC 21 to 23.03, all SMB links failed to connect. I tried everything and could not fix this issue. So thank you thank you guys so much !!!

— Reply to this email directly, view it on GitHub https://github.com/nextcloud/server/issues/26457#issuecomment-1100473241, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7DGPS6PLBPEGKWCQJL5A3VFH5YFANCNFSM42SOJOXQ . You are receiving this because you were mentioned.Message ID: @.***>

Taomyn commented 2 years ago

If you are having that kind of issue, why dont you consinder local smb mount which you will expose over Local storage? In that case you are avoiding that module. On Sat, 16 Apr 2022, 01:47 MarcS1975, @.> wrote: Guys. I am really so grateful I found this thread. Replacing the old icewind files fixed the issue for me. After upgrading from NC 21 to 23.03, all SMB links failed to connect. I tried everything and could not fix this issue. So thank you thank you guys so much !!! — Reply to this email directly, view it on GitHub <#26457 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7DGPS6PLBPEGKWCQJL5A3VFH5YFANCNFSM42SOJOXQ . You are receiving this because you were mentioned.Message ID: @.>

Easy, permissions - if you have a 100 users connecting to a share each with different permissions to that share, which would you mount?

dariodsa commented 2 years ago

Mount it with a global all permission service account and do your permission on a Nextcloud side. Expose some of the folders to specific parts of a users. Now nextcloud doesn't know your credentials to smb share, but downside is that you can't show him only specific files.

sub, 16. tra 2022. u 10:20 Taomyn @.***> napisao je:

If you are having that kind of issue, why dont you consinder local smb mount which you will expose over Local storage? In that case you are avoiding that module. … <#m6298073299704870113> On Sat, 16 Apr 2022, 01:47 MarcS1975, @.> wrote: Guys. I am really so grateful I found this thread. Replacing the old icewind files fixed the issue for me. After upgrading from NC 21 to 23.03, all SMB links failed to connect. I tried everything and could not fix this issue. So thank you thank you guys so much !!! — Reply to this email directly, view it on GitHub <#26457 (comment) https://github.com/nextcloud/server/issues/26457#issuecomment-1100473241>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7DGPS6PLBPEGKWCQJL5A3VFH5YFANCNFSM42SOJOXQ https://github.com/notifications/unsubscribe-auth/AA7DGPS6PLBPEGKWCQJL5A3VFH5YFANCNFSM42SOJOXQ . You are receiving this because you were mentioned.Message ID: @.>

Easy, permissions - if you have a 100 users connecting to a share each with different permissions to that share, which would you mount?

— Reply to this email directly, view it on GitHub https://github.com/nextcloud/server/issues/26457#issuecomment-1100604946, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7DGPUMYTMI76EVF2JENH3VFJZ45ANCNFSM42SOJOXQ . You are receiving this because you were mentioned.Message ID: @.***>