Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: NAS rescanning: what is happening here? (Read 8054 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

NAS rescanning: what is happening here?

Ok, I use foobar for more than 2 years now. And I love it.
Now I recently got a NAS (Synology DS410j) and have now managed to transfer all my library to that place.
I Have set the drives as a RAID 5 and it owns a fixed IP within my network.

Every time I change some tag on a file sitting on the NAS, foobar is indexing the library.
I have no exact clue whether it's a complete rescan but it's taking AGES.
It never did that when I had external USB drives with the files residing.

When watching the media library window in preferences, I recently realised that foobar is having "ERROR" displayed for a second after I had an album replaygain-scanned.
After that it started indexing again.

Now what is responsible for this behaviour and is there a switch I can use to keep foobar from annoying me this way?
Please - if someone out there has come across it: I'd be immensely grateful for any clues.

many thanks for your patience

NAS rescanning: what is happening here?

Reply #1
Here, I've submitted a bug report for you.
Full-quoting makes you scroll past the same junk over and over.

NAS rescanning: what is happening here?

Reply #2
Here, I've submitted a bug report for you.


hey!
great, thanks a lot.

I have read the report and followed the link.
Unfortunately, I don't get everything of it as I am not a programmer.

Can I apply this patch to my NAS somehow and would it solve the problem?
Would applying the patch mean I'd risk losing data on the NAS?

Thanks very much for this in any case.
All the best

NAS rescanning: what is happening here?

Reply #3
No, you personally can't do that. They should apply it to the source code (in text) of the Samba library (the server for Windows sharing on the NAS), then build and provide a new packaged version for you to upgrade. However I don't know if that's ever going to happen - I have no experience with Synology's support.

What's worse, this is an issue which affects most likely ALL Linux based devices out there, be it NAS or a full blown Linux server, because the bug has been surprisingly fixed only a few weeks ago and no version of the library has been released since yet.


That said, I've successfully patched this on my Synology DS-109j. I'd give you the patch too, to test and enjoy it yourself, but it seems your DS410j is unfortunately based on a different hardware and it's not that easy. Oh well, I can try to do that blindly. If you want to be a guinea pig, feel free to say so

Just a note: Of course, you would be doing all this at your own risk. I have not tried the patch for your NAS myself because I couldn't. However if you are careful, worst what can happen is you get non-working Windows shares for a while. No loss of data or anything. I can give you a detailed enough guide on how to patch your box, as well as help you to resolve any issues which might occur - but some general understanding of command line would be needed, for example.

Tell me if you feel you could be up to this task. Or I might post the instructions regardless and you'll see then.
Full-quoting makes you scroll past the same junk over and over.

NAS rescanning: what is happening here?

Reply #4
Well, thanks so much for the swift reply.
I think I'd try and go for it.

I can handle a command line. That's not gonna be the problem.
Is there anything that I can upload for you so you can have a look and see if your patch would be working with my box?
Some part of the firmware data. If so, please let me know where to find it and I'll have it sent asap - or posted if it's just config files.

I will be away for the weekend but am to return monday night. So don't wonder with me not posting - I have not lost interest.

Again:
So many thanks for your help and patience.
All the best

NAS rescanning: what is happening here?

Reply #5
All right, here are some more information I have collected. Sorry if you find it too lame sometimes, I really didn't know what kind of audience I was writting it for


How to know if it's broken or not?
I do it like this:
  • Add a network shared folder with some (unimportant) music files as fb2k's ML directory, don't press "Apply" yet.
  • Start Wireshark, set capture filter "host 192.168.1.x" just for the NAS, filter the view by "smb.nt.function == 4".
  • Start Process Monitor, filter everything out except foobar2000.exe. Perhaps go to "Filter > Highlight" and exclude "Result" in "SUCCESS", "FAST IO DISALLOWED" and "NAME NOT FOUND", to see the interesting lines more easily.
  • Click "Apply" in foobar2000 - see the folder is scanned fine.
  • Select the tracks and rename them using File Operations to something else.
Now if it's broken:
  • The status of the ML directory changes to "Error!".
  • Message like "Folder watching failure: The specified server cannot perform the requested operation." is logged to the console.
  • Process Monitor log contains "0xC00000C3" result code for the "NotifyChangeDirectory" call.
  • Wireshark captured a "NT Trans Response, FID: 0x????, NT NOTIFY" with the change notification. It contains at least two parameters, like RENAMED_OLD_NAME and RENAMED_NEW_NAME, and the first has "File Name Len" not divisible by 4 and "Next Entry Offset" neither.
  • There are no further "NT NOTIFY" responses because the connection is closed due to error by the Win7 client.
On the other hand, if it's fixed:
  • No error is logged anywhere.
  • Process Monitor log contains "SUCCESS" result code for the "NotifyChangeDirectory" call.
  • Wireshark captured a series of "NT Trans Response, FID: 0x????, NT NOTIFY" packets with the change notifications. At least one of them contains at least two parameters, like RENAMED_OLD_NAME and RENAMED_NEW_NAME, and the first has "File Name Len" not divisible by 4, but "Next Entry Offset" is padded to 4 bytes, as is the next entry.


Installing instructions:
  • Login to Synology DiskStation Manager as the administrator, make sure SSH service is enabled under Network Services > Terminal.
  • Run some terminal emulator (like PuTTY), connect to the NAS and login as "admin" with the appropriate password. It might be a good idea to enable logging, so that you would have full log in case there are some problems we'd have to resolve later (in PuTTY, choose "Printable output" and browse for a file name under the Logging tab). Now, below, Pluto is my host name, you'd see something different there. Same goes for the BusyBox version shown etc.
    Code: [Select]
    login as: admin
    admin@pluto's password: ************

    BusyBox v1.1.0 (2010.04.19-13:35+0000) Built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    Pluto>
  • Make yourself root (enter admin's password again).
    Code: [Select]
    Pluto> sudo sh

    We trust you have received the usual lecture from the local System
    Administrator. It usually boils down to these three things:

        #1) Respect the privacy of others.
        #2) Think before you type.
        #3) With great power comes great responsibility.

    Password: ************

    BusyBox v1.1.0 (2010.04.19-13:35+0000) Built-in shell (ash)
    Enter 'help' for a list of built-in commands.

    #
  • Verify the existing version.
    Code: [Select]
    # cd /usr/syno/sbin
    # openssl md5 smbd
    MD5(smbd)= 80371ce4a9b8e31dcfd3249dda457efc
    IMPORTANT: If it prints anything else than the hash shown above, stop here and don't replace anything! Have you got the latest version of the firmware installed?
  • Download the patched binary.
    Code: [Select]
    # wget http://yirkha.fud.cz/tmp/4c77038b/smbd-patch-arm-3.2.8.gz
    --2010-08-27 02:12:42--  http://yirkha.fud.cz/tmp/4c77038b/smbd-patch-arm-3.2.8.gz
    Resolving yirkha.fud.cz (yirkha.fud.cz)... 88.146.119.175
    Connecting to yirkha.fud.cz (yirkha.fud.cz)|88.146.119.175|:80... connected.
    HTTP request sent, awaiting response... 200 OK
    Length: 1582979 (1.5M) [application/x-gzip]
    Saving to: `smbd-patch-arm-3.2.8.gz'

    100%[=================================>] 1,582,979    952K/s   in 1.6s

    2010-08-27 02:12:43 (952 KB/s) - `smbd-patch-arm-3.2.8.gz' saved [1582979/1582979]
  • Stop the Samba server.
    Code: [Select]
    # /usr/syno/etc/rc.d/S80samba.sh stop

    #################
    Stoping Winbind
    #################

    ##################
    Stoping Samba
    ##################
    #####Remove Temp TDB#####
  • Backup the original and replace it with the patched version.
    Code: [Select]
    # mv smbd smbd.orig
    # gzip -d smbd-patch-arm-3.2.8.gz
  • Start the Samba server again - there should be no apparent errors (the "invalid integer" part is just some probably harmful typo in Syno's scripts).
    Code: [Select]
    # /usr/syno/etc/rc.d/S80samba.sh start
    #####Remove Temp TDB#####
    ###Starting nmbd###
    [: invalid integer `'
    ###Starting nmbd###

    ##################
    Starting Samba
    ##################
    #####Checking TDB /usr/syno/etc/private/secrets.tdb
    backup tdb /usr/syno/etc/private/secrets.tdb
    #####Checking TDB /var/run/account_policy.tdb
    backup tdb /var/run/account_policy.tdb
    #####Checking TDB /var/run/group_mapping.tdb
    #####Checking TDB /var/run/ntdrivers.tdb
    backup tdb /var/run/ntdrivers.tdb
    #####Checking TDB /var/run/ntforms.tdb
    backup tdb /var/run/ntforms.tdb
    #####Checking TDB /var/run/ntprinters.tdb
    backup tdb /var/run/ntprinters.tdb
    #####Checking TDB /var/run/share_info.tdb
    backup tdb /var/run/share_info.tdb
    #####Checking TDB /var/run/registry.tdb
    backup tdb /var/run/registry.tdb
    [: invalid integer `'
    ###Starting nmbd###
    [: invalid integer `'

    ...repeated for some reason...
  • Wait a while, verify [font= "Courier New"]smbd[/font] is really running.
    Code: [Select]
    # ps | grep smbd
    7753 root       4820 S   /usr/syno/sbin/smbd -D
    7756 root       4716 S   /usr/syno/sbin/smbd -D
    7851 root        208 S   grep smbd
  • Try accessing the server shares, start foobar2000, whatever.


If it seems fine:

If anything goes wrong:
  • Stop the Samba server.
    Code: [Select]
    # /usr/syno/etc/rc.d/S80samba.sh stop
  • Replace the server executable from backup.
    Code: [Select]
    # mv smbd.orig smbd
  • Start the Samba server.
    Code: [Select]
    # /usr/syno/etc/rc.d/S80samba.sh start
  • Log out.
    Code: [Select]
    # exit
    Pluto> exit



Just for completeness' sake, here are both patched [font= "Courier New"]smbd[/font] files I have.
Full-quoting makes you scroll past the same junk over and over.

NAS rescanning: what is happening here?

Reply #6
Hi Yirkha,

Thanks very much for your detailed post. I am also using a Synology DS (a DS209+II) with foobar2000 and am having the same issue (I also checked with MS Network Monitor and found the same messages as you describe with Wireshark).

This problem still exists with the latest DSM 3.0 (1337) and it appears that Samba 3.2.8 is still present in this particular build of DSM (I personally think it has not been updated for a while).
I was checking the Samba web site and noticed that the patch you mention is now integrated into Samba 3.5.6 (changelog here).

However, my main question to you (if you do not mind!) is how did you create the new SMBD file for your DS109j? Is the source code for Samba on the device somewhere, so that you can easy patch it by copy-pasting the code patch and then compiling it on the diskstation?

Sorry for the basic questions, I am intrigued by this as there doesn't seem to be many users that experience this issue.

Thank you for your time.

 

NAS rescanning: what is happening here?

Reply #7
The source code is rarely included on the device itself. Usually you download and unpack the source on your desktop system and build with a cross compiler tool chain.

NAS rescanning: what is happening here?

Reply #8
But it's unfortunately not as simple. The vendors very often use their own tuned kernels, special build configuration and custom patches and it's next to impossible to replicate all that to compile stuff 100% correctly even on the device itself (like it is possible with Synology's products). The customizations are also one of the reasons why the companies are not very into updating system components on the devices across major versions.

So I use the safest method possible, which is download the original binary, learn yet another assembler flavor, find the broken code and patch it (that usually involves optimizing the existing code first to make some space for the fix).

If you want, I can give you a patched smbd for DS209+II too. The fix might be even exactly the same as in one of the files I've already done, there are only a limited number of CPU architectures available afterall...
Full-quoting makes you scroll past the same junk over and over.

NAS rescanning: what is happening here?

Reply #9
Yirkha: I have the same issue with my Synology NAS (212J).  Would you be able to help compile smbd?

My version:
Quote
DiskStation> openssl md5 smbd
WARNING: can't open config file: /usr/syno/ssl/openssl.cnf
MD5(smbd)= 742f82a220109e351b5db2387e56af0a
DiskStation> smbd -V
Version 3.2.8


NAS rescanning: what is happening here?

Reply #10
I think I figured out how to manually install an updated smbd package by following the detailed instructions at this Synology forums post.
Still playing with this thing so I'm not positive.