gnclock table remains after quitting gnucash and shutdown; Only clears manually with sqlite3

John Ralls jralls at ceridwen.us
Wed Aug 19 05:21:35 EDT 2015


> On Aug 19, 2015, at 5:00 AM, GWB <gwb at 2realms.com> wrote:
> 
> I have been using the sqlite3 backend for GnuCash for well over a year
> now and as of last week GnuCash has been reporting the "file locked"
> error on opening.  I was able to clear the lock by using sqldiff to
> compare a locked and unlocked file.  To unlock the file from the
> command line:
> 
> % sqlite3 database-name.gnucash
> sqlite> DELETE FROM gnclock WHERE rowid=1;
> sqlite> .exit
> 
> Then the file opens without the lock error, but after closing GnuCash,
> shutting down, and opening the file again, it locks and I have to
> repeat the process.
> 
> The only documentation I can find is here:
> 
> http://wiki.gnucash.org/wiki/SQL
> 
> So I assume that sqlite3, postgresql and MySQL follow the same
> procedure, which is to create the gnclock table to prevent concurrent
> access.
> 
> Any ideas how to solve this without resorting to the sqlite3 command
> line?  Here are the specs for my machine:
> 
> % uname -a
> ... 3.19.0-25-generic #26~14.04.1-Ubuntu SMP Fri Jul 24 21:16:20 UTC
> 2015 x86_64 x86_64 x86_64 GNU/Linux
> 
> % gnucash --version
> GnuCash 2.6.1
> This copy was built from rev 76cba80+ on 2014-02-19.
> 
> The file system for the binary is btrfs, and ext4 for the home
> directory and data:
> 
> % mount
> ...
> /dev/sdc3 on / type btrfs (rw,ssd,subvol=@)
> ...
> /dev/sdb3 on /home2 type ext4 (rw)
> 
> The database back end is:
> 
> libdbd-sqlite3 version 0.9.0-2ubuntu2
> 
> Would the other libdbd back ends work (i.e., libdbd-mysql,
> libdbd-pgsql)?  Do users with these other back end dbd's see this
> error?
> 
> I can check and see if the file systems have acl's and xattr's
> enabled, but I don't see how that would affect the database file
> itself.

No need to unlock by hand. As long as you’re certain that there isn’t another instance of GnuCash connected to the database just select the “open anyway” button on the file locked dialog box.

However, if GnuCash isn’t clearing the lock by itself that means that it’s crashing instead of shutting down. Try running it under gdb to catch the crash and get a stack trace. More detailed instructions at http://wiki.gnucash.org/wiki/Stack_Trace.

Regards,
John Ralls




More information about the gnucash-user mailing list