# pkg version without /usr/ports (pkgng)



## breefsd (Jan 13, 2014)

Hello,

I usually use a daily script that runs in my jails: `pkg_version -I /foo/my_index_file` where my_index_file is a copy of /usr/ports/INDEX-9 in the host, because I disable /usr/ports in my jails (the directory exists but is empty). I installed FreeBSD 9.2-RELEASE. Now I use new PKGNG. I created a jail and I tried to do `pkg version -I /foo/my_index_file`. Then I get the following message:

```
pkg: Unable to open ports directory /usr/ports: No such file or directory
```
I can do `pkg version -I` in the host or in the jail if I mount /usr/ports. 

Thanks.


----------



## kpa (Jan 13, 2014)

You can use the -R flag of pkg-version(8) to force it to use the remote repository as the comparison for new versions.


----------



## breefsd (Jan 13, 2014)

I tried this in the host: `pkg version -Rv`. I get the following message:

```
Updating repository catalogue
Segmentation fault (core dumped)
```

Thanks.


----------



## SirDice (Jan 13, 2014)

Try removing some of the old repository files, they may be corrupted. `rm /var/db/pkg/repo-*`.


----------



## breefsd (Jan 13, 2014)

No chance, I removed two /var/db/pkg/repo-* files, then I get the same result. Now I have one  /var/db/pkg/repo-FreeBSD.sqlite file.


----------



## breefsd (Jan 15, 2014)

Just to add information, my /usr/local/etc/pkg/repos/FreeBSD.conf:

```
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  enabled: yes
}
```

Did I miss something?
Thanks.


----------



## kpa (Jan 15, 2014)

Is ports-mgmt/pkg up to date? It should be at version 1.2.4_1 in the main host and in the jails.


----------



## breefsd (Jan 15, 2014)

The version is 1.2.4_1 in the host and in the jail.
Thanks.


----------



## breefsd (Jan 17, 2014)

Just an edit:


```
pkg version -I
[...]
pkg-1.2.5                          =
[...]
```

and 


```
pkg version -I foo/bar
[...]
pkg-1.2.5                          =
[...]
```

It seems `pkg version -I` uses /usr/ports/INDEX-9 anyway.

(note I updated ports-mgmt/pkg to 1.2.5)


----------

