How to force pkg to index packages

After running portsnap(8) I tried to upgrade pkg-1.3.7 to pkg-1.3.8_2 using portupgrade(1). Although portversion(1) indicated pkg-1.3.8_2 was available to upgrade from pkg-1.3.7, portupgrade -vR pkg-1.3.7 resulted ** None has been installed or upgraded, leaving pkg-1.3.7 apparently undisturbed.

I then did:

Code:
rm -v /usr/ports/INDEX*
rm -rfv /var/db/ports/*
rm -rfv /var/db/pkg/*
portsnap fetch
portsnap extract

Also deinstalled/reinstalled pkg() and portupgrade().

Now I have:

Code:
# portversion -v
[Reading data from pkg(8) ... - 2 packages found - done]
pkg-1.3.8_2                 =  up-to-date with port 
portupgrade-2.4.12_2,2      =  up-to-date with port

However, I have 40+ packages installed which all were built from ports.

How can I force pkg(8) and portupgrade(1) to index installed packages?

Many thanks for your suggestions.
 
Well, this is not the answer to my original question, but I thought I should look at /usr/local/bin which gives me a clue about what is installed on this computer with broken pkg()/portupgrade() databases, and then just (re)build/(re)install ports.

Does this seem to be a sensible approach?
 
Well you deleted the package information and it's lost now. What you have on disk is an unrelated collection of files with no clues of which file belonged to which package. You can certainly guess what packages you had based on the contents of /usr/local/{bin|sbin|lib|libexec} and that's probably the way to go unless you can restore the package database somehow.
 
If you are lucky you can probably use the daily periodic backup of the package database under /var/backups/pkg.sql.xz and the pkg backup command to restore your database. Haven't tried it but would advise seeing if the automatic backup is there and taking a look at pkg help backup for how to restore.
 
amnixed said:
Code:
rm -rfv /var/db/pkg/*
Bad idea. This also deletes /var/db/pkg/local.sqlite, the database which contains your currently installed packages.
 
Back
Top