error: pkg-static: sqlite: database is locked

Matthew Seaman matthew at FreeBSD.org
Mon May 19 19:13:05 UTC 2014


On 19/05/2014 18:33, Xavier wrote:

> When I try to install/compile/register any port, always I get
> 'pkg-static: sqlite: database is locked'.
> 
> I try 'pkg unlock -a' but it don't solved it.
> 
> How I solved this problem of ports ?

sqlite is not a multi-user database -- it doesn't do MVCC for instance.
 Meaning that a 2nd process trying to use the database, even read-only,
while the first process is updating it has no way of guaranteeing any
sort of consistent results.

Hence pkg has quite strict locking requirements.  In general, you cannot
run more than one instance of pkg at one time.  This is the most common
cause of 'database is locked' messages.  Locking has been heavily
reworked for the upcoming pkg-1.3, so there should be fewer such
incidents in future.

It's also tricky to manage locking if /var/db/pkg is on an NFS mounted
partition.  Recent versions of pkg are more NFS resistant, but in my
opinion, not using NFS is the route to happiness.

'pkg unlock' and 'pkg lock' have nothing to do with this problem.
They're all about marking some of your installed packages as not to be
modified, rather than controlling concurrent access to the package
database in its entirety.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1036 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20140519/9ec2028f/attachment.sig>


More information about the freebsd-questions mailing list