Lost /var/db/pkg

Waitman Gobble gobble.wa at gmail.com
Wed Jun 13 23:10:37 UTC 2012

On Wed, Jun 13, 2012 at 2:26 PM, Eitan Adler <lists at eitanadler.com> wrote:

> On 13 June 2012 12:17, jb <jb.1234abcd at gmail.com> wrote:
> > William Orr <will <at> worrbase.com> writes:
> >
> >>
> >> Hello,
> >>
> >> I had a hard disk failure some time ago, and I ended up losing
> >> /var/db/pkg/ and everything under it (before you say I should've been
> >> backing it up, I know, I was actually doing an initial full when this
> >> happened). Is there a way I can restore it, or at least manually add
> >> entries I know for sure about?
> >
> > forums.freebsd.org/showthread.php?t=6466
> > "The application themselves are still installed and will keep
> functioning, you
> > just removed the records of their installation. When you later install
> newer
> > versions, you may have to use a force flag to overwrite files (the port
> thinks
> > it is uninstalled after all). The new port installations will get
> recorded in
> > /var/db/pkg again.'
> >
> > jb
> This will work if you need minimal downtime, but *will* come back to
> bite you some time down the line.
> --
> Eitan Adler
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "
> freebsd-questions-unsubscribe at freebsd.org"

you could cross reference the package .tbz files with what's on your

ie, tar -ztvf apache-2.2.22_5.tbz
shows you what's in /usr/local/bin, etc. Might even be able to focus on man
pages only to get an xref index.

I believe the files for /var/db/pkg are in the tbz files.
if you didn't keep your system up to date it might be trouble matching
versions, but you could get the list and see what's what, or at least have
a good idea of what _was_ installed.
I haven't tried but you could stick the 'current' files for /var/db/pkg
from tbz, matching what's installed - regardless of the 'new' version and
actual version installed, then to a pkg_delete --force then pkg_add .tbz .
it might complain about missing files but will 'prolly function.
If you have like 700-1000+ packages it might be worth the trouble.

A thought :)

Waitman Gobble
San Jose California USA

More information about the freebsd-questions mailing list