GnuCash could not obtain the lock file...

Mike or Penny Novack stepbystepfarm at mtdata.com
Thu Feb 12 08:21:40 EST 2015


> Yep, that's what I did and it looks like it works OK.  Thanks for the info
> on the lock file.
>
> Kind regards,
>
> Greg Feneis
But for your original question "what is it?" maybe worth an answer 
because the mechanism is a very common one (not just gnucash) and 
sometimes either the "override" option doesn't work or the application 
doesn't give you one.

Under almost all operating systems, a program can test for the existence 
of a file even if it doesn't have permissions to open that file and the 
testing won't disturb another program that might be using the file at 
the time. So a simple method of making sure that only one application 
can be using a file is (after testing that no lock present) is for an 
application to create a (temporary) file with the same name but 
extension .lck. This file isn't USED, just has its existence tested for. 
When the application that is using the file closes it, it deletes that 
lock file, so now another application can use the file. If an 
application tries to use the file in the meantime, it sees that lock 
file and  reports, "can't get the file, it is locked."

But if there is a crash or other abnormal termination, the lock file 
didn't get deleted, so any application trying to use that file reports 
"locked".

If you get that message, up to you to decide what the situation is. Up 
to you to make sure that there ISN'T something running that is using the 
file (a legitimate "in use"). But if you decide OK, then you override 
(if that is an option) or if no override provided or if it doesn't work, 
you go into the directory (file folder) where the file you want lives, 
find the lock file, and manually delete it.

Michael D Novack


More information about the gnucash-user mailing list