Synology SMBv1 Docker container workaround

  • 18 October 2020
  • 67 replies
  • 5286 views


Show first post

67 replies

Badge +1

@jelvank yes currently only using my shared folder /music, I still the HD_Music folder, just not messing with it, until I get this issue resolved. 

Here is a screen shot of the terminal results. 



Sonos is actually directing people to this thread?? WOW!! Pathetic support! When they (Sonos) first came on the scene, they were all about the end users, that has sadly changed, 

Userlevel 2
Badge

Ok, this basically shows that your Docker container doesn't see any files. I think you should check the location of your music files, they might have moved after your HD migration. You can locate your music directory in Synology File Station and make sure the files are there. And check the Volume settings of your container and make sure it is pointing to the same location.

Badge +1

Ok, this basically shows that your Docker container doesn't see any files. I think you should check the location of your music files, they might have moved after your HD migration. You can locate your music directory in Synology File Station and make sure the files are there. And check the Volume settings of your container and make sure it is pointing to the same location.

@jelvank Thank you for all your help…. I got it to work...I guess it is my lack of knowledge of Docker and how all this works, it turns out the problem was this whole process is CAPS specific. 

My music share folder is Music and I was doing everything in lower case, assuming that CAPS didn’t matter. 

Made changes to everything to match all the CAP letters and everything is working as you designed.

Again, thanks for your help and this secure fix that Sonos FAILS to address and fix properly. 

An update for those who are using Synology NAS running DSM 7.x.

Default settings means SONOS does not work with Synology shared folders as they require minimum of SMB2 / NTLMV2. However if you go to  File Services > SMB > Advanced Settings > General. Make sure minimum SMB protocol is SMB1 and then Advanced Settings > Others set the “Enable NTLMV1 Authentication” flag. You will get a warning about security issues accept and clear SMB Cache on the General tab.

This enabled the insecure SMB1 and my SONOS was able to connect to the shared folder. I also created a special user and restricted it to the music shared folder to mitigate the crap protocol SONOS forces us to use. 

 

This is ridiculous SONOS that an insecure protocol that was replaced years ago is still the only option in SONOS.  

Userlevel 2

 

Your share settings have to be added on the Environment-tab.

Although you might add the share as a public share, I prefer to use passwords anyway. Please make sure you use a generated password that you don’t use anywhere else!

 

Following Environment variables have to be set:

PATH 	= leave as is.
GLOBAL = ntlm auth = ntlmv1-permitted
# this will enable old authentication mechanism, necessary for Sonos
SMB = disable
# This will enable SMBv1
SHARE = music;/music;yes;yes;no;sonos;;;SonosMusic
# This is will add a share music, located at /music (location where you mounted your local music on the Volume page), read-only accessible for user sonos with description SonosMusic.
USER = sonos;verysecretgeneratedpassword12345

 

Hi Jelvank, 

 

Thank you so much for this, absolutely stellar!

I have one question… as a SSH and Docker noob, I have been copy-pasting your environment variables to the letter.. literally setting my pasword to:”verysecretgeneratedpassword12345”… Is there a way to chance this password afterwards without going through the whole process from the start?

 

Many thanks!

 

Bastiaan

Userlevel 1
Badge

So, I just ran an experiment with my new laptop: I turned off the Windows Feature SMB 1.0/CIFS (I had previously turned it on). I then asked the SONOS app to index my Windows Music folder. It worked fine, and, in fact, was the fasted indexing I have ever experienced. Music played fine. Why does this work without SMB1 activated? I thought the SONOS system needed SMB1.

I was about to buy a Sonology DS220+ (It’s already in my Amazon cart!!!), but this thread is scaring me away from that. 

Userlevel 7
Badge +22

So, I just ran an experiment with my new laptop: I turned off the Windows Feature SMB 1.0/CIFS (I had previously turned it on). I then asked the SONOS app to index my Windows Music folder. It worked fine, and, in fact, was the fasted indexing I have ever experienced. Music played fine. Why does this work without SMB1 activated? I thought the SONOS system needed SMB1.

I was about to buy a Sonology DS220+ (It’s already in my Amazon cart!!!), but this thread is scaring me away from that. 


Sonos does not use SMB for PC or Mac local file access (stopped that a few years ago), it uses a local http server called SonosLibraryService. Sonos only use SMB for networked devices such as NAS and the device you are considering purchasing.

Userlevel 1
Badge

OK, thanks for the clarification. I have an ancient Buffalo NAS that can only use SMB1. I can see the folders on that NAS if I have SMB1 activated on my laptop, and I curate the music there using MusicBee, After that step, I use the SONOS app to map that Music folder to be the library for SONOS, and it can see that folder, indexes it properly, and plays the music on the zones properly. I only store music, not data, on that NAS. I then deactivate SMB1 on my laptop. I presume that SONOS is using SMB1 to communicate with the NAS on my LAN.

Question(1): Is that any kind of security risk for my network?

Question(2): Seems like an app running on a modern, nonSMB1, NAS could also use SonosLibraryService if it was configured to do so. Not possible?

Userlevel 7
Badge +22

Question(2): Seems like an app running on a modern, nonSMB1, NAS could also use SonosLibraryService if it was configured to do so. Not possible?

Technically yes, but it requires the PC to be on all the time, which kind of defeats the point of the NAS: just put the files on the PC itself instead.

Userlevel 1
Badge

but it requires the PC to be on all the time

The particular NAS I was considering has an Intel Celeron running a modification of linux for the OS, so I thought it would be possible to port SonosLibraryService to that machine (it already runs many many apps).  Anyway, I have a working solution using my old Buffalo NAS that allows me to turn off my laptop and still hear SONOS music. A little extra work to add new music, but easy enough to do. Thanks very much for your insights on this for me...Jack

Userlevel 7
Badge +22

but it requires the PC to be on all the time

The particular NAS I was considering has an Intel Celeron running a modification of linux for the OS, so I thought it would be possible to port SonosLibraryService to that machine (it already runs many many apps).  Anyway, I have a working solution using my old Buffalo NAS that allows me to turn off my laptop and still hear SONOS music. A little extra work to add new music, but easy enough to do. Thanks very much for your insights on this for me...Jack


It would be easy to port the library service to any device that can run .Net Core - just decompile it to C# and recompile for the new target. Setup will probably be harder (ie getting the controller to add it to the system) and secrets management.

Userlevel 1
Badge

Well, I think I’m in a good place now: I did get that new NAS (Asustor AS5202T 2-bay), and I have successfully moved my Music Folder over to it. Using SMB1 enabled, I set up a new library in the SONOS app that points to the Music folder on the NAS. As long as I don’t want to change the structure of the SONOS library, I can disable SMB1 and still update the music files and the .m3u playlist files just by copy things from my PC to the NAS. I then re-index the SONOS library, and I don’t need SMB1 to do that step. Seems to work fine. Thanks for your insights and suggestions on all this. 

Userlevel 2
Badge

 

Your share settings have to be added on the Environment-tab.

Although you might add the share as a public share, I prefer to use passwords anyway. Please make sure you use a generated password that you don’t use anywhere else!

 

Following Environment variables have to be set:

PATH 	= leave as is.
GLOBAL = ntlm auth = ntlmv1-permitted
# this will enable old authentication mechanism, necessary for Sonos
SMB = disable
# This will enable SMBv1
SHARE = music;/music;yes;yes;no;sonos;;;SonosMusic
# This is will add a share music, located at /music (location where you mounted your local music on the Volume page), read-only accessible for user sonos with description SonosMusic.
USER = sonos;verysecretgeneratedpassword12345

 

Hi Jelvank, 

 

Thank you so much for this, absolutely stellar!

I have one question… as a SSH and Docker noob, I have been copy-pasting your environment variables to the letter.. literally setting my pasword to:”verysecretgeneratedpassword12345”… Is there a way to chance this password afterwards without going through the whole process from the start?

 

Many thanks!

 

Bastiaan


Hi Bastiaan,

Yes, you can do so easily:

  • Open Docker
  • Hit Container
  • Stop your Sonos-container by switching the button behind the container, wait for it to stop.
  • Hit Edit
  • Go to the tab Environment
  • Down below you will find the variable user. First part is the username and behind the semicolon your very secret password waits for you to be changed :-)
  • Hit Apply, close the Edit window and start the container again by switching the button.

 

This works perfectly. Took a couple of attempts due to the fact it was the first time I've used Docker but it has given me a great introduction to docker/containers and also solved the problem of not having to enable smbv1 on my syno NAS and enabled me to share my music SAFELY from my NAS to Sonos. 

Follow the instructions accurately and it will work. Remember that when setting environment variables that the paths for the directory where you music is stored need to be exact i.e. case sensitive and don't miss the smb variable or you music folder will appear empty. I know because I made that mistake :)

 

Thanks for this workaround, top marks!

 

Hi 

When starting the container with the settings above, I get an error:

Start container sonos-samba failed: {"message":"failed to create the macvlan port: device or resource busy"}.

I followed the information and SSH information in your post.

 

Thanks

Andrew


Could be a lot of things. I know about an issue with macvlan and Synology Vswitch:

https://www.reddit.com/r/homelab/comments/cng2s2/issue_with_synology_vswitch_and_docker_macvlan/

If you use vSwitch you might need to switch it off.

Hi all,

I followed the instructions in this post and had the same issue that AndrewKorn faced. Using the link above, I did an ifconfig -a and verified that my virtual network adaptor is named ovs_eth0. So I used this in place of just eth0 and voila, everything is up and running.

Thanks heaps Jelvank for sharing your workaround. It has given my 2 Sonos speakers a new lease of life.

hewmf

@Rowena B.Just to clarify, I was able to get my Sonos to talk to my NAS by creating a separate server using outdated and insecure protocols.  Sonos MUST fix their SMB protocol - users should not have to go to these lengths just to listen to their own music.

Just use a PC or a Mac to host your files: no SMB required.

I second that. Moreover, hosting the files on my Mac mini offers me a better playlist management :yum:

 

@afawaz and anybody else that’s getting the error “failed to create the macvlan port: device or resource busy” - the issue is most likely because you’re using an incorrect network device. If you have vSwitch enabled (a must if you use Virtual Machines on Synology), you can’t use eth0 because it won’t have the ip address of your Synology. You’ll need to prefix your network device with ovs_

 

Ex. Instead of using parent=eth0 when creating your macvlan try using parent=ovs_eth0

 

Here’s a post that helped me find the link between this issue and vSwitch. I recently installed VMM on Synology and ran into this issue and removing macvlan and redoing it with ovs_eth0 fixed it.

 

Like @jelvank said - use the ifconfig command and search for the network device that has inet addr:{your-synology-ip-here} and use that network device in your macvlan configuration.

Reply