Discussion:
[Samba] Cannot access WD's NetCenter drive from linux
samba newbie
2006-07-27 06:04:27 UTC
Permalink
Hello folks.

I bought a Western Digital NetCenter drive since it
seemed a low-cost way of having a NAS in my home. The
NetCenter drives run GPL'ed software (I downloaded the
source from Western Digital's Web site, and it refers
to Broadcom's "BCM478x Linux NASoC Software." The src
directory also contains samba 3.0.2.)

The device offers two ways of accessing your data:
through CIFS, or through NFS. There is no security on
NFS shares. You can specify share-level passwords for
CIFS, which is better than nothing, so that seemed to
be the way to go. Also, my data lives on a Windows
box, so CIFS made sense.

Now, I want to access that data using Samba from
Fedora Core 3 (2.6.12-1.1378_FC3). On my Linux box, I
mount one of the shares using:

mount -t smbfs -o ro //192.168.0.251/Pictures
/media/Pictures

This prompts me for a password, and upon correct
entry, it goes ahead and mounts the share. So far, so
good.

I can also go ahead and read the directory structure
without any problems. Running the following for 20
minutes:

while [ 1 ]; do find /media/Pictures -print -exec stat
{} \; >/dev/null; sleep 1; done

caused no problems.

However, as soon as I actually tried reading a file,
access to that directory hung. I could no longer 'ls'
anything in that directory. The stat command reported
input/output errors.

/var/log/messages is full of errors along the lines
of:
Jul 24 16:57:51 mj-desktop kernel: smb_add_request:
request [f5d3b980, mid=10175] timed out!
Jul 24 16:57:51 mj-desktop kernel: smb_lookup: find
//sub_folder failed, error=-5

I can also no longer umount that directory; Linux
thinks the device is busy. I can't rmmod the smbfs
kernel module. The only way to recover is to reboot
the machine.

If, on my Linux machine, after rebooting, I mount the
share and quickly try to cp a file over from the
remote share to my linux machine, it occasionally
works. So, for a very short bit of time (on the order
of a minute), the access works correctly.

I found through google that mounting using cifs should
allow me to gather more debugging info on the client
side (since I can do 'echo 1 >
/proc/fs/cifs/cifsFYI'). So I tried to mount my share
using 'mount -t cifs'. Unfortunately, this fails with
return code -1. I think this is because the mount is
trying to do user-level authentication (since it
correctly sends my share-level password, but also
reports to the server that the user is 'root'). I get
back:

Status code returned 0xc000006a
NT_STATUS_WRONG_PASSWORD

There is no documentation on the mount.cifs man page
to force share-level authentication.

At this stage, I'm stumped. I have no access to the
server logs (since the NetCenter is a black-box
appliance).

I should note that access from my Windows box worked
fine, at least for writing. I spent the last few days
backing up over 100GB of music and pictures to shares
on the NetCenter from my Windows machine. It's a
shame I can only access it from that machine. It
makes the idea of buying the device pointless: if the
only machine that can access it is my Windows box,
it's cheaper (and much faster) to simply hook up an
external USB drive to it. But I digress...

Any ideas? Is there anything else I can do to gather
more debugging data? Any mount options I should try?

I should mention that similar access from Mac OS X
(10.4.7) doesn't appear to hang. I can mount using
the same command-line options, and access the data
without difficulty. So maybe this is an issue with
the kernel on my linux box? Is this a known issue
that is solved in later kernels?

Thanks!

P.S. I had submitted a support request to Western
Digital asking for help with this problem (I had also
asked whether they could let me know how to access the
logs or how to roll my own firmware from the source).
They just wrote back saying that Broadcom downsized
the department that wrote the software, and thus they
have no answers for me. Lovely.


__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam
protection around
http://mail.yahoo.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Jeremy Allison
2006-07-27 06:07:33 UTC
Permalink
Post by samba newbie
Hello folks.
I bought a Western Digital NetCenter drive since it
seemed a low-cost way of having a NAS in my home. The
NetCenter drives run GPL'ed software (I downloaded the
source from Western Digital's Web site, and it refers
to Broadcom's "BCM478x Linux NASoC Software." The src
directory also contains samba 3.0.2.)
through CIFS, or through NFS. There is no security on
NFS shares. You can specify share-level passwords for
CIFS, which is better than nothing, so that seemed to
be the way to go. Also, my data lives on a Windows
box, so CIFS made sense.
Now, I want to access that data using Samba from
Fedora Core 3 (2.6.12-1.1378_FC3). On my Linux box, I
mount -t smbfs -o ro //192.168.0.251/Pictures
/media/Pictures
Don't use smbfs - it's unsupported. Use CIFSFS instead.

Jeremy.
Adam Nielsen
2006-07-27 06:47:29 UTC
Permalink
I think this is because the mount is trying to do user-level
authentication (since it correctly sends my share-level password, but
also reports to the server that the user is 'root').
There is no documentation on the mount.cifs man page
to force share-level authentication.
User-level and share-level authentication are only terms for
configuring the server, they both appear the same way on the client.
The only difference between the two is that if the server is set up for
share-level authentication, it should ignore whatever username you
supply.

If you do want to try a different username, use the -U option with
smbclient or "-o username=blah" with mount. But if it's true
share-level authentication, the username you supply won't make a
difference, the server will only be interested in the password.
At this stage, I'm stumped. I have no access to the
server logs (since the NetCenter is a black-box
appliance).
But you said you could download the source? You could recompile that
and enable SSH or something, presumably? They may even have some sort
of SSH or telnet access already built in.
Any ideas? Is there anything else I can do to gather
more debugging data? Any mount options I should try?
You could try using Ethereal and see what's actually going over the
network when the share locks up, but beyond that it could be tricky
without access to the server.

Cheers,
Adam.
samba newbie
2006-07-27 09:47:15 UTC
Permalink
Adam,

THank you for responding. Further questions below...
Post by Adam Nielsen
User-level and share-level authentication are only
terms for
configuring the server, they both appear the same
way on the client.
OK, then I need to rephrase my point here: any ideas
why mounting when specifying smbfs works, but
specifying cifs fails with STATUS_WRONG_PASSWORD (the
same password is given in both situations)? I'm only
changing the fs option to mount; all other input is
the same.

When mounting with smbfs, ethereal shows that the
order of traffic is:
* the client sends an smb packet with a negotiate
protocol request
* the server replies with a negotiate protocol
response
* the client sends a Session Setup AndX Request
specifying the incorrect user and incorrect domain but
only '00' as the ANSI password
* the server responds with success and reports the
correct domain
* the client sends a Tree Connect AndX Request
specifying the correct share path and what I presume
is the encrypted version of the actual password
* the server responds with success.

With cifs specified as the filesystem, something
slightly different occurs:
* the client sends an smb packet with a negotiate
protocol request
* the server replies with a negotiate protocol
response
* the client sends a Session Setup AndX Request
specifying the incorrect user and domain and what I
imagine is the actual password in ANSI (I presume this
is encrypted) and in unicode
* the server responds with success and reports the
correct domain
* the client sends a Tree Connect AndX Request
specifying the correct share path but only '00' as the
password
* the server responds with STATUS_WRONG_PASSWORD.

The fact that, with cifs, the password is not being
sent at the same time as the share specification would
seem to suggest that something incorrect is taking
place in the client software when sending the request.
This is why I was asking whether I needed to specify
some different options to mount when dealing with
cifs.
Post by Adam Nielsen
Post by samba newbie
At this stage, I'm stumped. I have no access to
the
Post by samba newbie
server logs (since the NetCenter is a black-box
appliance).
But you said you could download the source? You
could recompile that
and enable SSH or something, presumably? They may
even have some sort
of SSH or telnet access already built in.
There are no instructions provided. I have no idea
what the toolchain requirements are, so I don't even
know if I can compile it. I'll certainly try,
however, if I have the time (not looking forward to
this).
Post by Adam Nielsen
Post by samba newbie
Any ideas? Is there anything else I can do to
gather
Post by samba newbie
more debugging data? Any mount options I should
try?
You could try using Ethereal and see what's actually
going over the
network when the share locks up, but beyond that it
could be tricky
without access to the server.
I'll try this as well.
Post by Adam Nielsen
Cheers,
Adam.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Adam Nielsen
2006-07-27 11:11:41 UTC
Permalink
Post by samba newbie
* the client sends a Tree Connect AndX Request
specifying the correct share path but only '00' as the
password
* the server responds with STATUS_WRONG_PASSWORD.
The fact that, with cifs, the password is not being
sent at the same time as the share specification would
seem to suggest that something incorrect is taking
place in the client software when sending the request.
This indeed does appear to be the problem. Is 'mount' prompting you
for the password, or are you specifying it as a mount option? Does it
make a difference doing it the other way? (-o password=blah)

If you disable CIFS UNIX extensions, does that make a difference?
(echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled) Possibly the
negotiation there is confusing the server.

Does "mount \\whatever --verbose -o blah" give you any new information?

That's pretty much everything I can think of, so sorry I couldn't be
more helpful!

Cheers,
Adam.
samba newbie
2006-07-27 12:10:42 UTC
Permalink
Thanks once again, Adam. Some more comments below...
Post by Adam Nielsen
Post by samba newbie
* the client sends a Tree Connect AndX Request
specifying the correct share path but only '00' as
the
Post by samba newbie
password
* the server responds with STATUS_WRONG_PASSWORD.
This indeed does appear to be the problem. Is
'mount' prompting you
for the password, or are you specifying it as a
mount option? Does it
make a difference doing it the other way? (-o
password=blah)
Makes no difference either way.
Post by Adam Nielsen
If you disable CIFS UNIX extensions, does that make
a difference?
(echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled)
Possibly the
negotiation there is confusing the server.
Makes no difference either.
Post by Adam Nielsen
Does "mount \\whatever --verbose -o blah" give you
any new information?
Sure, but nothing useful.
Post by Adam Nielsen
That's pretty much everything I can think of, so
sorry I couldn't be
more helpful!
Cheers,
Adam.
Hey, no worries. I appreciate your efforts,
nonetheless. I can only assume this is a bug in
mount.cifs (which may have been fixed in later
versions).

But that's not the main problem anyway; the hang is.
I've narrowed the problem behaviour down a bit. It
happens when one process is already reading all the
files in a directory under a samba share, and another
process tries to do a read on one of the files in that
directory. That's when the timeouts start to occur,
and things freeze up.

In terms of user actions, this happens when I use an
image management program (picasa or gthumb, for
example) to show thumbnails of all the JPEG files in a
subdirectory of a samba share, and while the
thumbnails are still loading for that directory, I
double-click one of the thumbnails to try to view the
image.
Post by Adam Nielsen
From watching traffic in ethereal, the thumbnail loads
are generating a steady flow of Read AndX Request
packets from the client and Read AndX Response packets
from the server (the image program is requesting the
contents of each file). When I double-click the file,
a new negotiate protocol request/response sequence
occurs. The next Read AndX Request packet from the
client (from the process loading the thumbnails) runs
into problems: the server thinks the FID is invalid
(the FID is definitely valid, since the server had
returned it to the client and had transferred multiple
MB's worth of data for it already at this point).
Pure speculation here, but maybe the kernel-space
samba client process gets confused and sends the read
request on the newly negotiated connection, which
causes confusion to ensue.

A workaround is to let all the thumbnails load, and
then to access one file at a time. No problems occur
if I do this. This kinda sucks, but hey - it works at
least.





__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Adam Nielsen
2006-07-27 12:17:31 UTC
Permalink
Post by samba newbie
Pure speculation here, but maybe the kernel-space
samba client process gets confused and sends the read
request on the newly negotiated connection, which
causes confusion to ensue.
What version of Samba are you running on the client?

If you suspect it's a problem with the client, try using the userspace
program "smbclient" to reproduce the problem. If you can reproduce it
with smbclient, you could try compiling some alternate versions of
Samba, and instead of installing them just run smbclient from the
compilation directory. That would at least tell you whether there's a
version of Samba that works successfully. I'd start with the same
version that runs on the server, because if that version has problems
I'd begin to wonder about the server.

Cheers,
Adam.
samba newbie
2006-07-27 12:45:34 UTC
Permalink
Post by Adam Nielsen
What version of Samba are you running on the client?
3.0.10, as opposed to what I believe is 3.0.2 on the
server.
Post by Adam Nielsen
If you suspect it's a problem with the client, try
using the userspace
program "smbclient" to reproduce the problem.
I tried to reproduce with smbclient, but failed. I
opened two separate smbclient sessions. In one, I ran
mget on a directory; in the other, while the mget was
running, I did individual gets on files in that
directory. No problems occurred.

So I don't think the server is the problem.

I need a non-interactive solution on the client side
(for scripting, etc.), so I'll try seeing whether the
samba client in FC5 works better. If so, I'll just
upgrade my client machine.

Maybe the mount.cifs problem will go away in the FC5
version as well. If not, I'll need to post again to
this list.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Loading...