[GNC] Where does gnucash put the lock file on Linux?

Derek Atkins derek at ihtfp.com
Wed Jan 20 09:04:52 EST 2021


Hi,

On Wed, January 20, 2021 8:33 am, Chris Green wrote:
> On Wed, Jan 20, 2021 at 08:23:23AM -0500, Derek Atkins wrote:
>> Hi,
>>
>> The lock file is created in the same directory as the data file.
>> Is that directory not writeable?  That would cause the error.
>
> The directory is definitely writeable and there definitely isn't any
> sort of lock file in the directory:-
>
>     chris$ cd tmp/pcc/2020
>     /home/chris/tmp/pcc/2020
>     chris$ ls
>     building.gnucash  building.gnucash.20210120121447.log  general.gnucash
>     chris$ ls -al
>     total 504
>     drwxrwxr-x 2 chris chris   4096 Jan 20 12:14 .
>     drwxrwxr-x 3 chris chris   4096 Jan 20 12:13 ..
>     -rw-r--r-- 1 chris chris 212992 Jan 20 12:14 building.gnucash
>     -rw-rw-r-- 1 chris chris    381 Jan 20 12:14
> building.gnucash.20210120121447.log
>     -rw-r--r-- 1 chris chris 290816 Jan 20 12:14 general.gnucash
>     chris$ gnucash general.gnucash
>     Found Finance::Quote version 1.49.
>     chris$
>
> The above sequence pops up the can't create lock file error.

The "cannot obtain lock" error has multiple causes.  Have you checked the
Tracefile to see if there is anything printed that might suggest which
error is happening?

The error occurs when:
1) There is a lock file already there, or
2) There is NOT a lock file already present, but gnucash cannot create a
new lock file

If you're in case #2, then you won't see a lock file listed.

Is your disk full?  What do you get from:
  df /home/chris/tmp/pcc/2020
  df -i /home/chris/tmp/pcc/2020/

Also, what kind of filesystem underlies /home/chris/tmp/pcc/2020 ?

>> If GnuCash cannot create (and lock) the lock file then it will throw the
>> error.
>> If you are SURE that there is not another process running, you can "Open
>> Anyways" and that will clear the error.
>>
> Yes, I realise that, but it's not "right". :-)

It depends on the underlying error.  If the lock file is actually there
but, say, gnucash crashed, then "Open Anyways" *is* the right solution.
Obviously that's not the case here.

>> NB that gnucash may mix the metadata for two versions of the same-named
>> file located in different directories.  The GCM file does not contain
>> the
>> file location information.
>>
> I'm not quite sure I follow that, I do have general.gnucash in two
> different places.  Are you saying that this may cause problems and
> that I should rename my 'previous year' accounts to (for example)
> general2020.gnucash as well as moving them to a suitably named
> sub-directory?

If you open a file foo.gnucash, gnucash creatres a metadata file
foo.gnucash.gcm in $HOME/.local/share/gnucash/books.  Now, if you copy
foo.gnucash from DIR1/foo.gnucash to DIR2/foo.gnucash, when you open
DIR2/foo.gnucash it will use the same foo.gnucash.gcm file, because DIR1
vs DIR2 is not encoded anywhere.

So yes, IF you decide to archive data files, you should change the name.

NB: there is no need to start over every year; GnuCash hapily accounts for
multiple years of data and reports know how to handle that.

> Please remember to CC this list on all your replies.
> You can do this by using Reply-To-List or Reply-All.

-derek

-- 
       Derek Atkins                 617-623-3745
       derek at ihtfp.com             www.ihtfp.com
       Computer and Internet Security Consultant



More information about the gnucash-user mailing list