From owner-freebsd-stable@FreeBSD.ORG Thu Dec 4 20:56:59 2014 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD3C74CE for ; Thu, 4 Dec 2014 20:56:59 +0000 (UTC) Received: from udns.ultimatedns.net (unknown [IPv6:2602:d1:b4d6:e600:4261:86ff:fef6:aa2a]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B2D812EA for ; Thu, 4 Dec 2014 20:56:59 +0000 (UTC) Received: from ultimatedns.net (localhost [127.0.0.1]) by udns.ultimatedns.net (8.14.9/8.14.9) with ESMTP id sB4KvIxk099835; Thu, 4 Dec 2014 12:57:18 -0800 (PST) (envelope-from bsd-lists@bsdforge.com) To: freebsd-stable@freebsd.org, "Ronald Klop" In-Reply-To: References: From: "Chris H" Subject: Re: restore a periodic backup of pkg db Date: Thu, 04 Dec 2014 12:57:19 -0800 Content-Type: text/plain; charset=UTF-8; format=fixed MIME-Version: 1.0 Message-id: <11af9c0faee95463a12bfbae7620a48a@ultimatedns.net> Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Dec 2014 20:56:59 -0000 On Thu, 04 Dec 2014 20:33:33 +0100 "Ronald Klop" 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 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@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@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-stable > To unsubscribe, send any mail to "freebsd-stable-unsubscribe@freebsd.org"