Solved pkg: Unable To Use Custom Repository

dave

Well-Known Member

Reaction score: 24
Messages: 421

Brand new R-Pi image just booted. I created a file at /usr/local/etc/pkg/repos/FreeBSD.conf as per instructions in /etc/pkg/FreeBSD.conf to disable the default pkg repository. Also created a custom repository file at /usr/local/etc/pkg/repos/custom.conf as per the handbook. Yet my system continues to try and fetch from there and does not attempt to use the new custom repository. Any idea why?

Code:
root@rpi-b:/home/freebsd # ls /etc/pkg/
FreeBSD.conf

root@rpi-b:/home/freebsd # cat /etc/pkg/FreeBSD.conf
# $FreeBSD: releng/10.3/etc/pkg/FreeBSD.conf 296373 2016-03-04 01:27:38Z marius $
#
# To disable this repository, instead of modifying or removing this file,
# create a /usr/local/etc/pkg/repos/FreeBSD.conf file:
#
#   mkdir -p /usr/local/etc/pkg/repos
#   echo "FreeBSD: { enabled: no }" > /usr/local/etc/pkg/repos/FreeBSD.conf
#
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/quarterly",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}

root@rpi-b:/home/freebsd # cat /usr/local/etc/pkg/repos/FreeBSD.conf
FreeBSD: { enabled: no }

root@rpi-b:/home/freebsd # cat /usr/local/etc/pkg/repos/custom.conf
custom: {
  url: "http://pkg.example.com/repo",
  enabled: yes
}

root@rpi-b:/home/freebsd # pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/FreeBSD:10:armv6/latest, please wait...
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:10:armv6/latest/Latest/pkg.txz: Not Found
A pre-built version of pkg could not be found for your system.
Consider changing PACKAGESITE or installing it from ports: 'ports-mgmt/pkg'.
 

talsamon

Daemon

Reaction score: 276
Messages: 1,808

I would say run:
cd /usr/ports/ports-mgmt/pkg
and
make install clean
 
OP
OP
dave

dave

Well-Known Member

Reaction score: 24
Messages: 421

I would say run:
cd /usr/ports/ports-mgmt/pkg
and
make install clean
So I should use ports instead? I'm sure that would work, but it doesn't really answer the question I'm asking.
 

talsamon

Daemon

Reaction score: 276
Messages: 1,808

It is the simple way to get pkg. You need the ports. Not for all programs exists a package.
 
OP
OP
dave

dave

Well-Known Member

Reaction score: 24
Messages: 421

It is the simple way to get pkg. You need the ports. Not for all programs exists a package.
Thanks. I'm not here for a ports vs pkgs debate, though. I have built a custom package repository and am asking how to configure FreeBSD to use it.
 

talsamon

Daemon

Reaction score: 276
Messages: 1,808

The repo.conf seems right. man pkg or pkg help command e.g. pkg help upgrade or pkg help update or pkg help install ..... will show you how to use.
 
OP
OP
dave

dave

Well-Known Member

Reaction score: 24
Messages: 421

I thought you want a custom file like this /usr/local/etc/pkg.conf taken from here:
http://blog.etoilebsd.net/post/Home_made_pkgng_repo

Found here:
https://wiki.freebsd.org/pkgng
Bizarre!

Code:
root@rpi-b:/home/freebsd # pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from http://pkg.example.com/repo, please wait...
pkg-static: PACKAGESITE in pkg.conf is no longer supported.  Convert to the new repository style.  See pkg.conf(5)
pkg-static: Cannot parse configuration file!
Seems neither the old way nor the new way works?!?!
 
OP
OP
dave

dave

Well-Known Member

Reaction score: 24
Messages: 421

Okay, seem those configs have to go in /usr/local/etc/pkg.conf instead of separate files under /usr/local/pkg/repos. Strange, because that is contrary to docs, including the comment straight out of the /etc/pkg/FreeBSD.conf file.

Code:
root@rpi-b:/home/freebsd # rm /usr/local/etc/pkg.conf

root@rpi-b:/home/freebsd # cat /usr/local/etc/pkg/repos/* >> /usr/local/etc/pkg.conf

root@rpi-b:/home/freebsd # pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N]: y
Bootstrapping pkg from http://pkg.example.com/repo, please wait...
Installing pkg-1.7.2...
Extracting pkg-1.7.2: 100%
Thanks to everyone for suggestions!
 
OP
OP
dave

dave

Well-Known Member

Reaction score: 24
Messages: 421

Update: I figured out what the real problem was now. I had a script that was creating an empty /usr/local/etc/pkg.conf, which was preventing the other config files from working. So, the config in the original post works, but not if there is a /usr/local/etc/pkg.conf file present with no content.
 

talsamon

Daemon

Reaction score: 276
Messages: 1,808

This could not be right. The content of /usr/local/etc/pkg.conf is complete another.
There are only aliases of pkg commands in it. In the attachment my pkg.conf.
 

Attachments

OP
OP
dave

dave

Well-Known Member

Reaction score: 24
Messages: 421

Yes, but I think having a blank one caused the other configs in the other dirs not to be read. When I put my repo configs directly in /usr/local/etc/pkg.conf, I was able to bootstrap pkg(8) from the custom repo. Once I was able to bootstrap pkg(8), it overwrote /usr/local/etc/pkg.conf with the same as you uploaded. Now the configs in the other dirs work.

To clarify: Removing the blank /usr/local/etc/pkg.conf file completely would have worked too.
 
Top