Open imolb opened 2 years ago
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.
Hi can you also install procps as recommended in the docs: https://github.com/nextcloud/docker/blob/master/.examples/dockerfiles/smb/apache/Dockerfile
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.
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
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.
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.
Problem still exists with nextcloud 25.0.7 on Debian 11.
I confirm same issue here as this https://github.com/nextcloud/server/issues/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 <
at 2023-06-03T20:00:11+00:00`
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.
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
Have same issue, and if I install php-smbclient, external storage just do no work anymore until I remove it.
also have some issues related to this. installing smbclient dont fix it, but my install dont break either
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.
Has been going for years and nobody at NC is interested in foxing SMB functionality. They want to be a file sharing platform but do not support the biggest and most common file transfer protocol. Go figure :)
On Tue, Oct 24, 2023 at 10:49 PM mrmaciejo @.***> wrote:
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.
— Reply to this email directly, view it on GitHub https://github.com/nextcloud/server/issues/41114, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMNNHGU6MJXBXJ2SQTXJ5YTYBAZVVAVCNFSM6AAAAAAYYG77D6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZYGA4TMNRSGY . You are receiving this because you commented.Message ID: @.***>
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:
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.
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:Can one of you you try manually connecting to your SMB server with
smbclient
and provide the output off theallinfo
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 thesmbclient
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.
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).
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)
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.
2 years later and same error still here. Thats ridiculous
This issue still exists in version 29.0.3
I just see tons of variants how to break my nextcloud installation
This was resolved on my Debian bullseye by installing pecl smbclient extension https://pecl.php.net/package/smbclient
Somebody please tell me how you are installing this additional pecl php smbclient in docker envoronment? Truenas -> Nextcloud Container?
I'm installing it according to this doc:
https://github.com/nextcloud/docker/tree/master/.examples#php-module-smbclient
everything installes perfectly, I even see php extension installed by running php -m, but as soon as I restart my nextcloud instance the configuration returns everything back to its previous (native) installation through Truenas and I no longer see smbclient in the php extensions.
⚠️ This issue respects the following points: ⚠️
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
Steps to reproduce
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?
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
Problem arose after upgrade of nextcloud sever (major versions). Worked well before.
There is an similar bug nextcloud/server#30751 created recently also effecting the external SMB but with different error message. Bug nextcloud/server#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