Page 1 of 1
Started getting "file locked for editing" messages
Posted: Wed Feb 23, 2011 5:51 pm
by bobnw
I have been using Open Office 3 on a dual boot Ubuntu 10/Vista setup with files on a shared nfs data partition. Until last week I was able to access files edited by my User role or by root on either system. Starting a few days ago I can not change systems or user without getting a "file locked for editing" message. This occurs even if I set Linux permissions to 777. What is the easiest way to reset Open Office to allow access the way it did until a few weeks ago.
Thanks for your suggestions
Re: started getting "file locked for editing" messages
Posted: Wed Feb 23, 2011 6:20 pm
by Villeroy
You have no write access to any file so this issue has nothing to do with OpenOffice.org. Are the Ubuntu forums down?
Re: Started getting "file locked for editing" messages
Posted: Sat Feb 26, 2011 10:35 pm
by bobnw
I have normal read and write access to all files except for OpenOffice files that are locked for editing.
I can still open and edit any OpenOffice Document that was created last year. I can edit these older document Vista or Ubuntu, and it does not matter how I am logged in. I want to the have the kind of access to all my OpenOffice docs.
I did not change anything, so I expect that recent automatic updates made the change. Perhaps the change is part of an nfs file system update in Ubuntu, but there are also OpenOffice settings that could be involved.
Is there a setting in Open Office that could give all users permission to edit a file and not just the user that created it?
Villeroy's sarcastic comment "are the Ubuntu forums down" inspire no confidence in your forum and and are a bad reflection on OpenOffice.
Re: Started getting "file locked for editing" messages
Posted: Sat Feb 26, 2011 10:56 pm
by Hagar Delest
Has the Windows session been closed without hibernation? Perhaps the file is still locked because the file hasn't been closed in the Windows session. In that case, you should see a #filename.lock file (or something like that) in the folder containing the file.
Try to use a FAT32 partition for sharing documents between the 2 OSs. Perhaps there is a glitch with the nfs driver under Ubuntu.
bobnw wrote:Villeroy's sarcastic comment "are the Ubuntu forums down" inspire no confidence in your forum and and are a bad reflection on OpenOffice.
We are users like you here, nobody belongs to the OOo team. So some users may have their own language to tell that the problem is more linked to an OS problem than an OOo one...
Re: Started getting "file locked for editing" messages
Posted: Sat Feb 26, 2011 11:20 pm
by Villeroy
menu:File>Properties... shows the location of the current read-only file.
Is that really your home directory?
Do you really have write access to that file?
Is there a hidden lock file from a crashed session? Typical name is like .~lock.myfile.ods#
Re: Started getting "file locked for editing" messages
Posted: Wed Jul 06, 2011 11:49 pm
by berkoboy
I to am getting this message. I go where the network lets me get coverage so am using laptops with vista, xp and windows 7. It.s only just started.
Re: Started getting "file locked for editing" messages
Posted: Thu Jul 07, 2011 1:53 am
by thomasjk
Search for and delete files named .~lock.
Edit:
corrected lock file naming.
Re: Started getting "file locked for editing" messages
Posted: Fri Sep 02, 2011 8:37 pm
by mjverostek
The network resource accessing the file did not disconnect properly.
The following file is present:
.~lock.[filename_full]#
It contains the following information:
,[COMPUTERNAME]/[username],[computername],[date] [time],[locking_process_location];
This can happen when the locking process is unexpectedly terminated while the resource is still allocated.
Attempt to deallocate the resource from the locking process by ensuring the process is running, ensuring that it has the resource allocated, then manually deallocating the resource from the process.
Or just make sure the process is terminated and delete the following file:
.~lock.[filename_full]#
Re: Started getting "file locked for editing" messages
Posted: Fri Sep 02, 2011 8:43 pm
by mjverostek
Basically, run OpenOffice from the computer that locked it under the user that locked it, open the file and then close the file. The .~lock.[filename_full]# file should be deleted by the process when you close it.
This usually happens when some jack ass just presses the power button on their computer instead of shutting it down properly and it screws up file access for everyone on the network.
I even attempted to restart Samba and no luck.
DON'T DELETE THIS FILE YOURSELF
~~~
So get your netadmin to check to see if the computer that locked the file is active on the network and if not have them delete the .~lock.[filename_full]# file.
If you try to delete it yourself you may screw up a valid resource allocation. Someone may legitimately be using that file, or it may become corrupted. If you can't get a hold of a network administrator then simply copy the file and work off of that.
~~~
DON'T DELETE THIS FILE YOURSELF
Re: Started getting "file locked for editing" messages
Posted: Mon Sep 19, 2011 5:27 pm
by tpkyteroo
mjverostek wrote:Basically, run OpenOffice from the computer that locked it under the user that locked it, open the file and then close the file. The .~lock.[filename_full]# file should be deleted by the process when you close it.
This usually happens when some jack ass just presses the power button on their computer instead of shutting it down properly and it screws up file access for everyone on the network.
Sometimes, a timing glitch can happen that causes such a file to be created when it shouldn't have been. This has nothing to do with user error. I've seen this file before. Windows 7 does have a mechanism that usually pauses the shutting down process in order to correctly close the file such that the locking of it is reversed. However, sometimes, for whatever reason, this does not happen. Also, depending on where a file is saved, windows will lock the file.
What I've had to do is...
right click on file
click on security tab
click EDIT button
change permissions
Click Apply
then Ok
Depending on where this file is, I've had to do this several times before Windows actually accepted the changes. I was changing permissions on a Skins Folder so I could change all the images and files.
Hope this helps someone.

Re: Started getting "file locked for editing" messages
Posted: Fri Jan 20, 2012 4:30 pm
by esarah
This seems to happen to OOO files with a .doc extension. MSWord claims ownership and designates the files as read only. Entering Task Manager and ending the process for WINWORD will allow temporary control. Expunging MS Word from your system should eliminate the problem. Better yet, save the file in .ods -- no problem.
Re: Started getting "file locked for editing" messages
Posted: Fri Jan 20, 2012 11:46 pm
by Bill
esarah wrote:This seems to happen to OOO files with a .doc extension. MSWord claims ownership and designates the files as read only. Entering Task Manager and ending the process for WINWORD will allow temporary control. Expunging MS Word from your system should eliminate the problem. Better yet, save the file in .ods -- no problem.
MS Word does not designate files as read-only. "File locked for editing" means that the file is already open for editing or wasn't properly closed before opening with Writer. If a file is already open in MS Word and is subsequently opened with Writer before being closed in Word, Writer will let the user open the file "read-only". Removal of MS Word just eliminates the possibility that the user will try to open a file in both MS Word and Writer at the same time.
Re: Started getting "file locked for editing" messages
Posted: Sat Jan 21, 2012 3:28 am
by kingfisher
If the lock file is still there after you close the document file, delete the lock file.
Re: Started getting "file locked for editing" messages
Posted: Sun Feb 19, 2012 6:58 am
by Cellular-Decay
bobnw wrote:I have been using Open Office 3 on a dual boot Ubuntu 10/Vista setup with files on a shared nfs data partition. Until last week I was able to access files edited by my User role or by root on either system. Starting a few days ago I can not change systems or user without getting a "file locked for editing" message. This occurs even if I set Linux permissions to 777. What is the easiest way to reset Open Office to allow access the way it did until a few weeks ago.
Thanks for your suggestions
Wow, this question has been here for nearly a year, and EVERYONE got the answer WRONG!
I'm surprised, because this is a well known and very common issue with Open Office. The problem is NOT the OS, it's NOT the file permissions, it's NOT the lock file, and it is ABSOLUTELY the fault of Open Office.
Sometime in the development of OO, some idiot programmer decided that all files on NFS shares should be locked by default. I have no idea who the ass-hat was, or how this moronic decision got pushed to the release version, but to fix it you have to edit the soffice script and comment out the expression that enables locking on NFS shares. What you are looking for is the section that looks like this (from v3.2, may vary with other versions):
Code: Select all
# adjust environment
#
#if [ -z "$SAL_ENABLE_FILE_LOCKING" ]; then
# case "$FILE_LOCKING" in
# auto)
# home_on_nfs "$@"
# if [ $? = 0 ]; then
# STAR_PROFILE_LOCKING_DISABLED=1
# export STAR_PROFILE_LOCKING_DISABLED
# fi
# file_on_nfs "$@"
# if [ $? = 0 ]; then
# SAL_ENABLE_FILE_LOCKING=0
# export SAL_ENABLE_FILE_LOCKING
# # for safety
# STAR_ENABLE_FILE_LOCKING=
# export STAR_ENABLE_FILE_LOCKING
# else
# # file locking now enabled by default
# SAL_ENABLE_FILE_LOCKING=1
# export SAL_ENABLE_FILE_LOCKING
# fi
# ;;
# yes)
# SAL_ENABLE_FILE_LOCKING=1
# export SAL_ENABLE_FILE_LOCKING
# ;;
# no)
# SAL_ENABLE_FILE_LOCKING=0
# export SAL_ENABLE_FILE_LOCKING
# # for safety
# STAR_ENABLE_FILE_LOCKING=0
# export STAR_ENABLE_FILE_LOCKING
# STAR_PROFILE_LOCKING_DISABLED=1
# export STAR_PROFILE_LOCKING_DISABLED
# esac
#fi
With some older versions you could just change the SAL_ENABLE_FILE_LOCKING=1 to SAL_ENABLE_FILE_LOCKING=0, but that no longer works on more recent versions. For the newer releases you need to comment out the entire expression, as shown in my example above. With that done, file locking on NFS shares will work the way it should (it will be locked only when someone else is editing it).
The soffice script is usually found in /usr/bin/, or /usr/lib/openoffice/program/
Re: Started getting "file locked for editing" messages
Posted: Tue Apr 16, 2013 11:24 am
by tapani.ruohola
Gents,
I do have this annoying fault with my Win7 & OpenOffice 3.4.1 environment.
You advise to fix some script which should be found in:
"The soffice script is usually found in /usr/bin/, or /usr/lib/openoffice/program/"
I can't find any of those in my environment, somehow I doubt they are Linux paths?
What is the exact file name?
Please advise how to fix the bug in Win7 environment
rgds
tapsa
Re: Started getting "file locked for editing" messages
Posted: Tue Apr 16, 2013 12:20 pm
by Hagar Delest
Before messing with such configuration files, do you face this problem with all your files or just some?
Are the files on your HD or on a network?
Re: Started getting "file locked for editing" messages
Posted: Tue Apr 16, 2013 5:16 pm
by tapani.ruohola
Thanks for the very prompt response !
I'm using a stand-alone PC, all files are on the HD.
This is how I end up in trouble:
1. Create & save a xyz.xml file, a lock file for it will appear in the folder
2. Save it as Word97 xyz.doc (a lock file for this file also appears in the folder) and close it.
3. Both lock files disappear but you can't access the .xml file, it is "locked for editing by Unknown User". The .doc file is ok.
4. Usually PC restart/boot releases the .xml lock.
Why then I use .xml files? I do have an genealogy application that produces such files (and no other usable format).
Any advices ? Thanks in advance!
Re: Started getting "file locked for editing" messages
Posted: Tue Apr 16, 2013 5:25 pm
by RoryOF
I've tried this. On my system, as soon as the file is Saved As in some other format, the lock file for that format is deleted and a new lock file created for the new format. It can take some seconds for the file information to propagate, so immediately trying to open the other format can encounter the lock, but normal speed in reopening should allow the lock to clear.
Incidently, best to work in .odt fomat than in .doc format.
Re: Started getting "file locked for editing" messages
Posted: Tue Apr 16, 2013 7:05 pm
by Hagar Delest
Do you have the quickstarter active (AOO icon in the system tray, next to the clock)?
If so, close it. Have you tried to wait for some time (without rebooting)? I think I remember some similar topics here about files not released completely. But not sure if it comes from AOO or from the OS.
Re: Started getting "file locked for editing" messages
Posted: Tue Apr 16, 2013 7:17 pm
by RoryOF
Yes, Hagar, you remember correctly. The Quickstarter was blamed for holding some Base/database files open; it had to be closed before the changes were committed. Perhaps the .xml file is similarly affected. My test was on Ubuntu with no Quickstarter.
Re: Started getting "file locked for editing" messages
Posted: Wed Apr 17, 2013 5:57 pm
by tapani.ruohola
Gents,
The same problem appears with .odt also, it seems to be the "save as" in other format?
I do not have the quickstarter active.
I have been waiting, a locked file stays locked until restart, you can't delete it even in dos-box . . .
Please read carefully what I wrote: the lock file DISAPPEAR but the .xml file remains locked.
Still waiting for a working hint . . . anybody who knows where that script is located in Win7 system . . . ?
rgds tapsa
Re: Started getting "file locked for editing" messages
Posted: Wed Apr 17, 2013 6:12 pm
by RoryOF
tapani.ruohola wrote:Please read carefully what I wrote: the lock file DISAPPEAR but the .xml file remains locked.
If the lock file has disappeared, then the lock is most probably being applied, not by OpenOffice, but by the Operating System. You may need to use a system level utility to find what properties the .xml file has, which may lead you towards a resolution of the problem.
Re: Started getting "file locked for editing" messages
Posted: Fri Apr 19, 2013 8:15 pm
by tapani.ruohola
RoryOF wrote: You may need to use a system level utility to find what properties the .xml file has, which may lead you towards a resolution of the problem.
Hmm . . . a Win7 problem says a Unix man(?) , , , chicken existed before egg . . . please advice the referenced "system level utility" in Win7
Re: Started getting "file locked for editing" messages
Posted: Fri Apr 19, 2013 8:38 pm
by RoryOF
There are a number of very powerful debugging tools for Windows at
www.sysinternals.com; it is so long since I used one that I cannot reliably remember the name of the tool I used. I understand that they have been taken over by Microsoft, but last time I checked their site was running (perhaps aliased to an MS Server).
Re: Started getting "file locked for editing" messages
Posted: Mon Feb 09, 2015 4:52 pm
by webmartphoto
When computer crashes or has a power failure there is a hidden file created in the same folder of the document: .~lock.DOCNAME.doc#
Just close your open files and in the same folder of your doc click in the upper left "organize" and chhose "Folder and search options" choose the tab "View" and under "hidden files and folders" choose "Show hidden files, folders, and drives"
Then you'll see the file that is locking your doc.
Just delete it.
Choose back "don't show hidden files, folders, and drives"
Now you can open your file normally again.
Re: Started getting "file locked for editing" messages
Posted: Sat Mar 21, 2015 10:40 pm
by Lycantis
Do not delete the .~Lock.[filename] file until AFTER creating a copy and saving it under a new name. Some people end up destroying the contents of the document and it's always best to save the file in question after each of YOUR sessions with it under the new file, this ensures you have an active backup if this problem does occur or if deleting the Lock file ruins the document in question. At least saving a copy of the file retains the original document for copy and pasting or for complete replacement. The Lock file MUST be deleted or any file with the same name will also become corrupt.
Hope this helps for anyone who did not get the opening/closing the original file to actually work as someone else suggested. It might work for some people but failed to work for me.
Re: Started getting "file locked for editing" messages
Posted: Tue Sep 01, 2015 6:12 am
by wwwalker
I opened 'read-only' PPT file and 'save-as' a different name then deleted the read-only file.
I can edit the new file I created using save-as above.
Maybe I hibernated the Windows 10 laptop instead of closing files then logging out.