Files locked, missing permissions

Files locked & not able to be saved
These problems apply to all LibreOffice files on my laptop. I have a HP Spectre x360 laptop, with Microsoft Windows 10 Home version 10.0.119041, and LibreOffice version 6.4.5.2.
(1) When I open an existing LO file, I get a message, “The lock file could not be created by LibreOffice, due to missing permission to create a lock file on that file location or lack of disk space.” {Note: lack of disk space is not a problem for me.} It gives an option, ‘Open Read-Only’.
(2) On opening the file in read-only mode, it gives an option ‘Edit Document’. On clicking this, it gives a message “This document cannot be edited due to missing access rights. Do you want to edit a copy of the document?” It gives an option, ‘Open Copy’. On opening the Copy, it can be edited, but not saved: on trying to save, Windows gives a default filename of Untitled 1.odt — saving it with this name, and also with the original filename, or another filename, yields a message: “[filename] File not found. Check the filename and try again”.
(3) These attempts have been made on existing files whose default properties are not read-only.
(4) In Windows File Explorer, the default Attribute of all Folders in My Documents is ‘Read Only (Only applies to files in folder)’. {My File Explorer Folders contained files in different formats (LO, PDF, jpg, etc.).} If I try to remove this default attribute for all files in a Folder, by unticking the square, there is no consequence, i.e. when I go back to check the Attributes of the Folders all are Read-only. Still, again.
(5) Nevertheless, clicking on an individual file’s properties in File Explorer does not show it has having an attribute of Read-only (unless I had ticked that box when creating the file).
(6) I have found suggestions on the Web that say I would solve the problem by deleting a file with name .~lock.filename.odt# that is generated when I open an existing LO file. However, that action does not work. Not work. After deleting a lock file I go to the relevant applicable document, make some changes to it, and try to save it, only to get a message: “Error saving the document. Write error. The file could not be written.” ‘Okay’
(7) I am unable to create new LO files, because when I go to save a new file, with its own filename, LO tells me that a file with that filename cannot be found.
(8) I have deleted and reinstalled LO twice to see if it would self-heal. I have installed Apache OpenOffice and it gives me the same error messages (as above) as LO.
(9) Is there a solution for these problems within LO? Or — horror of horrors — will I have to instal Microsoft Office to do spreadsheeting and wordprocessing?

Note. In Windows Setttings/Windows Security, I have — currently and temporarily — turned off ‘Reputation-based protection’ on the basis that it protects my computer “from malicious or potentially unwanted apps, files, and websites” and might therefore be a culprit preventing LO from working. In turning off that feature, Windows warns me that device “may be vulnerbale” (to malicious or potentially unwaanred apps, files, and websites".

If your My Documents folder is read only then Libreoffice won’t be able to create a lock file, the same would be the case for MS Office.
The solution is to remove the read only attribute for My Documents folder. Backing up to an external drive or cloud is likely to provide more reliable security for your documents.

Thanks Earnest Al. The read-only attributes for the Documents folder seems to be a Windows default, I had not set it for so. Anyway I changed it (turned off that attribute), but no solution was delivered to my problem. I now see from this website that there is a long history of posts on these matters, and I had already tried some of the suggested solutions. I am now going to uninstall LO version 6.4.5.2 and install version 6.3.6, an older version, as someone has suggested. If that does not work, I will shift over to Microsoft Office. Best.

f that does not work, I will shift over to Microsoft Office

And MS might celebrate one more success with its upgrade procedures to silently change/mess permissions. Shift …

Do you have Windows Defender as your anti virus? See Defender Controlled folder access exception for LibreOffice - The Document Foundation Wiki

I found a Windows PC with Windows Defender as the only anti-virus. By changing the settings I can certainly see how you could create the situation that you have. Happily,the 2 microsoft windows pages linked in the article referenced above tell you how to allow programs to run.

Dear Earnest All & all, Thanks for the many tips, your generosity is quite overwhelming. This is where I am at now. I uninstalled LO version 6.4.5.2, and installed an older version, namely 6.3.6.2. I no longer have the problems I reported: I can amend and save old LO files, and I can create and save new LO files. Which is where I was 2 days ago. I was only half joking about shifting to MS Office; I have been with OO/LO since the early 2000s, and I particularly like & use the feature of recording macros, because I use characters with diacritics a bit for languages that use diacritics in their latin-based writing systems, and use the Toolbar feature so I can access them quickly. So, I am sort-off rusted onto LO. Having got back to where I was, I now have lots of suggestions/responses from AskLibO participants to consider. I intend to work through them over the next few days, and will respond. Again, thanks. CF Johnston (Ballina, Australia) 6/7/20

Hi @schiltron

My reply may be too late for you, but may just help others.

There are two features at play here:

  1. LO locking/unlocking files
  2. System locking/unlocking files

Let’s look at the second first, since it will be system-wide (at least for that folder).

System locking/unlocking files

All modern OS employ various levels of file protection. That is actually based on your username, and of course is the reason that you have to log into your system in the first place. I currently work under Devuan (versions at bottom) but have provided professional network support for Windows and, I have to say, that the levels of user recognition are absolutely bizarrely large under Windows IMO. I will talk in terms of Linux/Unix permissions from now on, and only at the simplest level.

Have a look at linux.com if you want to get into the depths of File Permissions. These are seen from the Terminal with a long-listing file-list and have 3 independent possibilities:

  • r Read Permission
  • w Write Permission
  • x Execute Permission

These permissions apply to both the Directory (‘.’ as a container) and to the files themselves (as the content). In general, you need to have both Read & Write permission (referred to as ‘rw’) for both the Directory & the contents of that directory in order to be able to both create a LO file and/or update it.

A piece of advice:
Do NOT assume that you have rw permission for your user.
If you are suffering problems, then use a Terminal / Command-prompt to change to that directory (cd name-of-dir); then try to create a simple text file (touch file.txt); then examine it (ls -al); then delete it (rm file.txt). If you are able to create & delete a file without errors, then you can strike that particular problem off your checklist.

In that case, let’s now look at LO-specific locking/unlocking files:

LO-specific locking/unlocking files

There are two specifics for LO where file permissions are concerned:

  1. LibreOffice Lock Files
  2. rw file permissions

The last one is actually the easiest, since we have dealt with it in the previous section. If your user does not have permission to create & save files within your working directory then you will NOT be able to do anything. Do NOT assume; check it out (including the DOT-file, which is the dir-file).

LO places a lockfile into the same directory as your working file. It also (and this one is the source of many problems) places a lockfile into the LO profile directory. Either can be a source of the errors in the OP.

The name of the Writer lock-file placed within the file source-directory is:

.~lock.<name-of-file>.odt#

The name of the lock-file placed within the profile is:

<profile-dir>/.lock

These files are hidden files (first char is a dot). Both files are created on opening a file & removed when the file is closed. Note that the Profile dir will need the Execute permission in addition to rw, so it will be ‘rwx’ on the dot-file. Once again, bad-permission errors can come from this dir in addition to the source-file dir.

The lockfile is used to prevent other users from making changes to a file whilst it is being edited. Naturally, if there is a system-crash whilst editing is in progress the lockfile will be left in situ, and on next attempt to edit will then complain & stop access.

Final Thoughts

The OP states:

“In Windows File Explorer, the default Attribute of all Folders in My Documents is ‘Read Only (Only applies to files in folder)’”

That is his problem. It is almost certainly a directory setting rather than a file setting (the dot-file would read just ‘r’). Nothing to do with LO, and he needs to fix that first.

(tested using LO Version: 5.2.7.2 under Devuan Linux 2.1 (ascii))

If this helps then please tick the answer (:heavy_check_mark:)

…and/or show you like it with an uptick ()

Dear Alex & all, Thanks for the many tips, your generosity is quite overwhelming. This is where I am at now. I uninstalled LO version 6.4.5.2, and installed an older version, namely 6.3.6.2. I no longer have the problems I reported: I can amend and save old LO files, and I can create and save new LO files. Which is where I was 2 days ago. I was only half joking about shifting to MS Office; I have been with OO/LO since the early 2000s, and I particularly like & use the feature of recording macros, because I use characters with diacritics a bit for languages that use diacritics in their latin-based writing systems, and use the Toolbar feature so I can access them quickly. So, I am sort-off rusted onto LO. Having got back to where I was, I now have lots of suggestions/responses from AskLibO participants to consider. I intend to work through them over the next few days, and will respond. Again, thanks. CF Johnston (Ballina, Australia) 6/7/20

Thanks for reporting back, @schiltron, most helpful. I also have seen the very many - some identical - reports of your problem. Hopefully, you have paved the path for others.

This is an update, and ‘closure’, of my experience with the matter of LO deciding not to allow saving of changed existing files or saving of new files, in Calc and Writer – something that happened on 5 July 2020, and which I reported in AskLibO on 5 July 2020 having discovered this website during my attempts to find a solution. I have a HP laptop with Windows 10 (always latest version) and I had done a security update of virus definitions on 4 July. I had done an update of LO a day or so before (date not recorded by me). And I had been cleaning up temp files. I had not changed my Windows Security settings, not changed my folder or file permissions, and the previous version of LO (version number not recorded by me) before I upgraded to version 6.4.5.2 was working fine. The key event (human intervention) that marked the transition from workability to nonworkability was my installing an upgrade of LO when notified. After some hours, I solved the problem by uninstalling LO version 6.4.5.2 and installing an older version, namely 6.3.6.2; I did this because I had found, in AskLibO, a suggestion to do this in an older post (which I now cannot find). I had tried to solve the problem by installing the latest version of Apache OpenOffice, but that app gave me the same problems, so I uninstalled it and went for the option of an older version of LO. Since at 6 July, LO has been working fine for me. And that is where I am going to leave it. I will probably avoid doing any LO upgrades in this lifetime :frowning:
Following my post on 5 July, a few people made some suggestions, and in this post I am going to address those because I appreciated the kindness in their offerings of suggestions, and I suspect the problem will occur for other LO users, as it has in the past (looking at AskLibO), and perhaps some other users’ experiences might be closer to my own and the posts by those respondents will be helpful all round.
(1) On the matter of the attributes of the Documents folder. Currently my Documents folder has an attribute of Read-only, and with LO 6.3.6.2 there is no problem with saving files. Whether the Documents folder was Read-only when LO 6.4.5.2 was working fine, before 5 July, I do not know. (It’s not something I check on an ongoing basis.) I do not have the capacity to change this attribute: or rather, I do, but the setting reverts to Read-only and is so when I go back to look (e.g. on reopening Windows File Explorer). The same applies to the subfolders I have created within that Folder (i.e. they report as Read-only, but I am able to change files in them.) So I am skeptical about whether that was my problem on July 5; in any event, I am unable to make a change to the attribute that ‘holds’ (stays, and is still there when I reopen File Explorer).
Alex Kemp’s detailed explanation on locked files was terrific, perhaps too ‘good’ for my brain, but in any event by the time I read them I had already installed LO 6.3.6.2 as a ‘brutal’ remedy and I cannot re create my problems to test alternative solutions.
(2) On the matter of permissions, in the Documents folder, for Properties\Security\Permissions, full control on all options has always been given by me to the 3 listed persons: System, User, and Administrator. (The permissions are: Full Control, Modify, Read and execute, List folder contents, Read, Write.) No one else uses my laptop. I made no change to these settings before the problem occurred. I note that these settings might have been a problem with other people with the same problem I had, but I do not think they were relevant to my problem.
(3) On the creation of locked files. I often have Windows File Explorer’s View setting set to show hidden files. I have never seen a locked file until 5 July, when I had the problems following update to LO version 6.4.5.2. I did attempt to solve my problem by deleting the files that indicated the syntax of a locked file, but the locked file appeared in the file I was working on’s sub-directory (in both Writer and Calc) immediately on attempting a save. That is, closing the associated file did not remove the locked file after its deletion.
(4) My suspicions about the cause of my problem are either that I damaged my LO Profile somehow, or that Windows Defender (Windows 10’s inbuilt antivirus app) did not like the updated LO 6.4.5.2. I had done a Windows ‘feature update’ on 13 June 2020, but Windows Update does not explain what this did (it just gives a whole lot of ‘tips’). Whether this Update caused some difference in the way Windows Defender works (that then impacted on an updated LO), I don’t know.
(5) I attempted, on July 5, to solve the problem by uninstalling LO and installing Apache OpenOffice (i.e. jettisoning LibreOffice, as unworkable). But on opening OpenOffice 4.1.7, I had the same problems with saving Calc and Writer files as I had with LO. I am wondering whether OO remembered me from years ago, since it indicated the user was an email address I no longer use, but it might just have been that Windows Defender was doing the same to OO as it had done to LO. I uninstalled OO (as unworkable). I do not know where the LO profile is is located; I looked through all of the LO program folders and subfolders (View hidden) and found no directory with a name like Profile.
(6) As already indicated, Windows Defender is my antivirus app. I followed the links suggested by Earnest Al in his comment of July 6 (at 06:04), abut settings in Windows Security and how to allow a blocked app in Windows Security. Windows Security and Windows Defender had not caused me these problems, previously. Even though I fixed my problems by installing an older version of LO, namely 6.3.6.2, I have changed some settings in Windows Defender as suggested by the Microsoft Help page ‘All a blocked app in Windows Security’. There are two relevant options for me. One. In Windows Security/Virus and threat protection settings/Controlled folder access/Managed controlled folder access/Protected folders, Windows Security is protecting the Documents folder as a ‘protected folder’ – I have not changed this. Two. In Windows Security/Virus and threat protection settings/Controlled folder access/Allow an app through controlled folder access, I have set C:\Program Files\LibreOffice\program\soffice.bin as an allowed app — the effect of this is to allow that app (soffice.bin) to make changes to protected folders. (On July 4, which was the day I had the problems, Windows Security’s protection of the Documents folder as a protected folder had blocked the LO file, soffice.bin – according to the history of blocked apps on the ‘Allow an app through controlled folder access’ page.)

Currently my Documents folder has an attribute of Read-only, and with LO 6.3.6.2 there is no problem with saving files

My assumption is that this is part of current MS system-procedures to protect the computer against fraud and/or abuse (I am not anymore up-to-speed with current Windows philosophy). If so, the system will change the folder-setting from r to rw (and then back again) on authorised changes. Such actions are classic within Linux text-editors when updating read-only files (the file is altered r to rw; update the file, then back to r).

The problem, of course, comes when a legit application is not recognised as such by the system, which means that you need root access to change it. That happened with recent MacOS computers when the system began issuing “This application will damage your computer” when folks updated LO. It seems possible that something similar is now happening on Windows computers, except silently. I suspect that this is a commercial act.

Windows has pushed out updates at least twice in the past few weeks. Windows Defender settings and changes to default programs were amongst the changes for my computers so I assume they were for everybody with Win 10. You haven’t changed anything any settings; Windows did.

workaround: LibreOffice error "...insufficient user rights" in windows 10 - #8 by eddy_lt