Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 8 Aug 2009 11:02:05 +0000
From:      "b. f." <bf1783@googlemail.com>
To:        freebsd-questions@FreeBSD.org
Cc:        Volodymyr Kostyrko <c.kworr@gmail.com>
Subject:   Re: Recovering loss of /var/db/pkg ?
Message-ID:  <d873d5be0908080402n47e8ab48o4ec5c1c096005f0c@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
>There are a lot of common places the files would be installed such as
>bin, sbin, lib, libexec under %%PREFIX%%. You can use `find dir -type f
>| xargs -n1 -Ifoo sh -c "echo -n foo:; pkg_which foo"` to obtain the
>list of known files (pkg_which is part of ports-mgmt/portsupgrade).
>After that you can reinstall all packages that provide files with
>missing origin. I bet you should use the same /usr/ports you have last
>time when /var/db/pkg was full, just to be very close to pkg-plist.

Er, except that pkg_which uses the portupgrade package database which
is installed by default in -- you guessed it -- /var/db/pkg.  So if
you don't have it backed up somewhere, or don't have PKG_DBDIR defined
to a non-default location, you're out of luck.  And if it is still
intact, __back it up__ before calling any of the pkgtools  -- or you
may wipe it out as pkg_which does an automatic update of the pkgdb
after seeing that /var/db/pkg has been modified more recently than the
database.  Just use pkg_glob -qOa -- no need to use pkg_which.  If you
don't have it, you can:

1) use data recovery tools to try to read the names of the
subdirectories of /var/db/pkg from the disk; or
2) write a script to get the names of all files that belonged to ports
and swing through a ports tree, associating the files with ports via
the pkg-plist and PLIST_FILES variables; or
3) rip out all the old junk, and try to start afresh.

b.



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