D-Link Forums

The Graveyard - Products No Longer Supported => D-Link Storage => DNS-323 => Topic started by: Ita_gsxr on August 13, 2010, 06:50:27 AM

Title: Shares are not accessible after reboot (1.08)
Post by: Ita_gsxr on August 13, 2010, 06:50:27 AM
My network:

Modem ADSL
router > NETGEAR WNR3500v2
NAS DNS-323 with two Seagate ST3500320AS/500Gb - firmware 1.08
#1 PC  - Windows XP Sp3
#2 PC  - Windows XP Sp3

After the DNS has booted it's not possible to access any network share.
Sometimes NAS is visible in the workgroup but not accessible, other times it's not even there.
I can see the shares and acces them only if i use the IP instead of the unit name in windows explorer.
Easysearch_v4.7 see the DNS, see shares but it's not able to map drives.

I tried To restore default settings end to reboot but nothing solved.

The ONLY solution I found is to log on to the DNS, go to the NETWORK ACCESS section and modify one rule, then magically the NAS appear in the network and all the shares become accessible. Probably this operation force a samba restart.

Am I the only one to experience this problem???
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 13, 2010, 09:46:19 AM
Yes, this sounds familiar.
Especially that part where using host name (\\my-nas\Volume_1) doesn't work but using IP (\\192.168.x.y\Volume_1) does.

Now that I'm almost (almost) done tinkering with it I won't reboot it often so didn't give it much thought. But you're not alone.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 13, 2010, 10:01:22 AM
This sounds more like an issue with master browsers than a NAS issue. 
Title: Re: Shares are not accessible after reboot (1.08)
Post by: Ita_gsxr on August 13, 2010, 12:35:49 PM
This sounds more like an issue with master browsers than a NAS issue. 

I thought the same but "nbtstat -a" show me that the only master browser it's PC#1. If I shutdown PC#1 the DNS-323 become the new master browser.
I'm now thinking that perhaps it could be a conflict between PC#1 and DNS323 in the election of the master browser. Infact PC#1 is already in use when the dns-323 boot. Tomorrow I'll try to shutdown all the PC before powering up the 323.
Then I'll let you know.

Thanks.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: Ita_gsxr on August 13, 2010, 12:47:23 PM
Now that I'm almost (almost) done tinkering with it I won't reboot it often so didn't give it much thought. But you're not alone.

Well, at least now I know that It's not a problem of my unit :(
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 13, 2010, 12:58:36 PM
I know I had a number of issues with the DNS-321, the DNS-323, and my Synology DS209 fighting it out to see who would be the master browser.  I finally loaded fun_plug and disabled the master browser capability on the DNS-321 and DNS-323.  I finally beat them into submission and now my DISKSTATION assumes the role alone.


LANscanner v1.3 - ScottiesTech.Info

Scanning LAN...

DISKSTATION       192.168.0.144  00-00-00-00-00-00  WORKGROUP  MASTER
DNS-321           192.168.0.143  00-00-00-00-00-00  WORKGROUP
DNS-323           192.168.0.142  00-00-00-00-00-00  WORKGROUP
MAIN              192.168.0.26  00-04-4B-19-8A-0C  WORKGROUP
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 13, 2010, 03:39:05 PM
I finally loaded fun_plug and disabled the master browser capability on the DNS-321 and DNS-323.  I finally beat them into submission and now my DISKSTATION assumes the role alone.

Interesting. Wasn't aware of that.
Was checking out /etc/samba/smb.conf but, strangely, didn't find any reference to the relevant values (local master, preferred master, os level).

I am on the right track, right? Need to add "local master = no" to smb.conf's global stanza before nmbd starts (or restart it). Need to do it from ffp/start.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 14, 2010, 06:50:43 AM
You are correct, you need to tell them they're not the master, and have no right to become the master. :)

About halfway down the page on this site: http://www.phrison.com/dns-323-setup-with-sheevaplug/ (http://www.phrison.com/dns-323-setup-with-sheevaplug/), you'll find the instructions for making SAMBA configuration changes stick through reboots.  Using that technique, I put that line into the smb.conf file, and it's worked for me.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 14, 2010, 08:24:09 AM
You are correct, you need to tell them they're not the master, and have no right to become the master. :)

About halfway down the page on this site: http://www.phrison.com/dns-323-setup-with-sheevaplug/ (http://www.phrison.com/dns-323-setup-with-sheevaplug/), you'll find the instructions for making SAMBA configuration changes stick through reboots.  Using that technique, I put that line into the smb.conf file, and it's worked for me.

The method described there is a bit heavy-handed. Replacing smb.conf with a pre-edited file means I'll probably need to revisit that file whenever I make changes to network shares. I suggest making changes on the fly, using sed, along these lines:
Code: [Select]
/ffp/bin/sed -e '/\[ global \]/alocal master = no' /etc/samba/smb.conf > /tmp/smb.confIf you're unfamiliar with sed, what it does is:
1. Read the /etc/samba/smb.conf file.
2. Finds the line(s) containing the text "[ global ]" (need to escape the '[' and ']') and adds (appends) after them the text "local master = no"
For multiple lines, use multiple commands like so:
Code: [Select]
/ffp/bin/sed -e '/\[ global \]/alocal master = no' -e '/\[ global \]/apreferred master = no' /etc/samba/smb.conf > /tmp/smb.conf
After that - swap the files (preferably keep original someplace for troubleshooting)
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 14, 2010, 08:32:13 AM
That's more elegant, but I don't change my shares, so it's a moot point. :)

It's a good idea anyway, I'll have to consider it.  I hate to fix something that ain't broke right now. :D
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 14, 2010, 01:45:30 PM
I hate to fix something that ain't broke right now. :D
It's hard to argue with that
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 14, 2010, 02:01:40 PM
I saved your example, it would be handy for modifying any of the configuration files on the fly.  If I ever run into the situation where I need to edit my stuff. I'll try this method. :)

Thanks.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 14, 2010, 04:22:17 PM
I saved your example, it would be handy for modifying any of the configuration files on the fly.  If I ever run into the situation where I need to edit my stuff. I'll try this method. :)

Thanks.


Glad I could help. sed (short for stream editor) is a wonderful tool, imho it's well worth learning. In this case, I used it to add stuff at a specific location. it can also be used to search and replace and do all sorts of text file manipulation.

Still need to help the original poster Ita_gsxr: Are you following this thread? need help with this?
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 14, 2010, 05:20:45 PM
I've used SED before, I used to use it to update from one version of the Linux kernel to the next.  Haven't done any Linux work in years, you tend to forget this stuff. :D
Title: Re: Shares are not accessible after reboot (1.08)
Post by: Ita_gsxr on August 15, 2010, 12:32:42 PM
Still need to help the original poster Ita_gsxr: Are you following this thread? need help with this?

Hi! I'm Still here :) It's only that I went through an XP install from scratch :((( What a news, eh?

Well. It seems that the problem is really the master election.
I'm wondering why D-Link didn't put the choice to be a Master or not into the LAN SETTING or DEVICE SETTING tab. Wouldn't it be easier for everyone?

Unfortunately I'm not a linux expert. So PLEASE...be patient ;)
If I understand I need to:

1) Install FunPlug (Copy fun_plug and fun_plug.tgz to Volume 1 and reboot)

2) Via Telnet: (/ffp/bin/sed -e '/\[ global \]/alocal master = no' /etc/samba/smb.conf > /tmp/smb.conf)
This should add the line "master = no" into samba and make a backup copy of the orginal smb.conf

This change should be reboot persistent. Right?

Another thing, once installed ffp the telnet server is always running , right? I'm behind a Firewall (NETGEAR WNR3500) but I don't like the idea to leave some door open.
Is it possibile to shutdown the telnet service or uninstall FFP? Should I simply delete files from Volume 1 ???

Many Thanks!!

Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 15, 2010, 01:50:45 PM
Read the whole installation for fun_plug, you can enable SSH and then disable Telnet.  You have a secure and encrypted channel to the unit.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 15, 2010, 03:05:02 PM
I haven't done this myself. You should be VERY careful with what you do here because if this might end very badly - you'll be unable to access your shares and be left with only the telnet access. So unless you're confident that you can recover from such mistakes I suggest you don't do it.

This change should be reboot persistent. Right?
Unfortunately, no. These files are not located on some persistent storage - they're in a filesystem that's entirely in memory. You'll need to:
1. Create a script in /ffp/start/ containg a similar line of code that adds some configuration to the original.
The content of the script should be something like this:
Code: [Select]
#!/bin/sh

#Add the following three lines to the [ global ] stanza of /etc/samba/smb.conf:
#domain master = no
#local master = no
#preferred master = no
mv /etc/samba/smb.conf /etc/samba/smb.conf.old
/ffp/bin/sed -e '/\[ global \]/adomain master = no' -e '/\[ global \]/alocal master = no' -e '/\[ global \]/apreferred master = no' /etc/samba/smb.conf.old > /etc/samba/smb.conf

#restart the smb and nmb daemons with the new configuration
smb restart


That script needs more code to stop and then start nmbd and smbd. That's the part I'm the least confident about, since my samba/cifs skills are not that hot.

2. Make sure that the script's permissions allow its execution (chmod +x <script-file-name>).

Another thing, once installed ffp the telnet server is always running , right? I'm behind a Firewall (NETGEAR WNR3500) but I don't like the idea to leave some door open.
Is it possibile to shutdown the telnet service or uninstall FFP? Should I simply delete files from Volume 1 ???

You won't be able to delete ffp completely, because you'll still need it to run that script on every boot. You can, however, disable it from running the telnet daemon. What people ussualy do is follow the instructions to run ssh and after that disable the telnet daemon by removing its execution permissions. See instructions here: http://wiki.dns323.info/howto:1st_steps (http://wiki.dns323.info/howto:1st_steps)

Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 15, 2010, 03:14:12 PM
Gosh, starting and stopping SMB is the easy part! :D

smb stop

smp start


If you put your script into a new file in the /ffp/start directory and call it rconfig.sh, it'll be called whenever the NAS is booted.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 15, 2010, 05:01:29 PM
Gosh, starting and stopping SMB is the easy part! :D

smb stop

smp start


If you put your script into a new file in the /ffp/start directory and call it rconfig.sh, it'll be called whenever the NAS is booted.


Wasn't sure if smb stop/start would also start nmbd or not. Just tried it. It does.
(was also a bit uncertain at what stage of boot /ffp/start is processed. I have the box about a week)
I've edited the script above to include that missing part.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 15, 2010, 05:15:25 PM
Let us know how it works out. :)
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 16, 2010, 04:06:43 AM
It works. I restarted the DNS-323 and was able to access my shares without a problem from the XP SP3 box. I also tried restarting my PC and had no problems as well.

I've cleaned the script up a bit more, and made it slightly more safer to use: smb restart will only be called if editing smb.conf succeeded. Otherwise, restore smb.conf from backup.

Here it is: editsmbconf.sh
Code: [Select]
#!/bin/sh

# After rebooting the DNS-323, often you can't access your shares from
# windows machines. This script "should" fix this by adding the following
# three lines to the [ global ] stanza of /etc/samba/smb.conf:
#    domain master = no
#    local master = no
#    preferred master = no
#
# INPORTANT: If anything goes wrong here, you might not be able to access
#            your data. Only use this if you know how to recover from such
#            a problem by yourself.

#
# Commands
#
echoCmd="/bin/echo"
cpCmd="/bin/cp"
sedCmd="/ffp/bin/sed" # Couldn't get it to work with /bin/sed
smbCmd="/usr/bin/smb"

#
# Files
#
smbConf="/etc/samba/smb.conf"
smbConfBackup="/etc/samba/smb.conf.old"


${echoCmd} "Backing-up ${smbConf} to ${smbConfBackup}"
${cpCmd} -a ${smbConf} ${smbConfBackup}

${echoCmd} "Modifying ${smbConf}"
${sedCmd} -e '/\[ global \]/adomain master = no' -e '/\[ global \]/alocal master = no' -e '/\[ global \]/apreferred master = no' ${smbConfBackup} > ${smbConf}
if test $? -eq 0; then
    ${echoCmd} "Done! Restarting smb and nmb daemons"
    ${smbCmd} restart
else
    ${echoCmd} "Error! Recovering ${smbConf} from backup ${smbConfBackup}"
    ${cpCmd} -fa ${smbConfBackup} ${smbConf}
fi

Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 16, 2010, 05:10:26 AM
Actually, stopping and starting SMB is not a problem, it won't hurt anything.  No need to make the script conditional on anything, just stop it when you start, and start it before you exit the script.

Did you test this and verify that the lines are being properly added to the configuration file?

I also note that if you only have one device like the DNS-323 in the system, having it be the master browser isn't necessarily a bad thing, it's nice to have a device that's always there doing this function.  I have my Synology DS209 as my browse master since it's always on.


If you're interested in seeing a listing of the master browsers on the network, I use LAN Scanner from this page: http://scottiestech.info/downloads/ (http://scottiestech.info/downloads/).  It will list all the hosts that think they're the master browser, there should be only one.


Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 16, 2010, 05:55:22 AM
Actually, stopping and starting SMB is not a problem, it won't hurt anything.  No need to make the script conditional on anything, just stop it when you start, and start it before you exit the script.
Not sure I understand. I was worried that if editing smb.conf somehow corrupts it restarting smb will leave me without shares. Couple that with a telnet/ssh problem and you've got yourself a real issue.

Did you test this and verify that the lines are being properly added to the configuration file?
Yup. Mind you, I don't have a printer, and only one PC (XP SP3).

I also note that if you only have one device like the DNS-323 in the system, having it be the master browser isn't necessarily a bad thing, it's nice to have a device that's always there doing this function.  I have my Synology DS209 as my browse master since it's always on.
So far, in my case this proved only to cause this minor grievance when restarting the DNS-323. That (restart) should be rare thing. But I'm still fooling around with it (fun fun fun) so while I'm at it this should help a little.

If you're interested in seeing a listing of the master browsers on the network, I use LAN Scanner from this page: http://scottiestech.info/downloads/ (http://scottiestech.info/downloads/).  It will list all the hosts that think they're the master browser, there should be only one.
I used: nbtstat from the command line.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 16, 2010, 06:02:37 AM
I guess since you're talking to this with Telnet or SSH, I can't see how starting and stopping SMB is going to break that.  I must be an optimist. :D  Do you really see this as a real possibility?
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 16, 2010, 06:14:12 AM
I guess since you're talking to this with Telnet or SSH, I can't see how starting and stopping SMB is going to break that.  I must be an optimist. :D  Do you really see this as a real possibility?
Not really. One of my try runs with sed from the CLI resulted with an empty file. That's why I came up with that double checking.

Following what you wrote about the benefits of an always-on machine being the master browser I realized that I've gone about this wrong. The reason why after reboot the DNS-323's shares aren't imidiately accessible is becuase, by default, preferred master = no, which means after reboot the DNS-323 doesn't force an election of the master browser.

I changed the script so that the DNS-323 will be the master browser of it's workgroup and subnet and also force an election for master browser after it boots
Code: [Select]
#!/bin/sh

# After rebooting the DNS-323, often you can't access your shares from
# windows machines. This script "should" fix this by adding the following
# three lines to the [ global ] stanza of /etc/samba/smb.conf:
# domain master = yes
# local master = yes
# preferred master = yes
# What this does is make the DNS-323 the master browser of its workgroup,
# subnet and also make it force an election for master browser after it
# is booted.
#
# INPORTANT: If anything goes wrong here, you might not be able to access
#            your data. Only use this if you know how to recover from such
#            a problem by yourself.

#
# Commands
#
echoCmd="/bin/echo"
cpCmd="/bin/cp"
sedCmd="/ffp/bin/sed" # Couldn't get it to work with /bin/sed
smbCmd="/usr/bin/smb"

#
# Files
#
smbConf="/etc/samba/smb.conf"
smbConfBackup="/etc/samba/smb.conf.old"


${echoCmd} "Backing-up ${smbConf} to ${smbConfBackup}"
${cpCmd} -a ${smbConf} ${smbConfBackup}

${echoCmd} "Modifying ${smbConf}"
${sedCmd} -e '/\[ global \]/adomain master = yes' -e '/\[ global \]/alocal master = yes' -e '/\[ global \]/apreferred master = yes' ${smbConfBackup} > ${smbConf}
if test $? -eq 0; then
${echoCmd} "Done! Restarting smb and nmb daemons"
${smbCmd} restart
else
${echoCmd} "Error! Recovering ${smbConf} from backup ${smbConfBackup}"
${cpCmd} -fa ${smbConfBackup} ${smbConf}
fi

Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 16, 2010, 06:24:05 AM
Yep, if it's the only device that insists on being the master browser, it's usually beneficial to let it assume that role. :)

The situation you don't want it multiple machines trying to assume that role.  Before my modifications, I had the DNS-321, DNS-323, and the Synology all trying to assume that role!  I also had some issues with delays and occasionally a machine would get "lost" on the network.  Since shutting the two D-Link boxes up, that stopped happening. :)
Title: Re: Shares are not accessible after reboot (1.08)
Post by: Ita_gsxr on August 16, 2010, 06:39:14 AM
First of all let me thank you Scaramanga and Gunrunnerjohn for your help!!

Unfortunately I don't feel so confident to try this approach. I have poor linux basic. And my NAS is now full of data.

I have also noticed that after all things seems to run smoother on my network when 323 is the master browser.

Meanwhile I found a Microsoft tool called BROWSTAT.EXE (you can find it here: http://www.microsoft.com/downloads/details.aspx?familyid=49ae8576-9bb9-4126-9761-ba8011fabf38&displaylang=it ) that could be useful:

browstat getmaster (search for Master Browser)
browstat tickle (force remote master service to stop)

Now I have multiple choice:
1) Boot NAS, log on to the 323, go to the NETWORK ACCESS section and modify one rule to get access to the shares

2) Force Master Browser to stop on both my pc using Browstat before booting the 323 so it can be the MBrowser.

3) Boot the 323 before pc.

Oh I even found that is possible to set some xp registry key to prevent a machine to become the master. But this way for me it's not good because when the 323 is off one my pc need to be the Mbrowser.

------------------- Found in others forum
http://www.tomsguide.com/us/how-to-xp-share-fix,review-215-7.html

Master Browser requires NetBT (NetBIOS over Tcp)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Browser\Parameters\.

MaintainServerList = Auto (default) choices are Auto, Yes, No
IsDomainMaster =FALSE (default) choices are True and False

Set it to:

MaintainServerList = No
IsDomainMaster =FALSE
-------------------------
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 16, 2010, 06:43:59 AM
Why do you turn your DNS-323 off?  It uses about 6 watts in idle, I'd just leave it on. :)
Title: Re: Shares are not accessible after reboot (1.08)
Post by: Ita_gsxr on August 16, 2010, 06:45:27 AM
I forgot the most important feature:

BROWSTAT ELECT - Force election on remote domain

 :D
Title: Re: Shares are not accessible after reboot (1.08)
Post by: Ita_gsxr on August 16, 2010, 06:50:38 AM
Why do you turn your DNS-323 off?  It uses about 6 watts in idle, I'd just leave it on. :)

It's not for the power consumption, simply I don't have a UPS. What happens to my data in case of power failure?
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 16, 2010, 07:04:07 AM
Well, if you're using EXT3, it is a journaling filesystem and has good protection from sudden shutdowns.

Of course, there's always the option of buying a UPS... :)
Title: Re: Shares are not accessible after reboot (1.08)
Post by: Rodent on August 16, 2010, 04:29:37 PM
Following what you wrote about the benefits of an always-on machine being the master browser I realized that I've gone about this wrong. The reason why after reboot the DNS-323's shares aren't imidiately accessible is becuase, by default, preferred master = no, which means after reboot the DNS-323 doesn't force an election of the master browser.

I changed the script so that the DNS-323 will be the master browser of it's workgroup and subnet and also force an election for master browser after it boots

If I have this right when the DNS323 is turned on it is becoming a master browser but not forcing an election so the already master browser continues to perform this roll also and all computers that are already on and using this master browser will not be able to contact the DNS323 but any computer that is rebooted or turn on and is lucky enough to start using the DNS323 as its master browser will connect to it fine and will start having problems connecting to the rest of the network that is still pointing to the other master browser.

I believe this problem has been around for a long time as I have posted several times on this subject so why is it so hard for D-Link to fix it?

R.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: gunrunnerjohn on August 16, 2010, 04:36:47 PM
Actually, that's not how the master browser works.

The master browser will make periodic announcement broadcasts to let all the NETBIOS instances know he's alive, then they know where to send name requests.  If another machine gets confused about the master browser, an election is called.  However, if the DNS-323 has all the settings previously mentioned in this thread enabled, it will win any election unless there's another true server in the picture.
Title: Re: Shares are not accessible after reboot (1.08)
Post by: Ita_gsxr on August 17, 2010, 03:38:55 AM

I believe this problem has been around for a long time as I have posted several times on this subject so why is it so hard for D-Link to fix it?


Even If this is not a big problem it's really annoying. I've done firmware update from 1.03 to 1.08 hoping to resolve it. But nothing has changed.

It could be an improvement if in the next firmware release D-LINK add the possibility to choose the behaviour of the dns-323 regard Master browser election.

#   domain master = yes/no
#   local master = yes/no
#   preferred master = yes/no

Don't you think?
Title: Re: Shares are not accessible after reboot (1.08)
Post by: scaramanga on August 17, 2010, 04:29:20 AM
I believe this problem has been around for a long time as I have posted several times on this subject so why is it so hard for D-Link to fix it?

It's, probably, not a question of how difficult/expensive it is to fix. It's a matter of priorities.