music-assistant / hass-music-assistant

Turn your Home Assistant instance into a jukebox, hassle free streaming of your favorite media to Home Assistant media players.
Apache License 2.0
1.39k stars 51 forks source link

Cannot connect to SMB share #1164

Closed Jacco192 closed 1 year ago

Jacco192 commented 1 year ago

What version of Music Assistant has the issue?

2.0.0b16

The problem

with MA 2.0.0b16 unable to connect anymore to SMB share on N-3865 Combo384 Amanero Media Renderer.

How to reproduce

Restart MA

Relevant log output

File "/usr/local/lib/python3.11/site-packages/smbprotocol/connection.py", line 1177, in _check_worker_running raise SMBConnectionClosed("SMB socket was closed, cannot send or receive any more data") smbprotocol.exceptions.SMBConnectionClosed: SMB socket was closed, cannot send or receive any more data 2023-03-26 11:05:22 INFO music_assistant.metadata -- Start scan for missing artist metadata 2023-03-26 11:05:22 ERROR asyncio -- Task exception was never retrieved future: <Task finished name='Task-922' coro=<FileSystemProviderBase.sync_library() done, defined at /usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_local/base.py:258> exception=SMBAuthenticationError('Failed to authenticate with server: SpnegoError (1): SpnegoError (16): Operation not supported or available, Context: Retrieving NTLM store without NTLM_USER_FILE set to a filepath, Context: Unable to negotiate common mechanism')> Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/smbprotocol/session.py", line 286, in connect out_token = context.step(in_token) ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/spnego/_negotiate.py", line 141, in step mech_token_in, mech_list_mic, is_spnego = self._step_spnego_input( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/spnego/_negotiate.py", line 192, in _step_spnego_input mech_list = self._rebuild_context_list( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/spnego/_negotiate.py", line 462, in _rebuild_context_list raise BadMechanismError(context_msg="Unable to negotiate common mechanism", base_error=last_err) spnego.exceptions.BadMechanismError: SpnegoError (1): SpnegoError (16): Operation not supported or available, Context: Retrieving NTLM store without NTLM_USER_FILE set to a filepath, Context: Unable to negotiate common mechanism During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_local/base.py", line 270, in sync_library async for item in self.listdir("", recursive=True): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_smb/init.py", line 172, in listdir for entry in await asyncio.to_thread(smbclient.scandir, abs_path): File "/usr/local/lib/python3.11/site-packages/smbclient/_os.py", line 545, in scandir with SMBDirectoryIO(path, share_access="rwd", kwargs) as fd: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbclient/_io.py", line 353, in init tree, fd_path = get_smb_tree(path, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbclient/_pool.py", line 304, in get_smb_tree session = register_session( ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbclient/_pool.py", line 422, in register_session session.connect() File "/usr/local/lib/python3.11/site-packages/smbprotocol/session.py", line 288, in connect raise SMBAuthenticationError("Failed to authenticate with server: %s" % str(err.message)) smbprotocol.exceptions.SMBAuthenticationError: Failed to authenticate with server: SpnegoError (1): SpnegoError (16): Operation not supported or available, Context: Retrieving NTLM store without NTLM_USER_FILE set to a filepath, Context: Unable to negotiate common mechanism 2023-03-26 11:05:22 INFO music_assistant.metadata -- Finished scan for missing artist metadata

Additional information

No response

What version of Home Assistant Core are your running

2023.3.6

What type of installation are you running?

Home Assistant Container

On what type of hardware are you running?

Raspberry Pi

marcelveldt commented 1 year ago

1) make sure that your NAS or whatever server you connect to supports minimal SMBv2 (smbv1 is not supported anymore) 2) authentication is required, so a valid username and password

OzGav commented 1 year ago

Hi @Jacco192 have you got this working now?

Jacco192 commented 1 year ago

Hi, No, I didn’t. Not able to modify username or password, this is set by Melco to nobody.

future: <Task finished name='Task-374' coro=<FileSystemProviderBase.sync_library() done, defined at /usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_local/base.py:258> exception=SMBConnectionClosed('SMB socket was closed, cannot send or receive any more data')> Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_local/base.py", line 270, in sync_library async for item in self.listdir("", recursive=True): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_smb/init.py", line 210, in listdir async for subitem in self.listdir(item.absolute_path, True): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_smb/init.py", line 207, in listdir item = await create_item(self._root_path, entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_smb/init.py", line 139, in create_item return await asyncio.to_thread(_create_item) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/threads.py", line 25, in to_thread return await loop.run_in_executor(None, func_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_smb/init.py", line 127, in _create_item

Sent from Mail for Windows

From: OzGav Sent: Tuesday, 28 March 2023 14:26 To: music-assistant/hass-music-assistant Cc: Jacco192; Mention Subject: Re: [music-assistant/hass-music-assistant] Cannot connect to SMBshare (Issue #1164)

Hi @Jacco192 have you got this working now? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Jacco192 commented 1 year ago

I'm running Melco firmware 4.32. See https://www.audiotherapyuk.com/2019/01/03/melco-release-3-90-firmware/

OzGav commented 1 year ago

Looks to be a different error message now. @marcelveldt ?

Jacco192 commented 1 year ago

Startup of MA 2.0.0b20

2023-03-28 22:13:52 INFO music_assistant -- Starting Music Assistant Server (8e44c8893fb84af5adaaafdf63aa8ae5) - autodetected IP-address: 192.168.1.199 2023-03-28 22:13:53 INFO music_assistant.web -- Starting webserver on port 8095 2023-03-28 22:13:54 INFO music_assistant.streams -- Started stream controller (using ffmpeg version 4.3.5 with libsoxr support) 2023-03-28 22:13:54 INFO music_assistant.providers.lms_cli -- Registering jsonrpc endpoints on the webserver 2023-03-28 22:13:54 INFO music_assistant -- Loaded metadata provider MusicBrainz Metadata provider 2023-03-28 22:13:54 INFO music_assistant -- Loaded metadata provider TheAudioDB Metadata provider 2023-03-28 22:13:54 INFO music_assistant -- Loaded music provider URL 2023-03-28 22:13:54 INFO music_assistant -- Loaded plugin provider Websocket API 2023-03-28 22:13:54 INFO music_assistant -- Loaded player provider UPnP/DLNA Player provider 2023-03-28 22:13:54 INFO music_assistant -- Loaded player provider SONOS 2023-03-28 22:13:54 INFO music_assistant.providers.lms_cli -- Starting (telnet) CLI on port 9090 2023-03-28 22:13:54 INFO music_assistant -- Loaded player provider Chromecast 2023-03-28 22:13:54 INFO music_assistant -- Loaded metadata provider fanart.tv Metadata provider 2023-03-28 22:13:54 INFO music_assistant.providers.filesystem_smb -- Connecting to server 192.168.1.84 2023-03-28 22:13:54 INFO music_assistant -- Loaded plugin provider LMS CLI 2023-03-28 22:13:55 INFO music_assistant -- Loaded music provider Melco 2023-03-28 22:13:55 ERROR asyncio -- Task exception was never retrieved future: <Task finished name='Task-112' coro=<FileSystemProviderBase.sync_library() done, defined at /usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_local/base.py:259> exception=SMBConnectionClosed('SMB socket was closed, cannot send or receive any more data')> Traceback (most recent call last): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_local/base.py", line 271, in sync_library async for item in self.listdir("", recursive=True): File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_smb/init.py", line 195, in listdir item = await create_item(self._root_path, entry) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_smb/init.py", line 130, in create_item return await asyncio.to_thread(_create_item) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/asyncio/threads.py", line 25, in to_thread return await loop.run_in_executor(None, func_call) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/music_assistant/server/providers/filesystem_smb/init.py", line 118, in _create_item stat = entry.stat(follow_symlinks=False) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbclient/_os.py", line 1302, in stat self._lstat = lstat(self.path, connection_cache=self._connection_cache) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbclient/_os.py", line 259, in lstat return stat(path, follow_symlinks=False, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbclient/_os.py", line 586, in stat with SMBFileTransaction(raw) as transaction: File "/usr/local/lib/python3.11/site-packages/smbclient/_io.py", line 258, in exit self.commit() File "/usr/local/lib/python3.11/site-packages/smbclient/_io.py", line 294, in commit res = func(requests[idx]) ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbprotocol/open.py", line 1166, in _create_response response = self.connection.receive(request) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbprotocol/connection.py", line 1017, in receive self._check_worker_running() # The worker may have failed while waiting for the response, check again ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/smbprotocol/connection.py", line 1177, in _check_worker_running raise SMBConnectionClosed("SMB socket was closed, cannot send or receive any more data") smbprotocol.exceptions.SMBConnectionClosed: SMB socket was closed, cannot send or receive any more data 2023-03-28 22:13:55 INFO music_assistant.players -- Player registered: uuid:e160fb97-67a0-4aa1-be8a-78b3de2c0231/[TV] De tv 2023-03-28 22:13:55 INFO music_assistant.providers.slimproto -- Starting SLIMProto server on port 3483 2023-03-28 22:13:55 INFO music_assistant -- Loaded player provider Slimproto 2023-03-28 22:13:56 INFO music_assistant -- Loaded player provider Airplay 2023-03-28 22:14:31 INFO music_assistant.players -- Player registered: uuid:66e96c410558ccc551afa5cd470409e1/N-3865 Combo384 Amanero:MediaRenderer

marcelveldt commented 1 year ago

Looks like your device does not support the authentication and/or is still running SMBv1. Does it have some settings for you to configure ?

marcelveldt commented 1 year ago

https://github.com/jborean93/smbprotocol/issues/88

Jacco192 commented 1 year ago

No it doesn't, unfortunately.

marcelveldt commented 1 year ago

Ah that's too bad, SMBv1 is really old and crappy. Can't you complain with the manufacturer ? Maybe you can swap it and let that device connect to HA to access the files ?

Jacco192 commented 1 year ago

Share maps to HA, I've already looked into it but that didn't make me very happy. I'm going to see what can be done. I was so happy with the first releases :-)

marcelveldt commented 1 year ago

A lot of users had issues with the old SMB implementation based on pysmb so I swapped to a newer library with SMBv2/3 support. As you can read there is not a lot of interest to still support SMBv1 but what I could so if there are others too that have this issue is place the old implementation back under a legacy toggle for now.

So you can switch to legacy SMBv1 if really needed

Jacco192 commented 1 year ago

Yes, that would be nice. Then it's my own security issue, what was it 1984 ?

Jacco192 commented 1 year ago

Dropped the SMB question at Melco

OzGav commented 1 year ago

@Jacco192 as this is not something MA can resolve I am inclined to close unless if you anything further?

Jacco192 commented 1 year ago

That’s okOn Mar 30, 2023, at 4:09 PM, OzGav @.***> wrote: @Jacco192 as this is not something MA can resolve I am inclined to close unless if you anything further?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>