How to disable file locking on linux (Ubuntu) - Permanently

My use case is that I have a number of LibreOffice files on a NAS drive; however when I try to edit these files I get a pop up telling me that LibreOffice can only open these files as read only. As far as I can tell there is nothing stopping LibreOffice creating lock files as needed but there is obviously some problem as everything works fine when editing files on a local hard disk.

This being said, I don’t really need file locking; I’m a home user accessing these files from a single PC, no-one else will be editing them; the simple fix for me is to edit file /usr/bin/soffice and comment out lines:

SAL_ENABLE_FILE_LOCKING=1
export > SAL_ENABLE_FILE_LOCKING

This works fine until LibreOffice updates and insists on undoing my edit and I have to re-edit the soffice file and comment out the lines again. This is very frustrating.

On my system the soffice file is actually located at /usr/lib/libreoffice/program/soffice; I changed this file to read only (ie -r-xr-xr-x) but this didn’t work so I’m looking for some help on how I might fix this.

Either advice on how to make the file locking work to a NFS NAS drive (housed on an Ubuntu Server) OR how to override the settings in soffice file so they persist when LibreOffice updates.

Thanks in advance.

Hello,

Go to Tools -> Options -> LibreOffice -> Advanced -> Button: Open Expert Configuration -> Search: UseLocking and set org.openoffice.Office.Common | Misc | UseLocking to false

Hope that helps.

@anon73440385: Thanks for the snippet. I have implemented and will check back the next time LibreOffice updates. Thanks for the very rapid reply!

I have implemented and will check back the next time LibreOffice updates

This setting is part of file registrymodifications.xcu in your user profile (${HOME}/.config/libreoffice/4/user/ and updating LibreOffice will not affect this file. The only action restoring the defaults is to reset your LibreOffice user profile.

I, initially, marked this answer as ‘correct’ because the warning message disappears when opening a file… but unfortunately I’m still having issues. LibreOffice recently updated to Version: 6.4.6.2. Once again, LibreOffice is the only thing that can’t write to my NAS drive. Things are actually worse now as LibreOffice quite happily opens my files, lets me edit them, then throws up a “Write Error” when saving the file. No warning when I open the file. Editing /usr/lib/libreoffice/program/soffice as per my original post fixes the problem… well until the next update anyway (I also tried setting DocumentSystemFileLocking and WebDAVFileLocking to false … but this does not work either)

Aha … you have a new problem and that’s a reason to mark a correct answer to another problem and the question How to disable file locking on linux (Ubuntu) - Permanently, Funny approach … and good luck for marking all questions, which do not solve your current problem as incorrect.

@anon73440385 No. Having applied the fix recommended. I have the same problem and the only way round the (same) problem is the (same) clumsy workaround. The only difference is I now don’t get a warning, now, when I open the file. Why do you think my problem is different?

Having applied the fix recommended.

I haven’t recommended a fix but answered your question How to disable file locking on linux (Ubuntu) - Permanently (assuming this question is based on your analysis of your problem).

Why do you think my problem is different?

I don’t thing your problem is different. I just think that your initial problem (analysis) causing you to ask How to disable file locking on linux (Ubuntu) - Permanently must be wrong if the solution doesn’t fix your problem now, but this doesn’t change the answer to How to disable file locking on linux (Ubuntu) - Permanently in any way.

fair enough.I marked the answer correct

Hello LibreOffice community. As OrangeReaper stated, changing the UseLocking value to false does not enable editing of NFS files, you will get an error when attempting to save. A person still has to edit /usr/lib/libreoffice/program/soffice. The program is not correctly identifying the open/closed state. The problem has been around for a very long time, I might submit a bug report.