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

[Bug]: SMB webdav Exception "Malformed state response from server", "Undefined index: attributes" #41114

Open
5 of 8 tasks
imolb opened this issue Jun 16, 2022 · 70 comments
Open
5 of 8 tasks
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug feature: external storage

Comments

@imolb
Copy link

imolb commented Jun 16, 2022

⚠️ This issue respects the following points: ⚠️

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date. See Maintenance and Release Schedule for supported versions.
  • I agree to follow Nextcloud's Code of Conduct.

Bug description

Files can not be synchronized from an Android device with "Nextcloud Android App" into the SMB storage location.
Or alternatively files can not be moved within the SMB storage via the browser GUI.
Instead the following errors are reported

webdav: Icewind\SMB\Exception\Exception: Malformed state response from server
PHP: Error: Undefined index: attributes at /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php#155

Steps to reproduce

  1. Install nextcloud version 24.0.1 on a Debian 11 Bullseye server
  2. Install the smbclient 4.13.13 to attach SMB-shares as external storage
  3. Attach external storage backend by a SMB-share on same Debian 11 Bullseye Server
  4. Install Nextcloud Android App 3.20.3. on mobile device
  5. Configure folder for automated sync in the mobile App
  6. Put files in the configured folder on the mobile device

Instead of step 4. to 6. also a file within the SMB share could be moved in the browser GUI.

Expected behavior

The file is uploaded to Nextcloud storage.

Installation method

Manual installation

Operating system

Debian/Ubuntu

PHP engine version

PHP 7.4

Web server

Apache (supported)

Database engine version

MySQL

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "nas",
            "192.168.178.2"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "24.0.1.1",
        "overwrite.cli.url": "http:\/\/nas\/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,
        "memcache.local": "OC\\Memcache\\APCu",
        "maintenance": false,
        "updater.secret": "***REMOVED SENSITIVE VALUE***",
        "theme": "",
        "default_phone_region": "DE",
        "loglevel": 2
    }
}

List of activated Apps

Enabled:
  - accessibility: 1.10.0
  - activity: 2.16.0
  - bruteforcesettings: 2.4.0
  - circles: 24.0.0
  - cloud_federation_api: 1.7.0
  - comments: 1.14.0
  - contactsinteraction: 1.5.0
  - dashboard: 7.4.0
  - dav: 1.22.0
  - federatedfilesharing: 1.14.0
  - federation: 1.14.0
  - files: 1.19.0
  - files_external: 1.16.1
  - files_pdfviewer: 2.5.0
  - files_rightclick: 1.3.0
  - files_sharing: 1.16.2
  - files_trashbin: 1.14.0
  - files_versions: 1.17.0
  - files_videoplayer: 1.13.0
  - firstrunwizard: 2.13.0
  - logreader: 2.9.0
  - lookup_server_connector: 1.12.0
  - nextcloud_announcements: 1.13.0
  - notifications: 2.12.0
  - oauth2: 1.12.0
  - password_policy: 1.14.0
  - photos: 1.6.0
  - privacy: 1.8.0
  - provisioning_api: 1.14.0
  - recommendations: 1.3.0
  - serverinfo: 1.14.0
  - settings: 1.6.0
  - sharebymail: 1.14.0
  - support: 1.7.0
  - survey_client: 1.12.0
  - systemtags: 1.14.0
  - text: 3.5.1
  - theming: 1.15.0
  - twofactor_backupcodes: 1.13.0
  - updatenotification: 1.14.0
  - user_status: 1.4.0
  - viewer: 1.8.0
  - weather_status: 1.4.0
  - workflowengine: 2.6.0
Disabled:
  - admin_audit
  - encryption
  - user_ldap

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

{"reqId":"FceDSTAlNuE352FOXF9n","level":3,"time":"2022-06-16T16:25:10+00:00","remoteAddr":"192.168.178.3","user":"myuser","app":"PHP","method":"MOVE","url":"/nextcloud/remote.php/dav/uploads/myuser/3459361d5ffa26fc8c8e1746e5cd1e93/.file","message":"Undefined index: attributes at /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php#155","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.20.3","version":"24.0.1.1","exception":{"Exception":"Error","Message":"Undefined index: attributes at /var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php#155","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php","line":155,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php","line":217,"function":"parseStat","class":"Icewind\\SMB\\Wrapped\\Parser","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":193,"function":"stat","class":"Icewind\\SMB\\Wrapped\\Share","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":668,"function":"getFileInfo","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php","line":244,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1345,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1390,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":231,"function":"getFileInfo","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":754,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":590,"function":"getCopyAndMoveInfo","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":352,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":166,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}
{"reqId":"FceDSTAlNuE352FOXF9n","level":4,"time":"2022-06-16T16:25:10+00:00","remoteAddr":"192.168.178.3","user":"myuser","app":"webdav","method":"MOVE","url":"/nextcloud/remote.php/dav/uploads/myuser/3459361d5ffa26fc8c8e1746e5cd1e93/.file","message":"Malformed state response from server","userAgent":"Mozilla/5.0 (Android) Nextcloud-android/3.20.3","version":"24.0.1.1","exception":{"Exception":"Icewind\\SMB\\Exception\\Exception","Message":"Malformed state response from server","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php","line":217,"function":"parseStat","class":"Icewind\\SMB\\Wrapped\\Parser","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":193,"function":"stat","class":"Icewind\\SMB\\Wrapped\\Share","type":"->"},{"file":"/var/www/nextcloud/apps/files_external/lib/Lib/Storage/SMB.php","line":668,"function":"getFileInfo","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OCA\\Files_External\\Lib\\Storage\\SMB","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Availability.php","line":244,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php","line":227,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1345,"function":"file_exists","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->"},{"file":"/var/www/nextcloud/lib/private/Files/View.php","line":1390,"function":"getCacheEntry","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php","line":231,"function":"getFileInfo","class":"OC\\Files\\View","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php","line":78,"function":"getChild","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":754,"function":"getNodeForPath","class":"Sabre\\DAV\\Tree","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":590,"function":"getCopyAndMoveInfo","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpMove","class":"Sabre\\DAV\\CorePlugin","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/lib/Server.php","line":352,"function":"exec","class":"Sabre\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/apps/dav/appinfo/v2/remote.php","line":35,"function":"exec","class":"OCA\\DAV\\Server","type":"->"},{"file":"/var/www/nextcloud/remote.php","line":166,"args":["/var/www/nextcloud/apps/dav/appinfo/v2/remote.php"],"function":"require_once"}],"File":"/var/www/nextcloud/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php","Line":157,"CustomMessage":"--"}}

Additional info

Problem arose after upgrade of nextcloud sever (major versions). Worked well before.

There is an similar bug #30751 created recently also effecting the external SMB but with different error message. Bug #30751 reports "Unknown error (NT_STATUS_OBJECT_NAME_INVALID)", this bug reports "Undefined index: attributes".

The problem is also mentioned in the nextcloud.com forum: https://help.nextcloud.com/t/smb-share-not-available/134928

@imolb imolb added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Jun 16, 2022
@dansil
Copy link

dansil commented Jul 1, 2022

Same here.

@raziel83257
Copy link

Hi guys,
I had this errors:
message":"fseek(): stream does not support seeking at /var/www/nextcloud/apps/files_external/3rdparty/icewind/streams/src/Wrapper.php#46"
and
"message":"Malformed state response from server","userAgent":"Mozilla/5.0 (Windows) mirall/3.5.2stable-Win64 (build 20220701) (Nextcloud, windows-10.0.22000 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"23.0.3.2","exception":{"Exception":"Icewind\SMB\Exception\Exception","Message":"Malformed state response from server"

I don't know exactly why, but applying the following lines seems to have solved my problem :
apt install -y
apache2 libapache2-mod-php
mariadb-server openssl redis-server wget php-imagick
php-common php-curl php-gd php-gmp php-bcmath php-imap
php-intl php-json php-mbstring php-mysql php-ssh2 php-xml
php-zip php-apcu php-redis php-ldap php-phpseclib

apt-get install -y libsmbclient-dev php-dev php-pear

pecl channel-update pecl.php.net
mkdir -p /tmp/pear/cache
pecl install smbclient-stable
echo "extension=smbclient.so" > /etc/php/7.4/mods-available/smbclient.ini
phpenmod smbclient
systemctl restart apache2

Maybe somebody can help me understand...

@kenzot11
Copy link

Same problem here with SMB shares.

@Starkstromkonsument
Copy link

Is this related to upstream issue icewind1991/SMB#109 ?

@imolb
Copy link
Author

imolb commented Jul 24, 2022

Is this related to upstream issue icewind1991/SMB#109 ?

I don't think so:

  1. Reading the existing content of the SMB share works fine.
  2. Calling $share->stat('my/directory') as mentioned in the issue Malformed state response from server icewind1991/SMB#109 does not trigger an error

@corincorvus
Copy link

Same Problem while uploading Files.
If i copy Files into the HDD the Cloud cant scan the files

@lexvx
Copy link

lexvx commented Oct 26, 2022

Same issue

@wji9na
Copy link

wji9na commented Oct 28, 2022

same issue started some days ago without any updates from my side.

@lexvx
Copy link

lexvx commented Oct 29, 2022

I solved this problem by installing the php-smb module.

@corincorvus
Copy link

I solved this problem by installing the php-smb module.

I already have installed the Module.

@lexvx
Copy link

lexvx commented Oct 29, 2022

I solved this problem by installing the php-smb module.

I already have installed the Module.

v8.0?

@wji9na
Copy link

wji9na commented Oct 29, 2022

I solved this problem by installing the php-smb module.

thank you for your reply solved by install php-smbclient for 7.4/8.0 and 8.1 php versions

@corincorvus
Copy link

I solved this problem by installing the php-smb module.

I already have installed the Module.

v8.0?

On my Cloud at Home i have 7.4. On the Cloud on my Work we have 8.0, but the same issue.


PHP 7.4.30 (cli) (built: Jul  7 2022 15:51:43) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
    with Zend OPcache v7.4.30, Copyright (c), by Zend Technologies
dante@cloud ~$ php -m
[PHP Modules]
apcu
bcmath
bz2
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
intl
json
ldap
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

dante@cloud ~$ sudo apt-get install smbclient
[sudo] password for dante: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
smbclient is already the newest version (2:4.13.13+dfsg-1~deb11u5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.


@lexvx
Copy link

lexvx commented Oct 30, 2022

sudo apt install php8.1-smbclient

@corincorvus
Copy link

Unable to locate package php8.1-smbclient

@lexvx
Copy link

lexvx commented Oct 30, 2022

Try
apt install php8.0-smbclient (or choose your version)

@corincorvus
Copy link

corincorvus commented Oct 30, 2022

I already wrote, i installed 7.4 smb Client.
Same issue

@corincorvus
Copy link

corincorvus commented Nov 9, 2022

Nextcloud in Docker with PHP 8.0

Scan Folder:

Exception during scan: Undefined array key "attributes"
#0 /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php(155): OCA\Files\Command\Scan->exceptionErrorHandler(2, 'Undefined array...', '/var/www/html/a...', 155)
nextcloud/server#1 /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php(217): Icewind\SMB\Wrapped\Parser->parseStat(Array)
nextcloud/server#2 /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php(193): Icewind\SMB\Wrapped\Share->stat('/Hoerbuecher & ...')
nextcloud/server#3 /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php(645): OCA\Files_External\Lib\Storage\SMB->getFileInfo('/Hoerbuecher & ...')
nextcloud/server#4 /var/www/html/lib/private/Files/Storage/Common.php(115): OCA\Files_External\Lib\Storage\SMB->filetype('Hoerbuecher & H...')
nextcloud/server#5 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(114): OC\Files\Storage\Common->is_dir('Hoerbuecher & H...')
nextcloud/server#6 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(114): OC\Files\Storage\Wrapper\Wrapper->is_dir('Hoerbuecher & H...')
nextcloud/server#7 /var/www/html/lib/private/Files/Storage/Wrapper/Availability.php(131): OC\Files\Storage\Wrapper\Wrapper->is_dir('Hoerbuecher & H...')
nextcloud/server#8 /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php(114): OC\Files\Storage\Wrapper\Availability->is_dir('Hoerbuecher & H...')
nextcloud/server#9 /var/www/html/apps/workflowengine/lib/Check/FileMimeType.php(126): OC\Files\Storage\Wrapper\Wrapper->is_dir('Hoerbuecher & H...')
nextcloud/server#10 /var/www/html/apps/workflowengine/lib/Check/FileMimeType.php(109): OCA\WorkflowEngine\Check\FileMimeType->getActualValue()
nextcloud/server#11 /var/www/html/apps/workflowengine/lib/Service/RuleMatcher.php(245): OCA\WorkflowEngine\Check\FileMimeType->executeCheck('is', '/image\\/.*/')
nextcloud/server#12 /var/www/html/apps/workflowengine/lib/Service/RuleMatcher.php(180): OCA\WorkflowEngine\Service\RuleMatcher->check(Array)
nextcloud/server#13 /var/www/html/apps/workflowengine/lib/Service/RuleMatcher.php(128): OCA\WorkflowEngine\Service\RuleMatcher->getMatchingOperations('OCA\\FilesAutoma...', false)
nextcloud/server#14 /var/www/html/apps/files_automatedtagging/lib/Operation.php(95): OCA\WorkflowEngine\Service\RuleMatcher->getFlows(false)
nextcloud/server#15 /var/www/html/apps/files_automatedtagging/lib/Listener/CacheListener.php(43): OCA\FilesAutomatedTagging\Operation->checkOperations(Object(OCA\Files_Trashbin\Storage), 2021870, 'Hoerbuecher & H...')
nextcloud/server#16 /var/www/html/lib/private/EventDispatcher/ServiceEventListener.php(87): OCA\FilesAutomatedTagging\Listener\CacheListener->handle(Object(OCP\Files\Cache\CacheEntryUpdatedEvent))
nextcloud/server#17 /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php(251): OC\EventDispatcher\ServiceEventListener->__invoke(Object(OCP\Files\Cache\CacheEntryUpdatedEvent), 'OCP\\Files\\Cache...', Object(Symfony\Component\EventDispatcher\EventDispatcher))
nextcloud/server#18 /var/www/html/3rdparty/symfony/event-dispatcher/EventDispatcher.php(73): Symfony\Component\EventDispatcher\EventDispatcher->callListeners(Array, 'OCP\\Files\\Cache...', Object(OCP\Files\Cache\CacheEntryUpdatedEvent))
nextcloud/server#19 /var/www/html/lib/private/EventDispatcher/EventDispatcher.php(88): Symfony\Component\EventDispatcher\EventDispatcher->dispatch(Object(OCP\Files\Cache\CacheEntryUpdatedEvent), 'OCP\\Files\\Cache...')
nextcloud/server#20 /var/www/html/lib/private/EventDispatcher/EventDispatcher.php(100): OC\EventDispatcher\EventDispatcher->dispatch('OCP\\Files\\Cache...', Object(OCP\Files\Cache\CacheEntryUpdatedEvent))
nextcloud/server#21 /var/www/html/lib/private/Files/Cache/Cache.php(420): OC\EventDispatcher\EventDispatcher->dispatchTyped(Object(OCP\Files\Cache\CacheEntryUpdatedEvent))
nextcloud/server#22 /var/www/html/lib/private/Files/Cache/Wrapper/CacheWrapper.php(145): OC\Files\Cache\Cache->update(2021870, Array)
nextcloud/server#23 /var/www/html/lib/private/Files/Cache/Scanner.php(293): OC\Files\Cache\Wrapper\CacheWrapper->update(2021870, Array)
nextcloud/server#24 /var/www/html/lib/private/Files/Cache/Scanner.php(226): OC\Files\Cache\Scanner->addToCache('Hoerbuecher & H...', Array, 2021870)
nextcloud/server#25 /var/www/html/lib/private/Files/Cache/Scanner.php(438): OC\Files\Cache\Scanner->scanFile('Hoerbuecher & H...', 3, 2021830, Object(OC\Files\Cache\CacheEntry), true, Array)
nextcloud/docker#26 /var/www/html/lib/private/Files/Cache/Scanner.php(390): OC\Files\Cache\Scanner->handleChildren('Hoerbuecher & H...', true, 3, 2021830, true, 0)
nextcloud/server#27 /var/www/html/lib/private/Files/Cache/Scanner.php(393): OC\Files\Cache\Scanner->scanChildren('Hoerbuecher & H...', true, 3, 2021830, true)
nextcloud/server#28 /var/www/html/lib/private/Files/Cache/Scanner.php(393): OC\Files\Cache\Scanner->scanChildren('Hoerbuecher & H...', true, 3, 2021829, true)
nextcloud/server#29 /var/www/html/lib/private/Files/Cache/Scanner.php(393): OC\Files\Cache\Scanner->scanChildren('Hoerbuecher & H...', true, 3, 2020052, true)
nextcloud/server#30 /var/www/html/lib/private/Files/Cache/Scanner.php(342): OC\Files\Cache\Scanner->scanChildren('Hoerbuecher & H...', true, 3, 2020041, true)
nextcloud/server#31 /var/www/html/lib/private/Files/Utils/Scanner.php(256): OC\Files\Cache\Scanner->scan('Hoerbuecher & H...', true, 3)
nextcloud/server#32 /var/www/html/apps/files/lib/Command/Scan.php(144): OC\Files\Utils\Scanner->scan('/corin.corvus/f...', true, NULL)
nextcloud/server#33 /var/www/html/apps/files/lib/Command/Scan.php(200): OCA\Files\Command\Scan->scanFiles('corin.corvus', '/corin.corvus/f...', Object(Symfony\Component\Console\Output\ConsoleOutput), false, true, false)
nextcloud/server#34 /var/www/html/3rdparty/symfony/console/Command/Command.php(255): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#35 /var/www/html/core/Command/Base.php(168): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#36 /var/www/html/3rdparty/symfony/console/Application.php(1009): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#37 /var/www/html/3rdparty/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#38 /var/www/html/3rdparty/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#39 /var/www/html/lib/private/Console/Application.php(211): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
nextcloud/server#40 /var/www/html/console.php(100): OC\Console\Application->run()
nextcloud/server#41 /var/www/html/occ(11): require_once('/var/www/html/c...')
nextcloud/server#42 {main}
+---------+-------+--------------+
| Folders | Files | Elapsed time |
+---------+-------+--------------+
| 4       | 1     | 00:00:00     |
+---------+-------+--------------+

Version: 8.0.24
Speicherlimit: 4 GB
Maximale Ausführungszeit: 3600
Maximale Größe zum Hochladen: 20 GB
Erweiterungen: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, pdo_sqlite, session, posix, Reflection, standard, SimpleXML, Phar, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, apache2handler, apcu, bcmath, exif, gd, gmp, imagick, intl, ldap, memcached, pcntl, pdo_mysql, pdo_pgsql, redis, sodium, zip, Zend OPcache

In the Container:

root@b751997e9419:/var/www/html# apt-get install php8.0-smbclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package php8.0-smbclient
E: Couldn't find any package by glob 'php8.0-smbclient'
E: Couldn't find any package by regex 'php8.0-smbclient'
root@b751997e9419:/var/www/html# apt-get install php-smbclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package php-smbclient
root@b751997e9419:/var/www/html# apt-get install smbclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
smbclient is already the newest version (2:4.13.13+dfsg-1~deb11u5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@b751997e9419:/var/www/html# 

The Docker Image is official Nextcloud Image with this:

FROM nextcloud:24.0.7

RUN set -x \
	&& apt-get update \
	&& apt-get install -y libmagickcore-6.q16-6-extra smbclient \
	&& rm -rf /var/lib/apt/lists/*

Same Server, Same Docker, other External Storage Folder work:
grafik

@mikenest
Copy link

This was resolved on my Debian bullseye by installing pecl smbclient extension https://pecl.php.net/package/smbclient

@corincorvus
Copy link

corincorvus commented Nov 18, 2022

I already wrote, i installed 7.4 smb Client. Same issue

i already installed smbclient... i wrote it 4 times. It not solve the Problem.
Its in the Container, its on the native installation, its on my test installation. All the Time the same Problem with the same and other external storage, with different php installations, all with debian rootsystem. No Solution.

root@0b7c0aecfaf3:/var/www/html# apt-get install libsmbclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libsmbclient is already the newest version (2:4.13.13+dfsg-1~deb11u5).
libsmbclient set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
root@0b7c0aecfaf3:/var/www/html# apt-get install smbclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
smbclient is already the newest version (2:4.13.13+dfsg-1~deb11u5).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

@corincorvus
Copy link

Same on generate previews.


2022-11-20T15:22:40+00:00 In Parser.php line 157:
2022-11-20T15:22:40+00:00                                         
2022-11-20T15:22:40+00:00   [Icewind\SMB\Exception\Exception]     
2022-11-20T15:22:40+00:00   Malformed state response from server  
2022-11-20T15:22:40+00:00                                         
2022-11-20T15:22:40+00:00 
2022-11-20T15:22:40+00:00 Exception trace:
2022-11-20T15:22:40+00:00   at /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php:157
2022-11-20T15:22:40+00:00  Icewind\SMB\Wrapped\Parser->parseStat() at /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php:217
2022-11-20T15:22:40+00:00  Icewind\SMB\Wrapped\Share->stat() at /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php:191
2022-11-20T15:22:40+00:00  OCA\Files_External\Lib\Storage\SMB->getFileInfo() at /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php:666
2022-11-20T15:22:40+00:00  OCA\Files_External\Lib\Storage\SMB->file_exists() at /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php:227
2022-11-20T15:22:40+00:00  OC\Files\Storage\Wrapper\Wrapper->file_exists() at /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php:227
2022-11-20T15:22:40+00:00  OC\Files\Storage\Wrapper\Wrapper->file_exists() at /var/www/html/lib/private/Files/Storage/Wrapper/Availability.php:244
2022-11-20T15:22:40+00:00  OC\Files\Storage\Wrapper\Availability->file_exists() at /var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php:227
2022-11-20T15:22:40+00:00  OC\Files\Storage\Wrapper\Wrapper->file_exists() at /var/www/html/lib/private/Files/View.php:1349
2022-11-20T15:22:40+00:00  OC\Files\View->getCacheEntry() at /var/www/html/lib/private/Files/View.php:1394
2022-11-20T15:22:40+00:00  OC\Files\View->getFileInfo() at /var/www/html/lib/private/Files/Node/Root.php:205
2022-11-20T15:22:40+00:00  OC\Files\Node\Root->get() at /var/www/html/lib/private/Files/Node/Folder.php:138
2022-11-20T15:22:40+00:00  OC\Files\Node\Folder->get() at /var/www/html/lib/private/Files/Node/Folder.php:147
2022-11-20T15:22:40+00:00  OC\Files\Node\Folder->nodeExists() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:203
2022-11-20T15:22:40+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:214
2022-11-20T15:22:40+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:214
2022-11-20T15:22:40+00:00  OCA\PreviewGenerator\Command\Generate->parseFolder() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:185
2022-11-20T15:22:40+00:00  OCA\PreviewGenerator\Command\Generate->generatePathPreviews() at /var/www/html/custom_apps/previewgenerator/lib/Command/Generate.php:133
2022-11-20T15:22:40+00:00  OCA\PreviewGenerator\Command\Generate->execute() at /var/www/html/3rdparty/symfony/console/Command/Command.php:255
2022-11-20T15:22:40+00:00  Symfony\Component\Console\Command\Command->run() at /var/www/html/3rdparty/symfony/console/Application.php:1009
2022-11-20T15:22:40+00:00  Symfony\Component\Console\Application->doRunCommand() at /var/www/html/3rdparty/symfony/console/Application.php:273
2022-11-20T15:22:40+00:00  Symfony\Component\Console\Application->doRun() at /var/www/html/3rdparty/symfony/console/Application.php:149
2022-11-20T15:22:40+00:00  Symfony\Component\Console\Application->run() at /var/www/html/lib/private/Console/Application.php:213
2022-11-20T15:22:40+00:00  OC\Console\Application->run() at /var/www/html/console.php:100
2022-11-20T15:22:40+00:00  require_once() at /var/www/html/occ:11
2022-11-20T15:22:40+00:00 
2022-11-20T15:22:40+00:00 preview:generate-all [-p|--path [PATH]] [--] [<user_id>...]
2022-11-20T15:22:40+00:00

@PVince81
Copy link
Member

@corincorvus smbclient and libsmbclient are not enough, you also need the php bindings

I see that you attempted to install them in #41114 but the packages were not found. Maybe the packages are called differently on that distro ?

there might be distros that don't ship it as package, so need to use pecl to compile it

@corincorvus
Copy link

corincorvus commented Nov 23, 2022

Tell me the php package for the official Docker Container inclusive command please.
Distro: Debian 11 Bullseye stable

Container:

PHP Version in Docker Container:
root@abc52e34c8eb:/var/www/html# php -v
PHP 8.1.12 (cli) (built: Nov 15 2022 04:46:23) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.12, Copyright (c) Zend Technologies
with Zend OPcache v8.1.12, Copyright (c), by Zend Technologies

Repos of the Container:

root@abc52e34c8eb:/var/www/html# cat /etc/apt/sources.list
# deb http://snapshot.debian.org/archive/debian/20221114T000000Z bullseye main
deb http://deb.debian.org/debian bullseye main
# deb http://snapshot.debian.org/archive/debian-security/20221114T000000Z bullseye-security main
deb http://deb.debian.org/debian-security bullseye-security main
# deb http://snapshot.debian.org/archive/debian/20221114T000000Z bullseye-updates main
deb http://deb.debian.org/debian bullseye-updates main
root@abc52e34c8eb:/var/www/html# apt-get install php-smbclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package php-smbclient
root@abc52e34c8eb:/var/www/html# apt-get install php8.1-smbclient
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package php8.1-smbclient
E: Couldn't find any package by glob 'php8.1-smbclient'
E: Couldn't find any package by regex 'php8.1-smbclient'
root@abc52e34c8eb:/var/www/html# 

Image builded with:

FROM nextcloud:25.0.1

RUN set -x \
	&& apt-get update \
	&& apt-get install -y libmagickcore-6.q16-6-extra smbclient \
	&& rm -rf /var/lib/apt/lists/*

@PVince81
Copy link
Member

@szaimen can you help ? assuming that it's about the Docker all in one ^

maybe extra repos are required there

@szaimen
Copy link
Contributor

szaimen commented Nov 23, 2022

No, this one is not the AIO container image. In this case it most likely come from this repo: https://github.com/nextcloud/docker

@szaimen
Copy link
Contributor

szaimen commented Nov 23, 2022

In this case it most likely come from this repo: https://github.com/nextcloud/docker

and this one does indeed not include the smbclient by default afaik

@corincorvus
Copy link

corincorvus commented Nov 23, 2022

In this case it most likely come from this repo: https://github.com/nextcloud/docker

and this one does indeed not include the smbclient by default afaik

So i installed it:

FROM nextcloud:25.0.1

RUN set -x \
	&& apt-get update \
	&& apt-get install -y libmagickcore-6.q16-6-extra smbclient \
	&& rm -rf /var/lib/apt/lists/*

@szaimen
Copy link
Contributor

szaimen commented Nov 23, 2022

Please continue in nextcloud/docker#1638

@messnerfe
Copy link

Hi, I can say that updating did not fix the issue on my end.
After updating my docker image (running on a raspberry pi) first from 25.0.6 to 25.0.7, and then even to 26.0.2, the issue still persists.

I'm using the official docker image and install smbclient into it:

FROM nextcloud:26

RUN set -x \
        && apt-get update \
        && apt-get install -y libmagickcore-6.q16-6-extra smbclient \
        && rm -rf /var/lib/apt/lists/*

The strange thing is that it was working just fine for me until a few weeks ago. I really don't remember doing anyhting to the server or the attached storage.

The only other thing I can think of is that maybe the phone app got an update.?
I'm using Android, the app is currently at version 3.24.2.

But then again, that wouldn't explain why sometimes I can't move files from one place to another on the attached storage in the web gui (like imolb originally described), resulting in the same error message as when the phone app sync fails:

Error	webdav	Icewind\SMB\Exception\Exception: Malformed state response from server	
2023-06-02T09:00:14+0200
Error	PHP	Undefined array key "attributes" at /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php#155	
2023-06-02T09:00:14+0200

That might have to do with the size of the source folder I try to copy the file from.?
I first tried to copy a file from my "big" (~17GB) photo sync folder to another folder on the SMB-attached storage -> that failed.
Then I tried to copy from a smaller folder -> that worked.
I was also able to copy a file from the big folder to a location outside of the SMB attached storage just fine.

If you need additional information from me, I'll be happy to provide it.

@szaimen
Copy link
Contributor

szaimen commented Jun 2, 2023

Hi can you also install procps as recommended in the docs: https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/smb/apache/Dockerfile

@messnerfe
Copy link

Like this?

FROM nextcloud:26

RUN set -x \
        && apt-get update \
        && apt-get install -y procps libmagickcore-6.q16-6-extra smbclient \
        && rm -rf /var/lib/apt/lists/*

Doesn't seem to make a difference. The procps package also seems to be installed in the container already, if I don't explicitly include it in the dockerfile.

Same result if I use the exact dockerfile you linked.

@joshtrichards
Copy link
Member

joshtrichards commented Jun 2, 2023

The Apache Dockerfile example appears out of date.

It may work, but at best it'll be lower performing and less reliable since it uses the smbclient external binary rather than php-smbclient.

The correct approach for adding smb support appears to be in the full example from the looks of it, but it'll have to be adapted if you only want a few things:

https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/apache/Dockerfile

I suspect the smb one was overlooked maybe when the image base was switched to the community PHP one.

NOTE: Since the community Docker image is based on the community PHP image, just don't try to install PHP extensions by way of apt. If you do so, it'll overwrite the official PHP build in the image with Debian's. This'll effectively nullify the entire image's other configuration elements and deploy conflicting PHP versions in it. Here are the correct (but generic) instructions for adding PHP extensions to the Docker images (which appears to be used by the community Docker full dockerfile example):

https://github.com/docker-library/docs/blob/master/php/README.md#pecl-extensions

@MarcS1975
Copy link

MarcS1975 commented Jun 2, 2023

This is confusing to me. So a fileshare Application is based on a component that overlooked the most relaible and most used fileshare protocol in the entire world? Would it be possible to include smb support in the community docker image, given that this has caused major discussions in the forum for years? I am not complaining, just trying to understand the rationale and how I can help.

@szaimen szaimen transferred this issue from nextcloud/server Jun 2, 2023
@szaimen szaimen reopened this Jun 2, 2023
@messnerfe
Copy link

The correct approach for adding smb support appears to be in the full example from the looks of it, but it'll have to be adapted if you only want a few things:
https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/full/apache/Dockerfile

Thanks for pointing me to that, I hadn't fully read the file before. So I tried it like this:

FROM nextcloud:26

RUN set -x \
        && apt-get update \
        && apt-get install -y procps libsmbclient-dev smbclient \
        && rm -rf /var/lib/apt/lists/*
RUN pecl install smbclient
RUN docker-php-ext-enable smbclient

(the smbclient apt package still seems to be required, otherwiese nextcloud complains about missing the smb backend and won't connect the storage)

Now the photo sync from phone works, the file ends up on the server, but the app still reports it as failed with "unknown error".

Similarly, when I try to copy a file from a to b on the storage via web gui, it does copy successfully, but report it as failed, sometimes without a reason, sometimes it says the target already exists (which it definitely didn't before the copy). Moving, on the other hand, seems to work fine.

@imolb
Copy link
Author

imolb commented Jun 2, 2023

Problem still exists with nextcloud 25.0.7 on Debian 11.

@MarcS1975
Copy link

MarcS1975 commented Jun 4, 2023

I confirm same issue here as this #41114.
I am running 26.02 and after installing original NC community docker image and afterwards installing smbclient as described above.
Still getting SMB errors:

`[files] Error: Icewind\SMB\Exception\Exception: Unknown error () for [FOLDERNAME] at <>

  1. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Exception/Exception.php line 49
    Icewind\SMB\Exception\Exception::unknown("Instantupload I ... e", null)
  2. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php line 92
    Icewind\SMB\Exception\Exception::fromMap(["Icewind\SMB\ ... "], null, "Instantupload I ... e")
  3. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php line 479
    Icewind\SMB\Wrapped\Parser->checkForError([" . ... "], "Instantupload I ... e")
  4. /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Share.php line 178
    Icewind\SMB\Wrapped\Share->parseOutput([" . ... "], "Instantupload I ... e")
  5. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php line 244
    Icewind\SMB\Wrapped\Share->dir("Instantupload I ... e")
  6. /var/www/html/apps/files_external/lib/Lib/Storage/SMB.php line 631
    OCA\Files_External\Lib\Storage\SMB->getFolderContents("Instantupload I ... e")
  7. /var/www/html/lib/private/Files/Storage/Wrapper/PermissionsMask.php line 157
    OCA\Files_External\Lib\Storage\SMB->getDirectoryContent("Instantupload I ... e")
  8. <>
    OC\Files\Storage\Wrapper\PermissionsMask->getDirectoryContent("Instantupload I ... e")
  9. /var/www/html/lib/private/Files/Cache/Scanner.php line 403
    iterator_to_array(["Generator"])
  10. /var/www/html/lib/private/Files/Cache/Scanner.php line 382
    OC\Files\Cache\Scanner->handleChildren("Instantupload I ... e", 2, 3, 29284, true, 0)
  11. /var/www/html/lib/private/Files/Cache/Scanner.php line 385
    OC\Files\Cache\Scanner->scanChildren("Instantupload I ... e", 2, 3, 29284, true)
  12. /var/www/html/lib/private/Files/Cache/Scanner.php line 333
    OC\Files\Cache\Scanner->scanChildren("Instantupload Iphone 11 Pro/2023", 2, 3, 3010, true, ["httpd/unix-dir ... "])
  13. /var/www/html/lib/private/Files/Cache/Scanner.php line 529
    OC\Files\Cache\Scanner->scan("Instantupload Iphone 11 Pro/2023", 2, 3)
  14. /var/www/html/lib/private/Files/Cache/Scanner.php line 541
    OC\Files\Cache\Scanner->OC\Files\Cache{closure}("*** sensitive parameters replaced ***")
  15. /var/www/html/lib/private/Files/Cache/Scanner.php line 528
    OC\Files\Cache\Scanner->runBackgroundScanJob(["Closure"], "Instantupload Iphone 11 Pro/2023")
  16. /var/www/html/lib/private/Files/Utils/Scanner.php line 182
    OC\Files\Cache\Scanner->backgroundScan()
  17. /var/www/html/apps/files/lib/BackgroundJob/ScanFiles.php line 76
    OC\Files\Utils\Scanner->backgroundScan("")
  18. /var/www/html/apps/files/lib/BackgroundJob/ScanFiles.php line 113
    OCA\Files\BackgroundJob\ScanFiles->runScanner("nmax")
  19. /var/www/html/lib/public/BackgroundJob/Job.php line 78
    OCA\Files\BackgroundJob\ScanFiles->run(null)
  20. /var/www/html/lib/public/BackgroundJob/TimedJob.php line 103
    OCP\BackgroundJob\Job->start(["OC\BackgroundJob\JobList"])
  21. /var/www/html/lib/public/BackgroundJob/TimedJob.php line 93
    OCP\BackgroundJob\TimedJob->start(["OC\BackgroundJob\JobList"])
  22. /var/www/html/cron.php line 152
    OCP\BackgroundJob\TimedJob->execute(["OC\BackgroundJob\JobList"], ["OC\Log"])

at 2023-06-03T20:00:11+00:00`

@wobblywob
Copy link

Had this same issue on debian 12 (bookworm) and Nextcloud 26.0.2 native. php8.2-smbclient is not available via apt so I installed it via pecl and I think this solved it.

apt install php8.2-dev
pecl install smbclient-stable
echo "extension=smbclient.so" > /etc/php/8.2/mods-available/smbclient.ini
phpenmod smbclient

Then rebooted server.

@joshtrichards joshtrichards removed the bug label Aug 28, 2023
@flo-mic
Copy link

flo-mic commented Sep 28, 2023

For everyone who uses the alpine-fpm image, the following docker file will install the smb client for you. It adds 34MB to the target image

FROM nextcloud:26.0.7-fpm-alpine as base

RUN echo "**** install smb client libary ****" && \
    apk add --no-cache --upgrade \
        libsmbclient 


# Builder image to compile additional php extensions
From base as builder

RUN echo "**** install build packages ****" && \
    apk add --no-cache --upgrade \
        autoconf \
        g++ \
        gcc \
        make \
        samba-dev

RUN echo "**** configure php extensions ****" && \
    pecl install smbclient && \
    docker-php-ext-enable smbclient


# Final image with improved image size
FROM base as final

COPY --from=builder /usr/local/lib/php /usr/local/lib/php
COPY --from=builder /usr/local/etc/php /usr/local/etc/php

@Hoshikawakaguya
Copy link

Have same issue, and if I install php-smbclient, external storage just do no work anymore until I remove it.

@prilly-dev
Copy link

also have some issues related to this. installing smbclient dont fix it, but my install dont break either

@mrmaciejo
Copy link

Same here. I have 27.1.2 version and php 8.2.11 . All directories from SMB are functioning properly, except for the one where I store all my phone photos. It was working fine until 1-2 weeks ago. Could it be that it has reached some file limits or encountered another issue.

@MarcS1975

This comment was marked as off-topic.

@joshtrichards
Copy link
Member

The issue here is that the SMB server is returning a response that lacks attributes or is somehow formatting the attributes in an unexpected way:

https://github.com/icewind1991/SMB/blob/8531ffd1cbec85f7cde6152cdd67ed03a96bc0e0/src/Wrapped/Parser.php#L155-L157

Can one of you you try manually connecting to your SMB server with smbclient and provide the output off the allinfo command (against one of the target files that returns this error in Nextcloud):

smbclient -U USERNAME //IPorHostname/theRemoteSubfolder
(you'll be prompted for the share password)
allinfo folder/file

Example of checking the file perftest/blahfile.tmp located on mount //192.168.x.y/backups:

xxx@debian1:~/tmp$ smbclient -U someuser //192.168.x.y/backups
Password for [WORKGROUP\someuser]:
Try "help" to get a list of possible commands.
smb: \> allinfo perftest/blahfile.tmp
altname: blahfile.tmp
create_time:    Wed Jan  6 11:35:39 AM 2021 EST
access_time:    Wed Jan  6 11:35:39 AM 2021 EST
write_time:     Wed Jan  6 11:37:36 AM 2021 EST
change_time:    Wed Jan  6 11:37:36 AM 2021 EST
attributes: A (20)
stream: [::$DATA], 10485760 bytes
smb: \> 

If you want to be extra diligent, run smbclient from your Nextcloud host (or container, where applicable) in case there is some unique weirdness with the smbclient version deployed.

@Br4v3St4rr
Copy link

The issue here is that the SMB server is returning a response that lacks attributes or is somehow formatting the attributes in an unexpected way:

https://github.com/icewind1991/SMB/blob/8531ffd1cbec85f7cde6152cdd67ed03a96bc0e0/src/Wrapped/Parser.php#L155-L157

Can one of you you try manually connecting to your SMB server with smbclient and provide the output off the allinfo command (against one of the target files that returns this error in Nextcloud):

smbclient -U USERNAME //IPorHostname/theRemoteSubfolder
(you'll be prompted for the share password)
allinfo folder/file

Example of checking the file perftest/blahfile.tmp located on mount //192.168.x.y/backups:

xxx@debian1:~/tmp$ smbclient -U someuser //192.168.x.y/backups
Password for [WORKGROUP\someuser]:
Try "help" to get a list of possible commands.
smb: \> allinfo perftest/blahfile.tmp
altname: blahfile.tmp
create_time:    Wed Jan  6 11:35:39 AM 2021 EST
access_time:    Wed Jan  6 11:35:39 AM 2021 EST
write_time:     Wed Jan  6 11:37:36 AM 2021 EST
change_time:    Wed Jan  6 11:37:36 AM 2021 EST
attributes: A (20)
stream: [::$DATA], 10485760 bytes
smb: \> 

If you want to be extra diligent, run smbclient from your Nextcloud host (or container, where applicable) in case there is some unique weirdness with the smbclient version deployed.

So the issue is uploading to the folder and not listing the folder. So there is no way to check this as the file never makes it up there.

@e-patrick
Copy link

It is true that the problem arises when trying to upload a file, but anyway I attempted to find the requested information. For an existing file:

smb: \> allinfo Camera/2023/IMG20231010140921.jpg
altname: I3Z20M~0.JPG
create_time:    Sat Oct 28 18:40:09 2023 UTC
access_time:    Sat Oct 28 18:40:09 2023 UTC
write_time:     Sat Oct 28 18:40:09 2023 UTC
change_time:    Sat Oct 28 18:40:09 2023 UTC
attributes: A (20)
stream: [::$DATA], 2665132 bytes

For a non-existing file:

smb: \> allinfo Camera/2023/IMG2023101014091.jpg
NT_STATUS_OBJECT_NAME_NOT_FOUND getting alt name for \Camera\2023\IMG2023101014091.jpg

And then I modified the line in Parser.php to include the contents of the method's parameter $output by adding a print_r($output,true) to the throw command.

The log now contains "CustomMessage":"Malformed state response from server. output is Array\n(\n)\n", so apparently the parseStat method is passed an empty array in the $output parameter.

What makes me wonder is that some of my images make it up onto the server, for example one from yesterday did, while others keep failing (for example one from February fails ever since).

@karstenradatz
Copy link

karstenradatz commented Nov 21, 2023

Hello,

I have the same issue. NC is running on my QNAP as Docker container and a share from the QNAP is mounted as SMB external storage.

One of the many files causing the issue has been uploaded via QNAP Filestation and the allinfo for this one is:

smb: \> allinfo "PC Dateien/IMAG0492.jpg"
altname: IMAG0492.jpg
create_time:    Sat Mar  1 13:08:06 2014 UTC
access_time:    Tue Nov 21 22:00:51 2023 UTC
write_time:     Sat Mar  1 13:08:06 2014 UTC
change_time:    Sat Mar  1 13:08:06 2014 UTC
attributes:  (80)
stream: [::$DATA], 1029540 bytes

The attributes part looks different compared to what e-patrick posted.

A file which works with the upload gives this information (which is the same as from e-patrick):

smb: \> allinfo "PC Dateien/uwert.png"
altname: uwert.png
create_time:    Tue Nov 21 22:07:41 2023 UTC
access_time:    Tue Nov 21 22:07:41 2023 UTC
write_time:     Tue Nov 21 22:07:41 2023 UTC
change_time:    Tue Nov 21 22:07:41 2023 UTC
attributes: A (20)
stream: [::$DATA], 182317 bytes

***Edit:
It seems the Filestation is removing the Archive Attribute while uploading. Funnily the files worked after a successful upload when I uploaded only one by one or a small batch.

***Edit2:
When uploading another batch of 350 files the error came up again after successfully upload 110 files. But in the log I get e.g.:

/var/www/html/lib/private/Files/Node/Folder.php - line 144:
OC\Files\Node\Folder->get("Anleitung.md")

/var/www/html/apps/text/lib/Service/WorkspaceService.php - line 26:
OC\Files\Node\Folder->nodeExists("Anleitung.md")

But this files was definitely not in the uploaded batch of files (images only).
Also I see a lot of "file exists" entries in the log for files which are not in the folder.
The file which is reported in the log to already exist is not on the smb share:

smb: \> allinfo "PC Dateien\iCloud Photos\Downloads\2016\IMG_0111.JPG"
NT_STATUS_OBJECT_NAME_NOT_FOUND getting alt name for \PC Dateien\iCloud Photos\Downloads\2016\IMG_0111.JPG

***Edit3:
Even if I try to create a new folder via the UI it says in the log: "file exists" and in the second row "Undefined array key "attributes" at /var/www/html/apps/files_external/3rdparty/icewind/smb/src/Wrapped/Parser.php#155" while the smbclient within the container is able to create the new folder:

smb: \> md "PC Dateien\iCloud Photos\Downloads\2016\Neuer Ordner"
smb: \> allinfo "PC Dateien\iCloud Photos\Downloads\2016\Neuer Ordner"
altname: N4BIQL~M
create_time:    Tue Nov 21 23:24:20 2023 UTC
access_time:    Tue Nov 21 23:24:20 2023 UTC
write_time:     Tue Nov 21 23:24:20 2023 UTC
change_time:    Tue Nov 21 23:24:20 2023 UTC
attributes: D (10)

@stevenjoezhang
Copy link

I have encountered a similar issue and found that it's caused by https://github.com/nextcloud/text plugin when it's trying to access a non-existent README.md file inside a Samba share folder. After removing the text plugin, the issue was resolved. However, it's very strange because trying to access a non-existent is quite common and should be error-handled by Nextcloud samba client.

@Softbox44

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap 27-feedback bug feature: external storage
Projects
None yet
Development

No branches or pull requests