Discussion:
[Samba] xls file locked for editing by unknown user
(too old to reply)
Dave Coventry
2010-06-28 09:30:02 UTC
Permalink
I'm not sure that this is the right place to ask about this, but one
of my users is having a problem with her files,specifically excel
files which she is editing with openoffice.

I suspect that she is closing down her PC without logging out or
something and so appears to be still logged in.

She is using Vista and the server is a Debian Lenny box.

Whenever she tries to access the files on the server the file is
apparently "locked for editing by unknown user".

I cannot find any .~ lockfiles and rebooting both machines does not
resolve this.

The permissions are set to 777 and the owner of the files is this
particular user.

As I say, I'm assuming this is a Samba issue.

Can anyone suggest a way to resolve this?

~ Dave
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Moray Henderson (ICT)
2010-06-29 09:00:03 UTC
Permalink
Post by Dave Coventry
I'm not sure that this is the right place to ask about this, but one
of my users is having a problem with her files,specifically excel
files which she is editing with openoffice.
I suspect that she is closing down her PC without logging out or
something and so appears to be still logged in.
She is using Vista and the server is a Debian Lenny box.
Whenever she tries to access the files on the server the file is
apparently "locked for editing by unknown user".
I cannot find any .~ lockfiles and rebooting both machines does not
resolve this.
The permissions are set to 777 and the owner of the files is this
particular user.
As I say, I'm assuming this is a Samba issue.
Can anyone suggest a way to resolve this?
~ Dave
Which version of Samba?

Does smbstatus(1) list the file as being locked? If so, it should give
a pid you can examine. The fuser(1) and lsof(8) commands can track
which process has a file open.

If rebooting the server does not clear the lock, there's either a lock
file or a cached lock record somewhere. Try /var/lib/samba/locking.tdb.
Although it's binary, you can grep(1) it for the filename, or use
tdbdump(8) to display the contents. According to
http://wiki.samba.org/index.php/Frequently_Asked_Questions#What_are_tdb_
files.3F, locking.tdb is not required to persist across restarts. I
wouldn't try deleting this when Samba is running; even with Samba shut
down I would rename it rather than deleting it.

However, there has got to be a better solution to stale locks than
restarting Samba and deleting a tdb file every time it happens. Does
the lock clear automatically after a time? There may be lock tuning
parameters that could help - see smb.conf(5) for details.


Moray.
"To err is human.  To purr, feline"
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Dave Coventry
2010-06-29 09:10:01 UTC
Permalink
Hi Moray, thanks for the assistance!
Post by Moray Henderson (ICT)
Which version of Samba?
Samba version 3.2.5
Post by Moray Henderson (ICT)
Does smbstatus(1) list the file as being locked?  If so, it should give a pid you can examine.  The fuser(1) and lsof(8) commands can track which process has a file open.
No. smbstatus returns "No locked files"
Post by Moray Henderson (ICT)
If rebooting the server does not clear the lock, there's either a lock file
or a cached lock record somewhere.  Try /var/lib/samba/locking.tdb.
 Although it's binary, you can grep(1) it for the filename, or use
tdbdump(8) to display the contents.  According to
http://wiki.samba.org/index.php/Frequently_Asked_Questions#What_are_tdb_files.3F,
locking.tdb is not required to persist across restarts.  I wouldn't try deleting
this when Samba is running; even with Samba shut down I would rename it
rather than deleting it.
There is no file in /var/lib/samba/ called 'locking.tdb'
The only files in that directory bearing a date later than 14th Dec
2009 are these three:
passdb.tdb
registry.tdb
wins.dat
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Denis Fateyev
2010-06-29 10:00:03 UTC
Permalink
Hello Dave,

`lsof | grep "your-file-name"`

If it locked with any of smbd process, try `kill PID`, where `pid` - smbd
pid you've got previously.

---
wbr, Denis.
Post by Dave Coventry
Hi Moray, thanks for the assistance!
Post by Moray Henderson (ICT)
Which version of Samba?
Samba version 3.2.5
Post by Moray Henderson (ICT)
Does smbstatus(1) list the file as being locked? If so, it should give a
pid you can examine. The fuser(1) and lsof(8) commands can track which
process has a file open.
No. smbstatus returns "No locked files"
Post by Moray Henderson (ICT)
If rebooting the server does not clear the lock, there's either a lock
file
Post by Moray Henderson (ICT)
or a cached lock record somewhere. Try /var/lib/samba/locking.tdb.
Although it's binary, you can grep(1) it for the filename, or use
tdbdump(8) to display the contents. According to
http://wiki.samba.org/index.php/Frequently_Asked_Questions#What_are_tdb_files.3F
,
Post by Moray Henderson (ICT)
locking.tdb is not required to persist across restarts. I wouldn't try
deleting
Post by Moray Henderson (ICT)
this when Samba is running; even with Samba shut down I would rename it
rather than deleting it.
There is no file in /var/lib/samba/ called 'locking.tdb'
The only files in that directory bearing a date later than 14th Dec
passdb.tdb
registry.tdb
wins.dat
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Dave Coventry
2010-06-29 11:40:01 UTC
Permalink
Hi Dennis,
Post by Denis Fateyev
Hello Dave,
`lsof | grep "your-file-name"`
The command:
lsof | grep "Electricity Spreadsheet.ods"

Give no output.

The User says that all the files in the directory are locked. So, I've run
lsof | grep "Water & Elec Consumption"

which gives this output:
bash 4103 root cwd DIR 8,2 4096
67715823 /home/patience/Water & Elec Consumption
bash 5466 root cwd DIR 8,2 4096
67715823 /home/patience/Water & Elec Consumption
lsof 5619 root cwd DIR 8,2 4096
67715823 /home/patience/Water & Elec Consumption
grep 5620 root cwd DIR 8,2 4096
67715823 /home/patience/Water & Elec Consumption
lsof 5621 root cwd DIR 8,2 4096
67715823 /home/patience/Water & Elec Consumption

# kill 4103
# kill 5466
# kill 5619
-bash: kill: (5619) - No such process
# kill 5620
-bash: kill: (5620) - No such process
# kill 5621
-bash: kill: (5621) - No such process
# lsof | grep "Water & Elec Consumption"
bash 4103 root cwd DIR 8,2 4096
67715823 /home/patience/Water & Elec Consumption

All files in /home/patience/Water & Elec Consumption still locked.

:~(
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Dave Coventry
2010-06-29 13:00:01 UTC
Permalink
Hi Klaus,
Hi Dave,
I´m not at all an expert on Samba, but might it be something quite
simple as the ampersand-sign (&) within your directory name ?!?
There are other directories which do not have the ampersand, but which
also demonstrate the same behaviour, so I don't think it's the
ampersand.
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Dave Coventry
2010-06-29 14:40:02 UTC
Permalink
Did you have these locks immediately after you restarted the samba service?
Yes.
If not, I suggest you to deploy `3.4 - 3.5` samba branch on test machine and
check it out with vista again.
The funny thing is it was working fine before. I don't have a test
machine(well, not ons site anyway)
As I know, there is recommended to use samba version greater than 3.3, if
you're planning to use it with vista.
With test machine, you won't break anything in working configuration and
will check it's compatibility with new windows versions.
I personally use `3.5.3` with windows xp and seven in my local network. The
server with samba acts as domain controller and there are no any issues with
xp nor seven.
Okay, I'll look into installing a backports version,then...
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Moray Henderson
2010-06-30 11:10:02 UTC
Permalink
Post by Dave Coventry
Hi Moray, thanks for the assistance!
On 29 June 2010 10:41, Moray Henderson (ICT)
Post by Moray Henderson (ICT)
Which version of Samba?
Samba version 3.2.5
Post by Moray Henderson (ICT)
Does smbstatus(1) list the file as being locked?  If so, it should
give
Post by Dave Coventry
a pid you can examine.  The fuser(1) and lsof(8) commands can track
which
Post by Dave Coventry
process has a file open.
No. smbstatus returns "No locked files"
Post by Moray Henderson (ICT)
If rebooting the server does not clear the lock, there's either a
lock
Post by Dave Coventry
file
Post by Moray Henderson (ICT)
or a cached lock record somewhere.  Try /var/lib/samba/locking.tdb.
 Although it's binary, you can grep(1) it for the filename, or use
tdbdump(8) to display the contents.  According to
http://wiki.samba.org/index.php/Frequently_Asked_Questions#What_are_tdb
_fi
Post by Dave Coventry
les.3F,
Post by Moray Henderson (ICT)
locking.tdb is not required to persist across restarts.  I wouldn't
try
Post by Dave Coventry
deleting
Post by Moray Henderson (ICT)
this when Samba is running; even with Samba shut down I would rename it
rather than deleting it.
There is no file in /var/lib/samba/ called 'locking.tdb'
The only files in that directory bearing a date later than 14th Dec
passdb.tdb
registry.tdb
wins.dat
The current .tdb files must be in a different location on Debian Lenny
Samba 3.2.5. /var/cache/samba is another common place. Try

testparm -sv | grep directory

In Samba 3.4 the "state directory" and "cache directory" parameters tell
you where to find them. Can't remember now if they were there in 3.2.
If not, use

smbd -b | less

and look for STATEDIR and CACHEDIR in the Samba build options.


Moray.
"To err is human.  To purr, feline"
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
t***@tms3.com
2010-06-30 12:40:01 UTC
Permalink
Post by Moray Henderson
The current .tdb files must be in a different location on Debian Lenny
Samba 3.2.5. /var/cache/samba is another common place. Try
testparm -sv | grep directory
Or

find / -name \*.tdb -print
Post by Moray Henderson
In Samba 3.4 the "state directory" and "cache directory" parameters
tell
you where to find them. Can't remember now if they were there in 3.2.
If not, use
smbd -b | less
and look for STATEDIR and CACHEDIR in the Samba build options.
Moray.
"To err is human. To purr, feline"
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
--
To unsubscribe from this list go to the following URL and read the
instructions: https://lists.samba.org/mailman/options/samba
Loading...