Error Message: Document Could Not Be Locked

Whenever I try to open a LibreOffice document of any type for editing in any folder on on my computer, I get this error message:

libreerror

I have looked at other posts on this forum (and other areas online) regarding this error message and tried the following, but to no avail:

  1. Turning off controlled folder access - I’m not using Windows Defender, so this does not apply to me. Just to be sure that this wasn’t the root cause of my issue, I also opened gpedit.msc and looked under Computer Configuration → Administrative Templates → Windows Components → Microsoft Defender Antivirus → Microsoft Defender Exploit Guard → Controlled Folder Access and verified that “Protected Folders” were not configured.

  2. Toggling on “Run this program as an administrator” for the LibreOffice executables in the C:\Program Files\LibreOfiice\program directory (in this case soffice.exe and swriter.exe) for both my user account did not work. Toggling this on for all users also did not resolve the issue. Granting these applications administrative access caused the UAC window to pop up when either launching LibreOffice or trying to open a document directly from a folder, but the “Document Could Not Be Locked” error message still persisted.

  3. I have several systems with LibreOffice installed on them. I checked the security permissions for the affected folders on the malfunctioning machine against a computer where LibreOffice is working properly and the permissions are identical (Full Control for System, Administrators, and my User Account), so I don’t think folder security permissions are the issue here (though I suppose I could be wrong). None of the files or folders affected by this error message are being synced to the cloud via DropBox or the like.

  4. I tried uninstalling and reinstalled LibreOffice, but with no success. I also tried downgrading and upgrading the version number of the software, but that didn’t fix anything either.

Going to Tools -> Options -> LibreOffice -> Advanced -> Button: Open Expert Configuration -> Search: UseLocking and set org.openoffice.Office.Common\Misc\UseLocking to false seems to resolve the issue. Once this change is made, LibreOffice is able to modify and save documents in the affected directories despite the fact that it could not create a lock file. While this workaround is a fine temporary fix, I would prefer to fix the root cause of this issue then subvert the file locking process altogether.

Interestingly enough, I installed Apache OpenOffice 4.1.14 and it is able to create lock files in the affected directories without any issues.

Does anyone here know how I might be able to properly resolve this issue? If not, should I file a ticket with the LibreOffice team to investigate this issue?

Thanks in advance for your assistance!

If you use another antivirus, you may want to check that antivirus settings for a similar feature.

But note that “not configured” in policies doesn’t mean “disabled” - it means “there’s no explicit setting applied by user or administrator, so the software will use its default setting”, which would mean “enabled” for the discussed feature in case of Defender, if it runs at all.

I don’t know why this suggestion appeared; it should not be necessary, nor is a good thing (running apps with admin permissions is always a security risk). However, if wanted, the actual LibreOffice executable is neither - it’s C:\Program Files\LibreOffice\program\soffice.bin. The EXEs are just launchers for the latter.

Note that, while you have provided a full version for AOO that you tried, you never mentioned full info from LibreOffice’s HelpAbout :wink:

If you use another antivirus, you may want to check that antivirus settings for a similar feature.
But note that “not configured” in policies doesn’t mean “disabled” - it means “there’s no explicit setting applied by user or administrator, so the software will use its default setting”, which would mean “enabled” for the discussed feature in case of Defender, if it runs at all.

I toggled these items to “Disabled” in the Local Group Policy Editor just to be safe, but that didn’t resolve the issue. I also verified that the AV that I am using (ESET NOD32) doesn’t have a Controlled Folder feature - it relies on HIPS instead. The fact that Apache OpenOffice can create lock files in directories that LibreOffice cannot also seems to indicate that the issue is not related to folder controls or permissions.

I don’t know why this suggestion appeared; it should not be necessary, nor is a good thing (running apps with admin permissions is always a security risk). However, if wanted, the actual LibreOffice executable is neither - it’s C:\Program Files\LibreOffice\program\soffice.bin. The EXEs are just launchers for the latter.

It was a possible solution that I found here - I see that you also commented there about the dangers of elevated privileges! Unfortunately, there’s no Compatibility Tab for soffice.bin in Windows - you can only set “Run as Administrator” on the executables that serve as launchers for it (which didn’t end up working anyway).

Note that, while you have provided a full version for AOO that you tried, you never mentioned full info from LibreOffice’s HelpAbout :wink:

Version: 7.4.7.2 (x64) / LibreOffice Community
Build ID: 723314e595e8007d3cf785c16538505a1c878ca5
CPU threads: 16; OS: Windows 10.0 Build 19045; UI render: Skia/Raster; VCL: win
Locale: en-US (en_US); UI: en-US
Calc: CL

Only answering this specific idea (you indicated that your antivirus seems to not have a comparable feature, so my note is just a nitpick): no, this doesn’t indicate that. Antiviruses (e.g., Defender) use their own lists of “good” applications when deciding which app is OK to write to guarded folders - so they can have a signature for a specific version of AOO (and also, for some versions of LO), but not for this new version of LO yet :wink:

With regards to permissions - you are of course right.

Anyway: it really looks similar to all the cases when antiviruses blocked access; so despite there’s no “controlled folder access” - could you please simply disable the antivirus completely (indeed, only temporarily, for the test; you might want to disconnect from the net for the duration of the test), and check if that works? Then you could try to see what was the issue; maybe adding soffice.bin to the antivirus exclusion list would then be an option, etc.

By the way, the antivirus could deny based simply on the name of the file; the lockfile names start with a dot, which may be considered bad by ESET32?

Anyway: it really looks similar to all the cases when antiviruses blocked access; so despite there’s no “controlled folder access” - could you please simply disable the antivirus completely (indeed, only temporarily, for the test; you might want to disconnect from the net for the duration of the test), and check if that works? Then you could try to see what was the issue; maybe adding soffice.bin to the antivirus exclusion list would then be an option, etc.

After conducting further testing, it turns out that the root cause of this issue is aggressive behavior from MalwareBytes Anti-Malware’s Exploit Protection feature. I attempted to remedy the issue by modifying the Exploit Protection feature’s Advanced Settings, but I ultimately had to turn off Managed Protection for LibreOffice altogether in order to get it to function properly.

The reason that Apache OpenOffice was able to create lock files while LibreOffice was unable to do so was because OpenOffice isn’t a default option under the Protected Applications list in MBAM, so it wasn’t being actively tampered with. I also discovered over the course of my troubleshooting that you can’t add Apache OpenOffice as a custom Protected Application in MBAM because it shares the same filename as LibreOffice (soffice.bin). MBAM’s Exploit Protection apparently can’t handle multiple files with the same name, even if they are in different directories!

On an unrelated note, I also found out that Malwarebytes Anti-Malware also tampers with LibreOffice’s ability to properly scale its UX elements when displayed on a 2K monitor. It also prevents Icon Themes from loading properly, resulting in missing icons from the main LibreOffice Menu and the toolbars inside of its sub-components (Writer, Calc, etc.)

Thank you very much for your assistance with this matter! I will create a support ticket with MalwareBytes this afternoon to address these issues with their software.

2 Likes

And thanks for sharing the solution for your problem, so it can be found by other users.

And thanks for sharing the solution for your problem, so it can be found by other users.

You are very welcome! I have submitted Malwarebytes Support Ticket 4311742 regarding these issues. I will update this thread as more information becomes available.

1 Like