Smb: file size-dependent copy failure

What is the problem you are having with rclone?

I am using using the 'smb' backend to interact with a Windows Share from a containerized ubuntu environment. I have found that files <= 127 KiB will successfully transfer but > 127 KiB will fail to copy. Other operations like file listings work great.

Run the command 'rclone version' and share the full output of the command.

ubuntu [/mnt/code]: rclone --version
rclone v1.65.2-DEV
- os/version: ubuntu 20.04 (64 bit)
- os/kernel: 3.10.0-1160.108.1.el7.x86_64 (x86_64)
- os/type: linux
- os/arch: amd64
- go/version: go1.21.6
- go/linking: static
- go/tags: none

Which cloud storage system are you using? (eg Google Drive)

smb

The command you were trying to run (eg rclone copy /tmp remote:tmp)

rclone copy -vv large_file.dat remote:MyShare/Path/Folder

Please run 'rclone config redacted' and share the full output.

ubuntu [/mnt/code]: rclone config show remote
[remote]
type = smb
host = <share ip>
port = 139
user = <username>
pass = *** ENCRYPTED ***
domain = ad

A log from the command that you were trying to run with the -vv flag

Success copy:
ubuntu [/mnt/code]: rclone copy -vv small_file.dat remote:MyShare/Path/Folder
2024/03/08 15:39:49 DEBUG : rclone: Version "v1.65.2-DEV" starting with parameters ["rclone" "copy" "-vv" "small_file.dat" "remote:MyShare/Path/Folder"]
2024/03/08 15:39:49 DEBUG : Creating backend with remote "small_file.dat"
2024/03/08 15:39:49 DEBUG : Using config file from "/home/ubuntu/.config/rclone/rclone.conf"
2024/03/08 15:39:49 DEBUG : fs cache: adding new entry for parent of "small_file.dat", "/mnt/code"
2024/03/08 15:39:49 DEBUG : Creating backend with remote "remote:MyShare/Path/Folder"
2024/03/08 15:39:49 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Using root directory "MyShare/Path/Folder"
2024/03/08 15:39:49 DEBUG : small_file.dat: Need to transfer - File not found at Destination
2024/03/08 15:39:50 DEBUG : small_file.dat.wusabak6.partial: renamed to: small_file.dat
2024/03/08 15:39:50 INFO  : small_file.dat: Copied (new)
2024/03/08 15:39:50 INFO  : 
Transferred:             63 B / 63 B, 100%, 0 B/s, ETA -
Transferred:            1 / 1, 100%
Elapsed time:         0.1s
2024/03/08 15:39:50 DEBUG : 11 go routines active
2024/03/08 15:39:50 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Closing 2 unused connections

# small_file.dat is 63 Bytes
 
Failed copy:
ubuntu [/mnt/code]: rclone copy -vv large_file.dat remote:MyShare/Path/Folder
2024/03/08 15:39:22 DEBUG : rclone: Version "v1.65.2-DEV" starting with parameters ["rclone" "copy" "-vv" "large_file.dat" "remote:MyShare/Path/Folder"]
2024/03/08 15:39:22 DEBUG : Creating backend with remote "large_file.dat"
2024/03/08 15:39:22 DEBUG : Using config file from "/home/ubuntu/.config/rclone/rclone.conf"
2024/03/08 15:39:22 DEBUG : fs cache: adding new entry for parent of "large_file.dat", "/mnt/code"
2024/03/08 15:39:22 DEBUG : Creating backend with remote "remote:MyShare/Path/Folder"
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Using root directory "MyShare/Path/Folder"
2024/03/08 15:39:22 DEBUG : large_file.dat: Need to transfer - File not found at Destination
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40936-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: read tcp <host ip>:40936-><share ip>:139: read: connection reset by peer
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: read tcp <host ip>:40936-><share ip>:139: read: connection reset by peer
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40936-><share ip>:139: write: broken pipe - low level retry 0/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40940-><share ip>:139: write: connection reset by peer - low level retry 1/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40946-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40946-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: write tcp <host ip>:40946-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40946-><share ip>:139: write: broken pipe - low level retry 2/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40948-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40948-><share ip>:139: write: connection reset by peer - low level retry 3/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40950-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: read tcp <host ip>:40950-><share ip>:139: read: connection reset by peer
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: read tcp <host ip>:40950-><share ip>:139: read: connection reset by peer
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40950-><share ip>:139: write: broken pipe - low level retry 4/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40952-><share ip>:139: write: connection reset by peer - low level retry 5/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40954-><share ip>:139: write: connection reset by peer - low level retry 6/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: EOF
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: EOF
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40956-><share ip>:139: write: connection reset by peer - low level retry 7/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40958-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40958-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: write tcp <host ip>:40958-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40958-><share ip>:139: write: connection reset by peer - low level retry 8/10
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to close the file for delete: close MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40960-><share ip>:139: write: broken pipe
2024/03/08 15:39:22 DEBUG : large_file.dat.doqawun9.partial: failed to remove: remove MyShare\Path\large_file.dat.doqawun9.partial: connection error: read tcp <host ip>:40960-><share ip>:139: read: connection reset by peer
2024/03/08 15:39:22 DEBUG : smb://<username>@<share ip>:139/MyShare/Path/Folder: Connection failed, closing: stat : connection error: read tcp <host ip>:40960-><share ip>:139: read: connection reset by peer
2024/03/08 15:39:22 DEBUG : large_file.dat: Received error: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40960-><share ip>:139: write: broken pipe - low level retry 9/10
2024/03/08 15:39:22 ERROR : large_file.dat: Failed to copy: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40960-><share ip>:139: write: broken pipe
2024/03/08 15:39:23 INFO  : large_file.dat.doqawun9.partial: Removing failed copy
2024/03/08 15:39:23 ERROR : Attempt 1/3 failed with 1 errors and: Update ReadFrom failed: write MyShare\Path\large_file.dat.doqawun9.partial: connection error: write tcp <host ip>:40960-><share ip>:139: write: broken pipe
2024/03/08 15:39:23 DEBUG : large_file.dat: Need to transfer - File not found at Destination

# large_file.dat is 20 megabytes

That 128k threshold is familiar but I can't think why at the moment...

It seems to cause a problem with the TCP connection. I think this is the underlying error

Indicating that the other end closed the connection. This could be some sort of firewall thing I guess, but doesn't seem particularly likely.

It would be worth trying the newly released v1.66 as this has an updated smb library - maybe that will help.

Thank you for the quick response/suggestion! I installed v1.66.0 and unfortunately the same error occurs.

What is the reason to use such old kernel (released 2013, EOL 2017)? Is it some custom build? Normally this Ubuntu version would use 5.15.

Good question. I'm not sure. I'll have to ask my sys admins that. Think that could be playing a role in this issue?

You have to use the HWE kernels.

Ubuntu kernel lifecycle and enablement stack | Ubuntu

Which can be done post install or during the install.

I am not sure - but I agree that it looks like some underlying network issue. And this kernel version tells me that it is not normal consumer system... and enterprise ones have often weird settings local admins believe are needed.

It was worth a try!

Can you try some different machines (eg from your laptop) or a different server and see if you get the same result? Likewise try accessing a different SMB server.

If you captured a wireshark trace of the connection reset, that might shed some light too.

I'm struggling to think of a solution at the moment so we need more data.

I really appreciate everyone's time and thoughts! I reached out to a sys admin and he's going to help investigate the kernel and potential firewall issues. I will report back with the solution if one is found. Thanks again!

1 Like

Wanted to update that it's still being looked into by my sys admin (they're busy so probably will take a bit). But I was able to find out my oddly outdated kernel is coming from my host's OS which is still RHEL 7 which uses the kernel shown above. My workspace OS is Ubuntu 20.04 because it's a docker container. I'm pretty sure containers use the host kernel. Not an expert but hopefully that explains that aspect.

1 Like

Thanks for the update.

I believe you are correct, yes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.