Unable to save files after opening them

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 cannot save them afterwards unless I edit file /usr/bin/soffice, before opening the file, and comment out lines:

SAL_ENABLE_FILE_LOCKING=1
export SAL_ENABLE_FILE_LOCKING

This change persists OK 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.

For Info:

Operating System: Ubuntu 20.04.1
LibreOffice Version: 6.4.6.2 thru 7.0.1.2
File type: ODS

Anyone able to help me with this?

Other Info:

if I go to Tools → Options → LibreOffice → Advanced → Button: Open Expert Configuration → Search: UseLocking and set org.openoffice.Office.Common | Misc | UseLocking to false this does not fix my problem and my system is running in this configuration

A full de-installation and fresh installation of LibreOffice does not fix the issue.

Running in Safe Mode does not fix the issue.

When I attempt to save the file a temporary file is created with permissions -rw------ when this file disappears I get a dialog telling me Write Error. The file could not be written.

If i create a file on the NAS using Nautilus (Files) the file has permissions. -rw-rw-rw-; the file I am trying to edit also has permissions -rw-rw-rw-.

I have set UMASK to 0 on the NAS. I did this by editing the file /etc/profile on the NAS and adding the line umask 0. This did not change the behaviour of LibreOffice (in particular the temporary file referred to above still has permissions -rw-------.

No .lock files exist; nor are they created when opening or attempting to save the file I expect this is because UseLocking is disabled in the Expert Configuration.

Everything works as expected when the ods file is stored on PC local hard drive; the issue is specific to the NAS.

The NAS is running Ubuntu Server 18.04.5 but I had the same issue using OpenMediaVault.

UPDATE: After updating to 7.0.1.2 my workaround (edit file /usr/bin/soffice) no longer works. I can now only open files stored on my NAS drive and cannot in any circumstance that I can find save them. This includes saving a brand new file to my NAS. It seems no one here has any clues.

Please expand your information. See:

https://wiki.documentfoundation.org/Ask/Getting_Started

Please don’t use the Answer field, edit your original question to provide further details. Thanks.

SAL_ENABLE_FILE_LOCKING=1 export > SAL_ENABLE_FILE_LOCKING

This makes no sense. Are you sure that export is followed by the output redirection operator >?. Probably it should read:

SAL_ENABLE_FILE_LOCKING=1
export SAL_ENABLE_FILE_LOCKING

Overall the description of the problem ("*cannot save them afterwards*") and the solution (disable file locking - *unless I edit file /usr/bin/soffice*), don't fit. If file locking would be the cause of the problem, then you won't even be able *to open* your files, since file locking causes an immediate creation of a file name `.~lock.#`. But "*cannot save them afterwards*" implicitly tells that you are able to open your file (just saving it causes a problem). This is contradictory. In addition disabling file locking by editing the `soffice` script should have the same effect than Expert Configuration
Have you ever checked your NAS server for old files named `.~lock.#` and deleted all of them.

Continued

  • What is the umask (permissions) your files are being created on the NAS server (Output of ls -l would be helpful) ?
  • Have you tried to edit/save while running in LibreOffice Safe Mode? (Help -> Restart in Safe Mode)
  • Have you ever completely uninstalled LibreOffice and reinstalled? (I do ask this, since you are on Ubuntu 20.04 and there are many, many reports about very strange behavior of initial installs of LibreOffice on Ubuntu 20.04 based system where man of them could be fixed by:

Full De-installation

  • dpkg --list | awk '/ii/&&/libreoffice/{print $2}' | sudo xargs apt --yes purge
  • sudo apt --yes autoremove
  • sudo rm -r /usr/lib/libreoffice/* (may cause an error if already empty)

Fresh Installation

  • sudo apt update --yes
  • sudo apt install libreoffice libreoffice-gtk3 libreoffice-help-en-us --yes

@anon73440385 thanks for your reply.

Suffice it to say that I don’t believe that LibreOffice file locking is the problem; however editing /usr/bin/soffice as described does does ‘fix’ the issue… I can’t explain why. I expected that disabling file locking by editing the soffice script would have the same effect as changing Expert Configuration… but alas this does not appear to be the case.

I have updated the problem description in response to your other points (thank you)

Solved. The issue was that I had LibreOffice installed from the LibreOffice repositories (v7.0.3.1) when I uninstalled this version and disabled the LibreOffice repository THEN installed the LibreOffice Snap from the Ubuntu Software Centre this fixed the problem right away.

I wonder why this worked.