restore a periodic backup of pkg db

Chris H bsd-lists at bsdforge.com
Thu Dec 4 20:56:59 UTC 2014


On Thu, 04 Dec 2014 20:33:33 +0100 "Ronald Klop" <ronald at klop.ws> wrote

> Hi,
> 
> In /var/backup is a daily backup of the pkg db. The backup is not made by  
> 'pkg backup', but by 'pkg shell .dump' as I read in  
> /usr/local/etc/periodic/daily/411.pkg-backup.
> 
> How do I restore this properly?
> I can't use pkg backup -r <file> because the backup is a file containing  
> sql statements.
> Restoring by 'xzcat /var/backup/pkg.sql.xz | pkg shell' gives errors like  
> the one below. (It does not understand hex strings very well.
> 
> Regards,
> Ronald.
I ran into an issue, where pkg(8) corrupted the working sqlite3(1)
DB while I was building a meta-port. I looked to sqlite3, and
the backup copy, to recreate the DB. Problem was; sqlite3
couldn't work with the backup. bapt@ requested a copy of the file,
which I sent. But haven't heard back.
In the meantime, I simply unpacked the copy that periodic(8)
made. Then re-named the (borked) working DB, and re-named the
periodic(8) backup to reflect the name of the (borked) working copy.

What you will need to do, is determine *which* periodic(8)
copy is your local.sqlite3 copy. Other than that, it should be
a *fairly* trivial task.

--Chris

> 
> 
> [root at sheeva /var/db/pkg]# xzcat /var/backups/pkg.sql.xz | pkg shell
> Error: near line 33904: near  
> "'0001308D03020101030002010104000101010300020101030001010103000E0101030006010
> 10400050101060001010104000101010400020101030001010104000301010500060101050003
> 01010400010101040002010103000701010500040101040001010104000701010400020101040
> 00301010400010101050006010103000101010500060101060003010103000101010303000101
> 01050002010104000101010400040101040002010105000301010400020101040003010105000
> 10101040009010105000101010300010101040001010105000301010300020101040001010106
> 00090101030001010103000301010400010101060002010104000101010400020101060001010
> 1060001010106000B010103000401010300080101030300010101030300010101030300010101
> 03030001010103030002010103000801010500080101040002010103030004010105000301010
> 40002010104000601010500010101040006010106000101010300030101040001010103000F01
> 01050002010106000B0101030001010105000101350B0B01010600AF0101010600'":  
> syntax error
> _______________________________________________
> freebsd-stable at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to "freebsd-stable-unsubscribe at freebsd.org"




More information about the freebsd-stable mailing list