question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

smbprotocol.exceptions.InvalidParameter from ubuntu to synology nas

See original GitHub issue

I’ve been trying to connect to a smb share in python 3.10 from ubuntu 22.04 to my Synology NAS (DS218 on DSM 7.1.1-42962 Update 1) and I got this error with a simple test code:

smbprotocol.exceptions.InvalidParameter: Received unexpected status from the server: An invalid parameter was passed to a service or function. (3221225485) STATUS_INVALID_PARAMETER: 0xc000000d
import smbclient

path = "\\\\192.168.1.17\\music"

smbclient.ClientConfig(username="username", password="password")
smbclient.listdir(path=path)

I tried with a few variations in the path string, a raw string string, with and without the auth_protocol=“ntlm” param, with no better success.

Full traceback

/home/boris/back/venv/bin/python /home/boris/back/test.py 
Traceback (most recent call last):
  File "/home/boris/back/test.py", line 12, in <module>
    smbclient.listdir(path=path)
  File "/home/boris/back/venv/lib/python3.10/site-packages/smbclient/_os.py", line 239, in listdir
    with SMBDirectoryIO(path, mode='r', share_access='r', **kwargs) as dir_fd:
  File "/home/boris/back/venv/lib/python3.10/site-packages/smbclient/_io.py", line 377, in __init__
    tree, fd_path = get_smb_tree(path, **kwargs)
  File "/home/boris/back/venv/lib/python3.10/site-packages/smbclient/_pool.py", line 310, in get_smb_tree
    session = register_session(server, username=username, password=password, port=port, encrypt=encrypt,
  File "/home/boris/back/venv/lib/python3.10/site-packages/smbclient/_pool.py", line 374, in register_session
    connection.connect(timeout=connection_timeout)
  File "/home/boris/back/venv/lib/python3.10/site-packages/smbprotocol/connection.py", line 799, in connect
    smb_response = self._send_smb2_negotiate(dialect, timeout, enc_algos, sign_algos)
  File "/home/boris/back/venv/lib/python3.10/site-packages/smbprotocol/connection.py", line 1497, in _send_smb2_negotiate
    response = self.receive(request, timeout=timeout)
  File "/home/boris/back/venv/lib/python3.10/site-packages/smbprotocol/connection.py", line 1006, in receive
    raise SMBResponseException(response)
smbprotocol.exceptions.InvalidParameter: Received unexpected status from the server: An invalid parameter was passed to a service or function. (3221225485) STATUS_INVALID_PARAMETER: 0xc000000d

The SMB is configured on the NAS to accept SMB1, SMB2, SMB2 and Large MTU and SMB3, encryption is defined by the client.

Packages list on the venv

anyio==3.6.2
cffi==1.15.1
click==8.1.3
cryptography==38.0.3
dnspython==2.2.1
fastapi==0.75.2
h11==0.14.0
httptools==0.5.0
idna==3.4
motor==3.0.0
pycparser==2.21
pydantic==1.10.2
pymongo==4.3.2
pyspnego==0.6.2
python-dotenv==0.21.0
PyYAML==6.0
rarfile==4.0
smbprotocol==1.9.0
sniffio==1.3.0
starlette==0.17.1
typing_extensions==4.4.0
uvicorn==0.18.3
watchgod==0.8.2
websockets==10.4

I looked at issues #89 and #112 but I couldn’t find any fitting solution in them

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Boris-Sachetcommented, Nov 6, 2022

Thanks for all your quick replies and fixing the problem so quickly, I’ll try it tomorrow and update you if it’s working 😃

0reactions
jborean93commented, Nov 7, 2022

Fantastic, thanks for confirming.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Samba connection fails with SMBResponseException #89
I am trying to connect from my Raspberry Pi A+ to the samba share of my home network router. This simple script below...
Read more >
Connecting Linux to NAS via SMB instead of NFS
I've spent a few hours musing through a lot of online posts asking how to mount a drive on Linux via NFS. There...
Read more >
Problem playing MP4 files - Synology Community
When I move the file locally, it plays fine. I tried using VLC, it plays every time, but no sound. Locally VLC plays...
Read more >
[SOLVED] Can't mount SMB - Synology Community
I was able to mount my shares as usual, and able to SSH to the Synology NAS as usual. Then something changed or...
Read more >
St*pid Ubuntu doesn't want to connect to my Syno's
No, to be honest, I am mighty impressed with that Ubuntu-stuff (although ... to connect an Ubuntu host (Linux based) to a Synology...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found