samba
samba copied to clipboard
[windows] The process cannot access the file because it is being used by another process
I tried to use following config args: ["-u", "$(USERNAME);$(PASSWORD)", "-s", "share;/smbshare/;yes;no;no;all;none", "-p"]
to set up a SMB server, and then mount one SMB share on multiple windows nodes, the first always succeeded, while the second mount always failed with The process cannot access the file because it is being used by another process
, this issue only happens on Windows, is there any config wrong? Thanks.
Microsoft Windows [Version 10.0.17763.1339]
(c) 2018 Microsoft Corporation. All rights reserved.
azureuser@3460k8s001 C:\Users\azureuser>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
PS C:\Users\azureuser> Get-SmbGlobalMapping
Status Local Path Remote Path
------ ---------- -----------
OK \\52.177.137.222\share
PS C:\Users\azureuser> exit
azureuser@3460k8s001 C:\Users\azureuser>mkdir /D abc \\52.177.137.222\share
The syntax of the command is incorrect.
azureuser@3460k8s001 C:\Users\azureuser>mklink /D abc \\52.177.137.222\share
symbolic link created for abc <<===>> \\52.177.137.222\share
azureuser@3460k8s001 C:\Users\azureuser>cd abc
The process cannot access the file because it is being used by another process.
I'm having the same issue and also the error "Handle is invalid" in Windows. From what I've read it's a problem in Samba 4.12.2 and it has been fixed in the next version. It would be great if @dperson could update.
Just checked and the latest version of Samba available in the Alpine 3.12 branch is 4.12.2r1, so this docker container cannot be updated.
A workaround is switching to the edge branch and updating Samba to 4.12.5r0 (and all the system) doing the following:
sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories
apk update
apk upgrade
I'm having the same issue and also the error "Handle is invalid" in Windows. From what I've read it's a problem in Samba 4.12.2 and it has been fixed in the next version. It would be great if @dperson could update.
Just checked and the latest version of Samba available in the Alpine 3.12 branch is 4.12.2r1, so this docker container cannot be updated. A workaround is switching to the edge branch and updating Samba to 4.12.5r0 (and all the system) doing the following:
sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories
apk update
apk upgrade
@TheGiolly thanks a lot! I could confirm that the fix(https://github.com/andyzhangx/samba/commit/26c899de02df8fbfe34382a2ec4c2e6b95fb2721) could really fix the permission issue on Windows. Still looking forward @dperson to make a fix in master branch.
Here is my fixed image: andyzhangx/samba:win-fix
My command to build docker image:
docker build --no-cache -t andyzhangx/samba:win-fix -f ./Dockerfile .
The Samba package has been updated to 4.12.6-r0 on both the 3.12 and edge branches of Alpine.
So there is no more need to switch to edge, just update the packages with apk -U upgrade
For anyone else running into this issue, if you won't be deleting your samba container, here's a quick fix to run against it (credit to TheGiolly above)
docker exec -it samba /bin/bash -c "apk -U upgrade && pkill smbd"
The container will stop automatically (smbd not running) and restart with the latest version of Samba.
To check the container's samba version, use docker exec -it samba /bin/bash -c "smbd --version"
Hey, I'm also having the same issue as #350, and was directed here. Looks like we just need to build a new latest version, correct?
With Docker Compose, you can simply replace image: dperson/samba
with build: https://github.com/dperson/samba.git
in the service definition to build the most recent version on your own :+1:
With Docker Compose, you can simply replace
image: dperson/samba
withbuild: https://github.com/dperson/samba.git
in the service definition to build the most recent version on your own 👍
Do you know how to do this with the run command?
With Docker Compose, you can simply replace
image: dperson/samba
withbuild: https://github.com/dperson/samba.git
in the service definition to build the most recent version on your own 👍Do you know how to do this with the run command?
You could try the build
command? The command would probably be something like docker build https://github.com/dperson/samba.git
I did a small fork: https://github.com/jtagcat/samba
(weekly auto-updates)
You are welcome to use the image ghcr.io/jtagcat/samba:amd64
(:aarch64
and :armhf
also available)
I managed to update the smb version setting read_only to false and the entrypoint in the compose file like this
version: "3.8"
services:
samba:
image: dperson/samba:latest
entrypoint: bash -c "([[ $(smbclient --version) == 'Version 4.12.2' ]] && apk -U upgrade || echo 'No upgrade required') && /sbin/tini -- /usr/bin/samba.sh"
read_only: false
...