Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 13 May 2015 19:00:27 +1000
From:      Peter Jeremy <peter@rulingia.com>
To:        andrew clarke <mail@ozzmosis.com>
Cc:        Scott Bennett <bennett@sdf.org>, freebsd-ports@freebsd.org
Subject:   Re: damage to pkg's sqlite data base
Message-ID:  <20150513090027.GB25775@server.rulingia.com>
In-Reply-To: <20150513081244.GB18834@ozzmosis.com>
References:  <201505120617.t4C6HkA3019096@sdf.org> <0dcbdcb9fdfdebc53a2563b11494f61b@ultimatedns.net> <201505130512.t4D5Cpqa011080@sdf.org> <20150513081244.GB18834@ozzmosis.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 2015-May-13 18:12:44 +1000, andrew clarke <mail@ozzmosis.com> wrote:
>You can reinstall just those ports. Check /var/log/messages, eg.
>
>$ grep pkg /var/log/messages
>May 12 14:34:38 blizzard pkg: poudriere upgraded: 3.1.4 -> 3.1.6 
>May 12 14:38:08 blizzard pkg: git-lite-2.4.0 installed
>May 13 08:29:04 blizzard pkg: sqlite3 upgraded: 3.8.9_1 -> 3.8.10.1 
>May 13 08:29:05 blizzard pkg: spamassassin reinstalled: 3.4.1_1 -> 3.4.1_1 
>May 13 08:29:05 blizzard pkg: ca_root_nss upgraded: 3.18.1 -> 3.19 

That assumes you have syslog messages back to when you started using pkg.
syslog was never intended to provide an audit trail.  

>You can't rebuild it. You couldn't rebuild it in the years before
>pkgng existed, either.

Depending on exactly what went wrong, plain text files are generally
easier to manually fix up.

>The "trick" is to revert to a known-good backup of the pkg database
>that's generated daily by /usr/local/etc/periodic/daily/411.pkg-backup
>in /var/backups/ :
>
>-rw-r--r--  1 root  wheel   2207320 2015-05-13 04:20:30 pkg.sql.xz
>-rw-r--r--  1 root  wheel   2196088 2015-05-12 04:21:24 pkg.sql.xz.2

Assuming that they aren't corrupt.  But that's better than nothing.  Note
that the backup is taken every day, whether or not there has been any
change to the pkg database, so you have 2 days of backups, not the last
two revisions.

On 2015-May-13 18:17:12 +1000, andrew clarke <mail@ozzmosis.com> wrote:
>Actually I was wrong about this. The pkg command has the sqlite3
>interpreter built-in, accessed via "pkg shell", that opens local.sqlite
>by default:

Some experimenting suggests that none of the pragma commands work in
"pkg shell", so you probably will need to find a copy of sqlite3.

-- 
Peter Jeremy



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150513090027.GB25775>