# Using pkg with poudriere - pkg.conf



## byrnejb (Feb 23, 2021)

`FreeBSD-12.2p3`

I have built a pkg and its dependencies thus:

```
poudriere ports -u -p PORTS-12-1 && poudriere bulk -C  -j freebsd_12-2x64  -p PORTS-12-2  -f  /root/Poudriere/poudr_redmine4.txt
```

Which results in:

```
ll /usr/local/poudriere/data/packages/
total 22
drwxr-xr-x  4 root  wheel  12 Jan 11 17:10 freebsd_12-1x64-PORTS-12-1
drwxr-xr-x  3 root  wheel  11 Feb 22 22:09 freebsd_12-2x64-PORTS-12-2


ll /usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2   
total 15
lrwxr-xr-x  1 root  wheel  18 Feb 18 11:13 .buildname -> .latest/.buildname
lrwxr-xr-x  1 root  wheel  20 Feb 18 11:13 .jailversion -> .latest/.jailversion
lrwxr-xr-x  1 root  wheel  16 Feb 22 22:09 .latest -> .real_1614049740
drwxr-xr-x  4 root  wheel   9 Feb 22 22:09 .real_1614049740
lrwxr-xr-x  1 root  wheel  11 Feb 18 11:13 All -> .latest/All
lrwxr-xr-x  1 root  wheel  14 Feb 18 11:13 Latest -> .latest/Latest
lrwxr-xr-x  1 root  wheel  17 Feb 18 11:13 meta.conf -> .latest/meta.conf
lrwxr-xr-x  1 root  wheel  16 Feb 18 11:13 meta.txz -> .latest/meta.txz
lrwxr-xr-x  1 root  wheel  23 Feb 18 11:13 packagesite.txz -> .latest/packagesite.txz

find /usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2/ -name \*redmine4\*
/usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2/.real_1614049740/All/redmine4-4.1.1_6.txz
```

The HOWTO on this says to configure `pkg.conf` (`pkg_poudiere.conf` in my case) to contain:

```
myrepo: {
    url             : "file:///usr/local/poudriere/data/packages/releng112amd64-default",
    enabled         : yes,
    mirror_type     : NONE
}
```

Interpolating this I arrived at:

```
Poudriere-12-2: {
#   url: "http://192.168.216.41/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    url: "file:///usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    mirror_type: "none",
#    signature_type: "pubkey",
#    pubkey: "/usr/local/etc/pki/tls/certs/ca.harte-lyne.hamilton.vhost04.crt",
#    enabled: no
   enabled: yes
}
```

However, when I attempt to install using pkg I get this:

```
pkg install --dry-run --repository Poudriere-12-2 redmine4
Updating Poudriere-12-2 repository catalogue...
All repositories are up to date.
pkg: No packages available to install matching 'redmine4' have been found in the repositories
```

If I append `/Lates`t to the url then I get the same result.

What have I missed or misunderstood?  How is this supposed to work?


----------



## SirDice (Feb 23, 2021)

Do a `pkg search redmine`. I suspect the package is named slightly different. If there's still no package, look for build errors. It's either skipped due to a failed dependency or failed on its own. I recommend enabling the web interface (examples are in /usr/local/share/examples/poudriere/), it's much easier to look at the build status of a run. You can also use the same webserver to host the repositories for other machines on your network.


----------



## byrnejb (Feb 23, 2021)

SirDice said:


> Nope. It's `file=///usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2`. It's `<jailname>-<ports tree>`, which is `freebsd_12-2x64-PORTS-12-2` in your case.




```
Poudriere-12-2: {
    url: "file=///usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    mirror_type: "none",
#   signature_type: "pubkey",
#   pubkey: "/usr/local/etc/pki/tls/certs/ca.harte-lyne.hamilton.vhost04.crt",
    enabled: no
#   enabled: yes
}

pkg install --dry-run --repository Poudriere-12-2 redmine4
pkg: invalid url: file=///usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2
pkg: Cannot parse configuration file!
```


```
Poudriere-12-2: {
#   url: "http://192.168.216.41/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    "file=///usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    mirror_type: "none",
. . .
pkg install --dry-run --repository Poudriere-12-2 redmine4
Updating Poudriere-12-2 repository catalogue...
All repositories are up to date.
pkg: No packages available to install matching 'redmine4' have been found in the repositories
```


----------



## SirDice (Feb 23, 2021)

Yeah, mistyped that before I noticed you actually had it correct.


----------



## byrnejb (Feb 23, 2021)

```
pkg search -x redmine
p5-WebService-Redmine-0.06     Perl interface to Redmine
redmine4-4.1.1_3               Flexible project management web application
rubygem-redmine_plugin_support-0.0.5 Collection of tools to make redmine plugin development easier

pkg search -r Poudriere-12-2 -x redmine
```

If the web interface you refer to is that for Poudriere then that is how I monitor the build.  The build succeeded without error.


 


QueuedBuiltFailedSkippedIgnoredRemaining1431430000




Load AveragesSwapinfoElapsedPkg/HourImpulse( 8%) 1.20 1.30 1.2414.68%09:15:0616--


----------



## SirDice (Feb 23, 2021)

That Poudriere-12-2 repository is disabled. 


```
Poudriere-12-2: {
    url: "file=///usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    mirror_type: "none",
#   signature_type: "pubkey",
#   pubkey: "/usr/local/etc/pki/tls/certs/ca.harte-lyne.hamilton.vhost04.crt",
    enabled: no
#   enabled: yes
}
```
Set to `enabled: yes`. You can double check which repositories are enabled by looking at `pkg -vv`.


----------



## byrnejb (Feb 23, 2021)

I changed the configuration file to this 

```
Poudriere-12-2-http: {
#   url: "http://192.168.216.41/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    url:  "http:///192.168.216.41/poudriere/packages/freebsd_12-2x64-PORTS-12-2",
    mirror_type: "http",
#    signature_type: "pubkey",
#    pubkey: "/usr/local/etc/pki/tls/certs/ca.harte-lyne.hamilton.vhost04.crt",
    enabled: yes
#   enabled: yes
}
```

and got this:

```
pkg install -f  --dry-run --repository Poudriere-12-2-http redmine4
Updating Poudriere-12-2-http repository catalogue...
pkg: http:///192.168.216.41/poudriere/packages/freebsd_12-2x64-PORTS-12-2/meta.txz: No address record
repository Poudriere-12-2-http has no meta file, using default settings
pkg: http:///192.168.216.41/poudriere/packages/freebsd_12-2x64-PORTS-12-2/packagesite.txz: No address record
Unable to update repository Poudriere-12-2-http
Error updating repositories!
```


----------



## byrnejb (Feb 23, 2021)

SirDice said:


> That Poudriere-12-2 repository is disabled.


Yes, but the `--repository` option enables it nonetheless.


```
PKG-INSTALL(8)          FreeBSD System Manager's Manual         PKG-INSTALL(8)

NAME
     pkg install - install packages from remote package repositories or local
     archives

SYNOPSIS
     pkg install [-AfIMnFqRUy] [-r reponame] [-Cgix]
                 <pkg-origin|pkg-name|pkg-name-version> ...
. . .
     -r reponame, --repository reponame
                Install packages from only the named repository, irrespective
                of the configured "active" status from repo.conf.
. . .
```


----------



## SirDice (Feb 23, 2021)

byrnejb said:


> I changed the configuration file to this


You have one slash to many in the URL.


----------



## byrnejb (Feb 23, 2021)

SirDice said:


> You have one slash to many in the URL.


Thank you again.


```
Poudriere-12-2-http: {
#   url: "http://192.168.216.41/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    url:  "http://192.168.216.41/poudriere/packages/freebsd_12-2x64-PORTS-12-2",
    mirror_type: "http",
#    signature_type: "pubkey",
#    pubkey: "/usr/local/etc/pki/tls/certs/ca.harte-lyne.hamilton.vhost04.crt",
    enabled: yes
#   enabled: yes
}



pkg install -f  --dry-run --repository Poudriere-12-2-http redmine4
Updating Poudriere-12-2-http repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01   
Fetching packagesite.txz: 100%  115 KiB 117.9kB/s    00:01   
Processing entries: 100%
The provides database is up-to-date.
Poudriere-12-2-http repository update completed. 461 packages processed.
All repositories are up to date.
The following 2 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
    rubygem-pg: 1.2.3 [Poudriere-12-2-http]

Installed packages to be UPGRADED:
    redmine4: 4.1.1_3 -> 4.1.1_6 [Poudriere-12-2-http]

Number of packages to be installed: 1
Number of packages to be upgraded: 1

2 MiB to be downloaded.
```


----------



## SirDice (Feb 23, 2021)

If you use nginx, use this for the package directory:

```
location /packages {
                alias /usr/local/poudiere/data/packages;

                fancyindex on;
                }
```
That'll make the URL a little easier to handle. So you get `http://192.168.216.41/packages/freebsd_12-2x64-PORTS-12-2`
The `fancyindex` option requires that you enable HTTP_FANCYINDEX on www/nginx (it's off by default). You can leave that out, I just think it looks better for this.


----------



## byrnejb (Feb 23, 2021)

The`url: "file:///usr/local/poudriere/data/packages/freebsd_12-1x64-PORTS-12-1` still fails however.


----------



## SirDice (Feb 23, 2021)

In the URL you're using PORTS-12-2, I suspect that was from a different build run with a different ports tree? Looks like you created two repositories, each has it's own set of packages.

Don't name the ports tree, just use the default for both builds. The ports tree is the same for every version of FreeBSD anyway. So there's no reason to create a specific ports tree for specific versions.


----------



## byrnejb (Feb 23, 2021)

SirDice said:


> That'll make the URL a little easier to handle. So you get `http://192.168.216.41/packages/freebsd_12-2x64-PORTS-12-2`


I use apache24 and that is already done.  I use this host for multiple development and maintance projects and so I use `http://192.168.216.41/mumble/` as a visual indicator to keep things straight when I am looking at http pages.


----------



## byrnejb (Feb 23, 2021)

SirDice said:


> In the URL you're using PORTS-12-2, I suspect that was from a different build run with a different ports tree? Looks like you created two repositories, each has it's own set of packages.


No, 12-2 is correct for this build.  12-1 was used last year to build an older version of samba for use on 12.1 .  I copied the wrong line from pkg.conf.


```
Poudriere-12-1: {
#   url: "http://192.168.216.41/poudriere/data/packages/freebsd_12-1x64-PORTS-12-1",
    url: "file:///usr/local/poudriere/data/packages/freebsd_12-1x64-PORTS-12-1",
    mirror_type: "none",
#   signature_type: "pubkey",
#   pubkey: "/usr/local/etc/pki/tls/certs/ca.harte-lyne.hamilton.vhost04.crt",
    enabled: no
#    enabled: yes
}
# pkg install|upgrade -r Poudriere-12-1 <pkg> [<pkg> . . .]

Poudriere-12-2: {
#   url: "http://192.168.216.41/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    url: "file:///usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    mirror_type: "none",
#   signature_type: "pubkey",
#   pubkey: "/usr/local/etc/pki/tls/certs/ca.harte-lyne.hamilton.vhost04.crt",
    enabled: no
#   enabled: yes
}
```


----------



## SirDice (Feb 23, 2021)

byrnejb said:


> No, 12-2 is correct for this build. 12-1 was used last year to build an older version of samba for use on 12.1 .





byrnejb said:


> `url: "file:///usr/local/poudriere/data/packages/freebsd_12-1x64-PORTS-12-1` still fails however.


You're referring to that old build here.


----------



## byrnejb (Feb 23, 2021)

SirDice said:


> You're referring to that old build here.


Copy and paste error as explained above.  The correct file url still does not work.


```
pkg install -f  --dry-run --repository Poudriere-12-2 redmine4
Updating Poudriere-12-2 repository catalogue...
All repositories are up to date.
pkg: No packages available to install matching 'redmine4' have been found in the repositories
```


----------



## byrnejb (Feb 23, 2021)

I can get by with using http but it would be nice to know exactly what I am doing wrong here.


----------



## SirDice (Feb 23, 2021)

Try forcing the update of the catalog `pkg update -f`. I've had it happen, when mucking about with various repository settings, it just loses track and doesn't update the cached catalog when it should.


----------



## byrnejb (Feb 23, 2021)

I can get by with using http but it would be nice to know exactly what I am doing wrong here.  I get the same error for the file version whether or not there are two or three slashes.  And I believe that for file: urls three (///) is correct.


----------



## SirDice (Feb 23, 2021)

byrnejb said:


> And I believe that for file: urls three (///) is correct.


Yep. The third slash is part of the path. The URI method is `file://`, when you add an absolute path to it you get three: `file:///some/absolute/path`.


----------



## byrnejb (Feb 23, 2021)

SirDice said:


> Try forcing the update of the catalog `pkg update -f`.




```
pkg update -f                                             
Updating FreeBSD repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01   
Fetching packagesite.txz: 100%    6 MiB   3.2MB/s    00:02   
Processing entries: 100%
The provides database is up-to-date.
FreeBSD repository update completed. 30174 packages processed.
Updating Poudriere-12-2-http repository catalogue...
Fetching meta.conf: 100%    163 B   0.2kB/s    00:01   
Fetching packagesite.txz: 100%  115 KiB 117.9kB/s    00:01   
Processing entries: 100%
The provides database is up-to-date.
Poudriere-12-2-http repository update completed. 461 packages processed.
All repositories are up to date.


Poudriere-12-2: {
#   url: "http://192.168.216.41/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    url: "file:///usr/local/poudriere/data/packages/freebsd_12-2x64-PORTS-12-2",
    mirror_type: "none",
#   signature_type: "pubkey",
#   pubkey: "/usr/local/etc/pki/tls/certs/ca.harte-lyne.hamilton.vhost04.crt",
    enabled: no
#   enabled: yes
}

pkg install -f  --dry-run --repository Poudriere-12-2 redmine4
Updating Poudriere-12-2 repository catalogue...
All repositories are up to date.
pkg: No packages available to install matching 'redmine4' have been found in the repositories
```


----------



## byrnejb (Feb 23, 2021)

Could this be a bug?


----------



## SirDice (Feb 23, 2021)

Possible. I think it's because it's `enabled: no`. Try enabling it, see if that helps. If it works with `enabled: yes` then the explanation in the man page about `--repository` is incorrect or it's a bug in the way it handles them.


----------



## byrnejb (Feb 23, 2021)

It is a documentation error.  The `--repository` option does NOT override the enabled setting.


----------



## byrnejb (Feb 23, 2021)

The file url works.  Unfortunately, this means that I will need to edit the configuration file to enable the repository whenever I need a custom built package. I cannot leave it enabled.


----------



## SirDice (Feb 23, 2021)

I always install everything from my own repositories, so I have the FreeBSD repository permanently disabled. That prevents weird dependency issues if you enable/disable certain options or change the defaults (different MySQL version for example).


----------



## byrnejb (Feb 23, 2021)

I will get to that point some day. At the moment I need to get a test of redmine to work.  That is what this was all about.


----------



## jgod (Jul 5, 2022)

SirDice said:


> You can double check which repositories are enabled by looking at `pkg -vv`.


Golden advice. I couldn't find a command online when I queried "list repositories" (etc) in search engines, and just stumbled upon this here.


----------

