How to unlock file

My computer crashed while I had a file open in calc: “x.ods”. I’m now unable to open the file in write mode again, because calc says the file is already opened by an unknown user.
What I tried:

  • delete the lock file “.~lock.x.ods#”

  • delete “~/.config/libreoffice”

Is there yet another lock file which I have to delete?
By the way, x.ods is not corrupted. If I change it’s name it opens fine.

Verify if the file x.ods file have read/write permissions.

I had read and write permissions.

Where was/is the file stored? Was it on a network location? Try moving it to another location and opening it without renaming it. The lock file and user profile (as you indicate) are the usual methods to solve a basic file lock type of issue. If your computer crashed though you may be experiencing a network file permission issue or a lock by another process (such as the NFS lock daemon).

This is what it says in the readmes/README_en-US file of the GNU/Linux download:

File Locking

File locking is enabled by default in LibreOffice. On a network that uses the Network File System protocol (NFS), the locking daemon for NFS clients must be active. 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 document.

Warning: The activated file locking feature can cause problems with Solaris 2.5.1 and 2.7 used in conjunction with Linux NFS 2.0. If your system environment has these parameters, we strongly recommend that you avoid using the file locking feature. Otherwise, LibreOffice will hang when you try to open a file from a NFS mounted directory from a Linux computer.

Ok, this could be the solution. The file is indeed stored on a NFS. I copied it to my desktop without renaming it and it opened fine. Then I deleted the original file and copied the file from the desktop back. Now everything works fine again.

Thanks for confirming, I will update my answer with a little more detail.

Could someone describe the typical location of “the soffice script” as described above on a Windows 7 installation?

@CSmith, it should be located under C:\Program files (x86)\LibreOffice 4.x\program\.

Worked! Except that instead of copying I moved the file from the folder to the desktop (right click, select “move here”), then just moved it back to the original folder. Opened and edited it with no problem after that. (So no renaming or deleting copies necessary) Thanks!