[Solved] Locked for Editing

Discuss the word processor
Post Reply
brdwtchr
Posts: 9
Joined: Thu Jan 21, 2021 4:21 pm

[Solved] Locked for Editing

Post by brdwtchr »

All of a sudden, many if not all my files are "locked for Editing". As far as I know, I did nothing....I am a very inexperienced computer user and I cant seem to figure out how to fix this. I have uninstalled OO and nothing changed. I need a really "simple" answer "well explained" if possible. I may have to go to another application or purchase the MS Office suite....yikes....
Last edited by Hagar Delest on Fri Jan 22, 2021 6:28 pm, edited 1 time in total.
Reason: tagged solved.
OpenOffice 4.1.8 on windows 10
FJCC
Moderator
Posts: 9284
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Locked for Editing

Post by FJCC »

OpenOffice is not closing files correctly for some reason. When OpenOffice opens a file, it writes a tiny temporary file that records which file is being edited. This temporary file should be removed when the original file is closed. If it is not removed, then the next time you try to open the original file, OpenOffice will think it is being edited by someone and display the "file locked for editing" message.

The first thing to do is to delete all of the temporary files. They have names that start with .~lock. and they are normally hidden from view. You should open the folder that contains the file you are trying to edit, set it to display hidden files and then delete all of the files whose name starts with .~lock. To show the hidden files, click on the View tab of the window displaying the folder contents and click on the box labeled Hidden Items. I have highlighted that box in red in the image below.
HiddenItems.PNG
You can also see at the bottom of the image a file named .~lock.dummy.xlsx#. I have a file named dummy.xlsx open and that is its temporary file.

After cleaning up the lock files, you should be able to edit your files. You should then consider why these temporary files are not being deleted. One possibility is that you are closing the file and then very quickly shutting down the computer. If so, give OpenOffice a few seconds to do its internal clean up. another possibility is that OpenOffice is crashing a lot. Have you had that problem?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
brdwtchr
Posts: 9
Joined: Thu Jan 21, 2021 4:21 pm

Re: Locked for Editing

Post by brdwtchr »

I opened my 'documents' folder, the 'hidden items' box is checked. There are no files like what you mention.
OpenOffice 4.1.8 on windows 10
FJCC
Moderator
Posts: 9284
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Locked for Editing

Post by FJCC »

Try to make a new document and save it in the same folder as your other documents. While it is open, do you see the .~lock file? If you close it, does the .~lock file disappear?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
brdwtchr
Posts: 9
Joined: Thu Jan 21, 2021 4:21 pm

Re: Locked for Editing

Post by brdwtchr »

Yes, i see a file like that.....Would post screen shot if I could figure that out.......I closed the file and when I open the documents folder, the 'locked' file shows up
OpenOffice 4.1.8 on windows 10
brdwtchr
Posts: 9
Joined: Thu Jan 21, 2021 4:21 pm

Re: Locked for Editing

Post by brdwtchr »

Ooops, when I closed the file, the 'locked' file does not show up in the list....when I try to open the file, I get the locked message....grrrrrr
OpenOffice 4.1.8 on windows 10
User avatar
RoryOF
Moderator
Posts: 34619
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Locked for Editing

Post by RoryOF »

Are you working to the local hard drive, or to a USB or networked drive, or to the cloud?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
brdwtchr
Posts: 9
Joined: Thu Jan 21, 2021 4:21 pm

Re: Locked for Editing

Post by brdwtchr »

Local hard drive
OpenOffice 4.1.8 on windows 10
User avatar
RoryOF
Moderator
Posts: 34619
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Locked for Editing

Post by RoryOF »

Try deleting or renaming your OpenOffice User Profile. Details of how to do this are set out on
Resetting the user profile

If you have custom dictionaries or extensions installed, renaming is best -user.old is a good choice. Otherwise, just delete it.

On next start of OpenOffice you will be prompted for name and initials. If you are not, you got the renaming or deletion process wrong.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
RoryOF
Moderator
Posts: 34619
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Locked for Editing

Post by RoryOF »

Just to confirm: when you deleted or renamed your OpenOffice user profile, you were prompted for your name and initials on next start of OpenOffice?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Bill
Volunteer
Posts: 8934
Joined: Sat Nov 24, 2007 6:48 am

Re: Locked for Editing

Post by Bill »

FJCC wrote:When OpenOffice opens a file, it writes a tiny temporary file that records which file is being edited. This temporary file should be removed when the original file is closed. If it is not removed, then the next time you try to open the original file, OpenOffice will think it is being edited by someone and display the "file locked for editing" message.
In my experience, the message does not appear if the same user tries to open the original file. It does appear when a different user tries to open the file. The message that appears is titled "Document in Use" The full message is:

Code: Select all

"Document file '<file name> is locked for editing by:
<account username> (<date & time)
Open document read-only or open a copy of the document for editing."
If "unknown user" appears in the message instead of the account username, then the problem is probably not related to lock files, but may be caused by the antivirus or ransomware protection settings in the operating system. In that case, the antivirus and ransomeware settings must be changed.
AOO 4.1.14 on Ubuntu MATE 22.04
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Locked for Editing

Post by John_Ha »

FJCC wrote:When OpenOffice opens a file [fred.odt], it writes a tiny temporary file [.~lock.fred.odt#]that records which file is being edited. This temporary file should be removed when the original file is closed. If it is not removed, then the next time you try to open the original file, OpenOffice will think it is being edited by someone and display the "file locked for editing" message.
I thought that too as many of my forum replies will attest :crazy:

I did a test. I opened fred.odt and moved .~lock.fred.odt# out of the folder. I closed fred.odt and put .~lock.fred.odt# back into the folder. I then opened fred.odt.

I was expecting that the presence of .~lock.fred.odt# would cause AOO 4.1.8 to complain that fred.odt was open for editing and AOO would ask if I wanted to edit a copy. I was surprised that AOO said nothing, allowed me to edit fred.odt, and then allowed me to save it!

So how does AOO check if a file is open and being edited by another user? It must be Bill's suggestion that it only works if another user on the PC tries to open it.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
RoryOF
Moderator
Posts: 34619
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Locked for Editing

Post by RoryOF »

You have to log on as a different User, John. I suggest you edit the lock file (plain text editor will do), and change your name and logon name to something else. Save the lock file. Then Open the main file as you; and it will pick up tat the lock file exists and inform you that the main files is locked for editing by whoever you changed the name/user to, suggesting it be opened read-only or as a copy.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Locked for Editing

Post by John_Ha »

Rory

I have just done the test and I can confirm that. I logged John out of Windows and logged back in as my Test user. I then got the locked for editing message.

.~lock.fred.odt# contains

Code: Select all

John ,Lounge-PC/John,LOUNGE-PC,21.01.2021 20:01,file:///C:/Users/John/AppData/Roaming/OpenOffice/4;
where both occurrences of John must be my Windows name John, and not my AOO name.

I have been wrong all these years - you could blow me down with a feather :oops:
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
RoryOF
Moderator
Posts: 34619
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Locked for Editing

Post by RoryOF »

John_Ha wrote:Rory

I have been wrong all these years - you could blow me down with a feather :oops:
Even Homer nods!
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Bill
Volunteer
Posts: 8934
Joined: Sat Nov 24, 2007 6:48 am

Re: Locked for Editing

Post by Bill »

John_Ha wrote:I did a test. I opened fred.odt and moved .~lock.fred.odt# out of the folder. I closed fred.odt and put .~lock.fred.odt# back into the folder. I then opened fred.odt.

I was expecting that the presence of .~lock.fred.odt# would cause AOO 4.1.8 to complain that fred.odt was open for editing and AOO would ask if I wanted to edit a copy. I was surprised that AOO said nothing, allowed me to edit fred.odt, and then allowed me to save it!

So how does AOO check if a file is open and being edited by another user? It must be Bill's suggestion that it only works if another user on the PC tries to open it.
Do the same test again, but after pasting the lock file back in the folder, open the lock file with a text editor and change the account username in the lock file and save it, then try to open the original file. You should then get the message saying that the file locked for editing by the user whose account username you entered in the lock file. As a third test, leave the account username blank in the lock file before opening the original file. You should then get the message saying that the file is locked for editing by "unknown user". However, I don't know how an account could have no username. That's why I think "unknown user" in the message indicates an external problem, not a lock file problem.
AOO 4.1.14 on Ubuntu MATE 22.04
John_Ha
Volunteer
Posts: 9584
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Locked for Editing

Post by John_Ha »

Bill wrote:Do the same test again ...
Bill

That's exactly what happened. I edited it and changed both John above to, quelle surprise, Fred. On opening it I got the message below saying Fred was editing it.
Clipboard01.png
When I changed only the first John to four spaces, it opened OK.

But when I changed both occurrences of John to four spaces I got the message below:
Clipboard02.png
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Bill
Volunteer
Posts: 8934
Joined: Sat Nov 24, 2007 6:48 am

Re: Locked for Editing

Post by Bill »

John_Ha wrote:.~lock.fred.odt# contains

Code: Select all

John ,Lounge-PC/John,LOUNGE-PC,21.01.2021 20:01,file:///C:/Users/John/AppData/Roaming/OpenOffice/4;
where both occurrences of John must be my Windows name John, and not my AOO name.
The first "John" should be the full name that is entered in the AOO/LO user data. That can be checked by opening files after changing the full name to something unique. "John" that appears after the first comma should be the account name in the operating system. That can be checked by opening files in different user accounts. I don't know about "Lounge-PC/" that precedes the second "John". Nothing like that appears on my system. "LOUNGE-PC" that appears after the second comma should be the computer name in the operating system. That should be self-evident if the computer name is unique.
AOO 4.1.14 on Ubuntu MATE 22.04
brdwtchr
Posts: 9
Joined: Thu Jan 21, 2021 4:21 pm

Re: Locked for Editing

Post by brdwtchr »

Thanks to everyone who tried to help me. I could not get AOO to work like it used to, so I have moved on to another package. Thanks Again....So Long....
OpenOffice 4.1.8 on windows 10
Bill
Volunteer
Posts: 8934
Joined: Sat Nov 24, 2007 6:48 am

Re: [Solved] Locked for Editing

Post by Bill »

Earlier you said that the lock files disappear when the original file is closed, so the problem is not getting AOO to work, it is getting your antivirus and ransomware setup properly.
AOO 4.1.14 on Ubuntu MATE 22.04
eng215
Posts: 5
Joined: Wed Mar 10, 2021 9:20 pm

Re: [Solved] Locked for Editing

Post by eng215 »

This happens to me every time I get a new PC. It's pretty easy to just go to the parent folder and search for ~lock. Once the search is completed just highlight all of the files and permanently delete them.
OpenOffice 4.1.7 on Windows 7 Premium
User avatar
RoryOF
Moderator
Posts: 34619
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: [Solved] Locked for Editing

Post by RoryOF »

eng215 wrote: Mon Feb 26, 2024 2:20 pm This happens to me every time I get a new PC. It's pretty easy to just go to the parent folder and search for ~lock. Once the search is completed just highlight all of the files and permanently delete them.
One must be certain to delete _only_ the lock files, which have a unique character and are small, typically several hundred bytes, rather than the main files, which, if they are ODF format (OO's native formats) are about 6 KB or larger.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
Post Reply