Ho to solve "The lock file could not be created for exclusive access by libreoffice ..." problem?

When opening a calc file in LO 6.3, following message appears:
“The lock file could not be created for exclusive access by libreoffice, due to missing permission to create a lock file on that file location or lack of free disk space.”

Using LO 5.4 the file can be opened, edited and saved without any issues.

I suppose this problem is related to some into LO newly implemented security/privacy policy but haven’t found any clue how to solve it yet. (I don’t want to add write permission to everybody for the directory where the file is stored)

  • opensuse leap 15.1
  • LibreOffice 6.3.3.2.0 30(Build:2) (currently installed, but the same problem persists since LO 6 appeared)
  • the file is accessed by nfs in LAN
  • file permissions are -rw-rw---- 1 root users (file is owned by root to prevent accidental deletion by a user, users attempting the file belong to group “users”)
  • permissions of the directory where the file is located: drwxr-x— 8 root users (users are not allowed to write to this dir)
  • there is enough free disk space

When I set the UseLocking to False, the file opens but can not be saved after modification. Why?
“Error saving the document:
Write Error.
The file could not be written.”

Because save procedure tries to create a temporary file named similiar to lu14312t4sj0k.tmp and you have set no permission to write (Don’t ask me about the purpose of this temporary file, which obviously is not created on LibreOffice 5.4 and earlier). This got nothing to do with the UseLocking setting.

Hello,

in fact you wrote the solution into parenthesis, when stating:

permissions of the directory where the file is located: drwxr-x— 8 root users (users are not allowed to write to this dir)

The lock file .~lock.<fname># needs to be created within the same directory where the file to be opened/edited is located. If group users has no write permission then members of that group cannot create files within that directory, lock file cannot be created and finally you get what you get. Thus chmod g+w <dir_where_file_is_located> will solve your issue.

Your claim in your question Using LO 5.4 the file can be opened, edited and saved without any issues is true, since LibreOffice 5.4 silently suppresses the error, that it can’t create the lock file and starts over without a lock file.

(I don’t want to add write permission to everybody for the directory where the file is stored)

If you don’t want to do this, your only choice is to disable locking at all (Go toTools -> Options -> LibreOffice -> Advanced -> Button: Open Expert Configuration -> Search: UseLocking and set org.openoffice.Office.Common\Misc\UseLocking to false
)

Update It just turned out that the solution eliminates the warning on opening the file, but you still won’t be able to save the file using LibreOffice version 6.x (not sure when this starts) since - contrary to LibreOffice 5.4 and earlier - the save procedure tries to create a temporary file within the write-disabled directory (luxxxxxxxxx.tmp). Thus the save fails due to the permission.

Hope that helps.

If the answer helped to solve your problem, please click the check mark (:heavy_check_mark:) next to the answer.