File locked in LibreOffice (no ".~lock" file to delete)

Virtually every time I work on and then close a LibreOffice file on one of my computers, I find it’s been locked and can’t be edited when I try to open it in my other computer. (They’re shared via a program called SugarSync.) The suggested response on this forum is to find and delete a “.~lock” file in the first computer’s directory. Even if it worked, this would be irritating to have to do every time one closes a file. But often it doesn’t work because there doesn’t seem to be any such file (and, yes, I’ve enabled “search hidden files”). My computers are running Windows 7 and 8, respectively, by the way, and I’m using the most recent release of Libre on both systems.

The only potentially relevant reply I can find in previous threads about this very serious issue (which, it appears, has persisted for years) says <To disable file locking, edit the soffice script and change the line “export SAL_ENABLE_FILE_LOCKING” to “# export SAL_ENABLE_FILE_LOCKING”>.

Unfortunately, I have no idea where to find this file, let alone how to edit it. Any help would be greatly appreciated.

Has anyone edited the “soffice script”? This info is in the README file that comes with the .dmg file for installation. I need to do this. I’m on Mac and single user is not supported in OpenOffice. I will not tolerate file locking. To disable file locking, edit the soffice script and change the line “export SAL_ENABLE_FILE_LOCKING” to “# export SAL_ENABLE_FILE_LOCKING”. If you disable file locking, the write access of a document is not restricted to the user who first opens the documen

I used this solution for years, it does not work any longer in LO6.

I asked the same question and have had no answers

Some thoughts on this:
Using LibreOffice 4.2.4 on Win 7 Pro on a Windows lan, I see that a lock file is created in the documents file folder called “.~lock.FILENAME.FILEext#” without the quotes. If Win 7 is set to “Don’t show hidden files, folders or drives”, you won’t see it. You must check “Show hidden files, folders or drives”.
However, even with the hidden file shown, trying to do a search in the directory from Windows explorer, a strange thing happens: type in the search bar “.~” and the file appears, continue to type “.~lock” and the file disappears! Don’t know why!
Also, using a file sharing service like SugarSync or Dropbox brings its own problems about file locking that has nothing to do with LibreOffice. There are many discussions on the web that discuss this very problem and many of them complain about MS Office. See https://forums.dropbox.com/topic.php?id=16511 or http://longforsuccess.com/2011/04/03/advice-for-using-dropbox-sugarsync-or-box-net-with-quickbooks-or-quicken-files/

Hi, have you tried this solution, seeing whether the lock files are hidden?

Is this BUG REPORT (for problems with ‘locked’ Base files) relevant? Referring to this Bug Report, I don’t know what ‘an open fd’ really means, but maybe that refers to the ‘lock’ file - on my setup (Mac OS) the file is named databasename.lck - maybe try searching for that file pattern?

Update (25 May 2014): As you probably already know, the ‘file locking’ mechanism is meant to stop 2 users trying to simultaneously access (and save changes) to the same file to prevent file corruption, so trying work-around this protection is probably not a good idea (if in fact it’s possible). However, it seems that occasionally the .~lock file does not get auto-deleted when the user closes the file (probably due to a long-existing bug), and this leads to the problem you are experiencing. In most circumstances the lock file is located in the same directory as the original file, but is a ‘hidden’ file becuase the filename begins with a dot (.) - and such files will not show up in a search. So you’ll probably need to explore how to show hidden files on your Windows OS first before you’ll be able to see (and delete) the.~lock file.

Not sure I understand this response, so I wanted to ask whether anyone else might reply. I installed the recent update to LibreOffice and was disappointed to find that this very serious bug apparently hasn’t been addressed. Files are still being locked left and right - with no visible “~.lock” file to delete. Has anyone else found a solution?

I had the same problem with xls files, so I opened the xls and save in xlsx format. It is working here.

I have been having the same problem with OOoLilypond and MuseScore extensions. These extensions take the source file and generate an image file which is then imported into Libreoffice. Since v. 4 of Libreoffice it keeps the output file locked and therefore the extensions cannot overwrite it. Overwriting the file is important to update any changes made to the score.

Linke posts:

Locking under Windows can come from at least 2 sources:-

  1. LO/OO locking via the hidden-file
  2. Windows system-locking (for many & varied reasons)

If you are certain that the LO/OO hidden file does not exist, neither in the document directory nor within your user profile, then your document cannot be locked for that reason. In addition, the error message is very specific, mentioning the user that was editing the file + date/time (that information is stored within the hidden file & is repeated verbatim in the error message). Thus, once the hidden file is removed then the error message cannot be displayed. I’ve suffered this myself under Windows and, once the hidden file was removed (and, in my case, the entire OS replaced) the file became editable again.

If you do not have this kind of file-locking then it is not due to LO/OO; it is due to something else happening within Windows. The possible range of reasons is huge, as Windows is hugely busy, and constantly ‘tasting’ files for all sorts of reasons, based both at the system level & also at the user-application level; the files get locked by Windows whilst being ‘tasted’. Some obvious candidates off the top of my head:-

  1. Windows Search (indexing service to facilitate explorer search)
  2. Anti-Virus
  3. Any one of another 100 services & applications

I have not used file sharing sites but have seen a lot of comments on the web regarding problems encountered by users of file sharing sites such as Dropbox with files of LO and MS Office. I think SugarSync may be the cause of your problem.

You could try a test by disabling the syncing of SugarSync on one of your computers (or disconnect from the net). Open a LO document and whilst it is open check that the lock file is there (in the same directory as the file). It does also create another lock file in your profile named .lock. Check that both these files are removed when you exit LO.

The fact that the problem does not always occur may be due to how long you have the file open. If SugarSync has not synced before you close it the lock file will not have been uploaded but if it has synced then it will be uploaded and then downloaded to your other computer.

I just had the same problem, and ended here. The way I solved it might help someone else.

I could clearly see that the lock file had been deleted. LO still gave me a lock message, saying the file was open by user “unknown.”

If Windows does not know that you want say .doc files opened by LibreOffice, the default is something like wordpad, depending on which OS version you are running. Even though I closed that program, it kept running windowless with its own lock, enforced through the OS.

So, check for any programs which might have the file in question, or the lock file open. You can do this with either the free Sysinternals Process Explorer (supported by MS), or by the free Process Hacker. They search all your processes for a handle with the specified string.