How to recover local.sqlite (pkg(8) problem)

2014-11-18 Thread Chris H
Greetings,
 During the building of a meta-port in the ports tree. My
/var/db/pkg/local.sqlite database became corrupted. I
spent some time, both with the pkg man pages, and with
sqlite3 itself attempting to use one of the backups
created by periodic(8). Located in /var/backups. But all
to no avail. For the record, I used
pkg backup -r /var/backup/pkg.sql.xz, as well as unpacking
a copy of that file, and issuing the same. Moving (renaming)
the corrupted database aside, prior to. I also issued
sqlite3 local.sqlite
followed by
read pkg.sql
and
quit
went w/o issue. But issuing
pkg info
emitted several error messages. Which appeared to be from
sqlite3(8).
This is on RELENG_9, w/source, and kernel world from about
1 week ago. I know that the backup is in good shape, as I
had been using it w/o issue.
Is this a bug?

Thank you for all your time, and consideration.

--Chris


___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: How to recover local.sqlite (pkg(8) problem)

2014-11-18 Thread Baptiste Daroussin
On Tue, Nov 18, 2014 at 04:18:33PM -0800, Chris H wrote:
 Greetings,
  During the building of a meta-port in the ports tree. My
 /var/db/pkg/local.sqlite database became corrupted. I
 spent some time, both with the pkg man pages, and with
 sqlite3 itself attempting to use one of the backups
 created by periodic(8). Located in /var/backups. But all
 to no avail. For the record, I used
 pkg backup -r /var/backup/pkg.sql.xz, as well as unpacking
 a copy of that file, and issuing the same. Moving (renaming)
 the corrupted database aside, prior to. I also issued
 sqlite3 local.sqlite
 followed by
 read pkg.sql
 and
 quit
 went w/o issue. But issuing
 pkg info
 emitted several error messages. Which appeared to be from
 sqlite3(8).
 This is on RELENG_9, w/source, and kernel world from about
 1 week ago. I know that the backup is in good shape, as I
 had been using it w/o issue.
 Is this a bug?
 
 Thank you for all your time, and consideration.
 
This is really surprising and first time this can of things get reported, can
you provide me the the pkg.sql.xz file?

Are you runing on nfs? if yes start the lockd first (pkg should fallback on a
working solution (I need to check for pkg backup) but sqlite3 cli tool does not
and sqlite3 cli tool on nfs without proper locking is known to corrupt database
file.

Best regards,
Bapt


pgppVwIVRXXd4.pgp
Description: PGP signature


Re: How to recover local.sqlite (pkg(8) problem)

2014-11-18 Thread Baptiste Daroussin
On Wed, Nov 19, 2014 at 01:21:27AM +0100, Baptiste Daroussin wrote:
 On Tue, Nov 18, 2014 at 04:18:33PM -0800, Chris H wrote:
  Greetings,
   During the building of a meta-port in the ports tree. My
  /var/db/pkg/local.sqlite database became corrupted. I
  spent some time, both with the pkg man pages, and with
  sqlite3 itself attempting to use one of the backups
  created by periodic(8). Located in /var/backups. But all
  to no avail. For the record, I used
  pkg backup -r /var/backup/pkg.sql.xz, as well as unpacking
  a copy of that file, and issuing the same. Moving (renaming)
  the corrupted database aside, prior to. I also issued
  sqlite3 local.sqlite
  followed by
  read pkg.sql
  and
  quit
  went w/o issue. But issuing
  pkg info
  emitted several error messages. Which appeared to be from
  sqlite3(8).
  This is on RELENG_9, w/source, and kernel world from about
  1 week ago. I know that the backup is in good shape, as I
  had been using it w/o issue.
  Is this a bug?
  
  Thank you for all your time, and consideration.
  
 This is really surprising and first time this can of things get reported, can
 you provide me the the pkg.sql.xz file?
 
 Are you runing on nfs? if yes start the lockd first (pkg should fallback on a
 working solution (I need to check for pkg backup) but sqlite3 cli tool does 
 not
 and sqlite3 cli tool on nfs without proper locking is known to corrupt 
 database
 file.
 
 Best regards,
 Bapt

Right checked I forgot to add the lock workaround on pkg backup I'll fix in
1.4.0 in the mean time you just have to start lockd (service lockd start) and
the recovery will just work.

It might have been corrupted because a background backup (without the proper
lock workaround) happened at the same time you were via the ports tree running
the pkg command.

Best regards,
Bapt


pgpSVJmpuTpFa.pgp
Description: PGP signature


Re: How to recover local.sqlite (pkg(8) problem)

2014-11-18 Thread Chris H
On Wed, 19 Nov 2014 01:21:27 +0100 Baptiste Daroussin b...@freebsd.org wrote

 On Tue, Nov 18, 2014 at 04:18:33PM -0800, Chris H wrote:
  Greetings,
   During the building of a meta-port in the ports tree. My
  /var/db/pkg/local.sqlite database became corrupted. I
  spent some time, both with the pkg man pages, and with
  sqlite3 itself attempting to use one of the backups
  created by periodic(8). Located in /var/backups. But all
  to no avail. For the record, I used
  pkg backup -r /var/backup/pkg.sql.xz, as well as unpacking
  a copy of that file, and issuing the same. Moving (renaming)
  the corrupted database aside, prior to. I also issued
  sqlite3 local.sqlite
  followed by
  read pkg.sql
  and
  quit
  went w/o issue. But issuing
  pkg info
  emitted several error messages. Which appeared to be from
  sqlite3(8).
  This is on RELENG_9, w/source, and kernel world from about
  1 week ago. I know that the backup is in good shape, as I
  had been using it w/o issue.
  Is this a bug?
  
  Thank you for all your time, and consideration.
  
 This is really surprising and first time this can of things get reported, can
 you provide me the the pkg.sql.xz file?
 
 Are you runing on nfs? if yes start the lockd first (pkg should fallback on a
 working solution (I need to check for pkg backup) but sqlite3 cli tool does
 not and sqlite3 cli tool on nfs without proper locking is known to corrupt
 database file.
Thank you for your rapid reply, Baptiste!
No. This is UFS2 only -- no nfs, no zfs.
I'll send you a copy of the pkg.sql.xz directly.
I did notice that when I used the sqlite3 cli, that the database was
created, and that the size looked correct. But issuing pkg info
resulted in many SQL related errors.

Anyway. I'll send you the file.

Thanks, again.

--Chris

 
 Best regards,
 Bapt


___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org