No packages with 9.3-RELEASE? [was: Re: Port Changes FAQ]

Ian Smith smithi at
Thu Jun 19 19:12:17 UTC 2014

On Thu, 19 Jun 2014 06:59:06 +0100, Matthew Seaman wrote:

 > There will be pkg(8) packages on the DVD installer images.  If that
 > didn't work for you when installing 10.0 that's a bug.  You know that
 > all supported branches have the default package repositories enabled now
 > (including 8.4-RELEASE and 9.2-RELEASE)?  Do you also know how to turn
 > that off? Like this:
 >   echo 'FreeBSD: { enabled: no}' > /usr/local/etc/pkg/repos/FreeBSD.conf
 > That should solve the problem with your systems wanting to connect to
 > the net.  However, that 'install packages  from installation media'
 > thing really should just work.

[Devin, I'm hoping you've read this thread to date, rambling and all]

After many hours digging through the bsdinstall and bsdconfig files from 
FreeBSD-10.0-RELEASE-amd64-dvd1-memstick.img - made from and having the 
same contents as FreeBSD-10.0-RELEASE-amd64-dvd1.iso - I'm pretty sure 
I've found the problem.

In /usr/share/bsdconfig/packages/index.subr (tabs lost):
        # Generate $PACKAGESITE variable for pkg(8) based on media type
        local __type __data __site
        device_media get type __type
        device_media get private __data
        case "$__type" in
                __site="file://$__data/packages/$PKG_ABI" ;;
                __site="file://${__data:-$MOUNTPOINT}/packages/$PKG_ABI" ;;
                f_getvar $VAR_FTP_PATH __site
                __site="$__site/packages/$PKG_ABI" ;;
                f_getvar $VAR_HTTP_PATH __site
                __site="$__site/$PKG_ABI/latest" ;;
                f_getvar $VAR_HTTP_PROXY_PATH __site
                __site="$__site/packages/$PKG_ABI" ;;
                export REPOS_DIR="$MOUNTPOINT/packages/repos" ;;
        *) # UFS, DISK, CDROM, USB, DOS, NFS, etc.

        export PACKAGESITE="$__site"
        f_dprintf "PACKAGESITE=[%s]" "$PACKAGESITE"
        if ! f_eval_catch $__funcname pkg "pkg update"; then
                f_show_err "$msg_unable_to_update_pkg_from_selected_media"
                f_device_shutdown media
                return $FAILURE

.. which I recall being the (last?) error message I received.  Note that 
unless the media is _detected_ as $DEVICE_TYPE_CDROM, REPOS_DIR is not 
exported as $MOUNTPOINT/packages/repos, so pkg(8) uses its default:

# $FreeBSD: release/10.0.0/etc/pkg/FreeBSD.conf 258710 2013-11-28 14:24:26Z gjb $
FreeBSD: {
  url: "pkg+${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes

.. as it normally would for USB media, assuming this to be a normal 
-memstick.img install, or any of the other media types _selected_ in a 
post-install environment, expecting no packages to be on the media.

total 2
drwxr-xr-x  2 root  wheel  512 Jan 17 10:22 repos
drwxr-xr-x  3 root  wheel  512 Jan 17 10:22 freebsd:10:x86:64

total 1
-rw-r--r--  1 root  wheel  285 Jan 17 10:22 FreeBSD_install_cdrom.conf

total 331
drwxr-xr-x  2 root  wheel   30208 Jan 17 10:22 All
-rw-r--r--  1 root  wheel  253632 Jan 17 10:22 packagesite.txz
-rw-r--r--  1 root  wheel   45496 Jan 17 10:22 digests.txz

total 1688417
-rw-------  1 root  wheel    2070008 Jan  7 02:36 pkg-1.2.4_1.txz

.. where I needed /packages/repos/FreeBSD_install_cdrom.conf containing:

# $FreeBSD: release/10.0.0/release/scripts/FreeBSD_install_cdrom.conf 259534 2013-12-18 01:27:30Z gjb $
# The pkg(8) repository configuration file for the installation DVD.
FreeBSD_install_cdrom: {
  url: "file:///dist/packages/${ABI}",
  mirror_type: "none",
  enabled: yes

Disabling /etc/package/FreeBSD.conf won't cut it; in this instance we 
need to export REPOS_DIR="$MOUNTPOINT/packages/repos" also so pkg(8) 
knows where to look.

I could just patch that line in /usr/share/bsdconfig/packages/index.subr 
while making the dvd1-memstick.img, but I'm hoping that Devin will come 
up with something more elegant .. hopefully this might work for 9.3-R?

Perhaps? just something as crude as, or along the lines of:

	*) # UFS, DISK, CDROM, USB, DOS, NFS, etc.
 		if [ `du -d1 $MOUNTPOINT/packages` -gt $SOMESIZE ]; then
			# there are significant packages on this media
			export REPOS_DIR="$MOUNTPOINT/packages/repos"			
		fi ;;

.. which would allow the use of packages on any of those media types as 
an alternative to using the online repository - maybe optionally? - but 
at least we (royal plural :) need it for usage.

cheers, Ian

More information about the freebsd-questions mailing list