# Keeping pkg index up-to-date



## listentoreason (Jan 19, 2015)

I've been running happily with ports-mgmt/pkg for a while now, no major issues. I have a cron job that runs periodically and checks for outdated packages. I was surprised when I saw that the number of outdated packages was growing, even while running periodic `pkg update`. I just realized that my method of filtering the output (`pkg version | grep -v '='`) was letting through a slew of "installed version newer than current version" (I've since learned that I can skip grep and run `pkg version -l '<'` to find only the out-of-date ones). As far as I can tell from `man` and Google, having "packages from the future" happens when the package index is old.

I do not have /usr/local/etc/pkg.conf, but I do have /usr/local/etc/pkg.conf.sample. The environment variable PACKAGESITE is not set. From my reading I believe that the system is therefore falling back to my old ports index - yes? What's the recommended mechanism to keep the package index up-to-date? I'd just as soon work exclusively within packages (ignoring ports), if possible. Would copying the sample file to pkg.conf be appropriate? I looked through the sample and most of the options appear to be commented out. I presume I would need to specify the URI of the repository?

Thank you for any advice!

```
FreeBSD citadel 10.0-RELEASE-p7 FreeBSD 10.0-RELEASE-p7 #0: Tue Jul  8 06:37:44 UTC 2014  root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------



## SirDice (Jan 19, 2015)

Use `pkg version -vR` to compare the versions against the _remote_ repository specifically. By default a `pkg version -v` will compare against the _local_ ports tree if it exists. In other words, if /usr/ports/INDEX-* exists it will use `pkg version -vI`.

And instead of `pkg version -v | grep -v '='` use `pkg version -vL'='`.


----------



## listentoreason (Jan 21, 2015)

SirDice said:


> Use `pkg version -vR` to compare the versions against the _remote_ repository specifically.



Ah, that does clean it up considerably - I just have one "orphaned" package listed, and I'm going to ignore that with `-l '<'`. Thank you!


----------

