NanoBSD Package installation error.

I am newbie to FreeBSD. Pkg installation fails on NanoBSD creation. Please help, see the error below.

+ chroot /usr/obj/nanobsd.TRIAL/_.w /bin/sh -exc 'env ASSUME_ALWAYS_YES=YES PKG_DBDIR=/var/db/pkg SIGNATURE_TYPE=none /usr/sbin/pkg add /_.p/pkg-1.10.1.txz'
+ env 'ASSUME_ALWAYS_YES=YES' 'PKG_DBDIR=/var/db/pkg' 'SIGNATURE_TYPE=none' /usr/sbin/pkg add /_.p/pkg-1.10.1.txz
Installing pkg-1.10.1...
Extracting pkg-1.10.1: .......... done
+ CR 'env ASSUME_ALWAYS_YES=YES PKG_DBDIR=/var/db/pkg SIGNATURE_TYPE=none /usr/sbin/pkg add /_.p/Config.conf'
+ chroot /usr/obj/nanobsd.TRIAL/_.w /bin/sh -exc 'env ASSUME_ALWAYS_YES=YES PKG_DBDIR=/var/db/pkg SIGNATURE_TYPE=none /usr/sbin/pkg add /_.p/Config.conf'
+ env 'ASSUME_ALWAYS_YES=YES' 'PKG_DBDIR=/var/db/pkg' 'SIGNATURE_TYPE=none' /usr/sbin/pkg add /_.p/Config.conf
pkg: /_.p/Config.conf: No such file or directory
pkg: Was 'pkg install /_.p/Config.conf' meant?

Failed to install the following 1 package(s): /_.p/Config.conf
+ umount /usr/obj/nanobsd.TRIAL/_.w/_.p
+ rm -rf /usr/obj/nanobsd.TRIAL/_.w/_.p
+ echo 'NANO RM -rf /usr/obj/nanobsd.TRIAL/_.w/_.p'
 
I am using pkgng on NanoBSD without issue.
https://forums.freebsd.org/threads/51803/#post-356276

I do copy over the entire -CURRENT /usr/src/tools/tools/nanobsd/ directory for FreeBSD 11 and 11.1 build machines.
The newer NanoBSD work in FreeBSD Current is needed.

The one caveat of the cust_pkgng function is that the txz files must be the same architecture you are building for. So if your building an Arm Image you need to use the approriate pkg.txz. There are also i386 and amd64 versions of the file with the same exact name. I keep separate package directories to keep them right.

One thing not covered much is how to use the newer work in the /nanobsd/embedded directory. The only help is in the README.

I like to copy out of the /nanobsd/embedded/ directory i386.cfg and common and I put them in a new directory under /nanobsd for example /nanobsd/apu/ Then I rename i386.cfg to apu.cfg and customize.
I do edit the /nanobsd/defaults.sh file for the build and backup the original.

I build like this:
cd /usr/src/tools/tools/nanobsd/apu/
./nanobsd.sh -c apu.cfg

Any custom files you want go in the /nanobsd/Files directory.
/etc/rc.conf can't be overlaid though. You add those items to the typical_embedded section of common that builds the local rc file.
 
Hello Phishfry:

"I do copy over the entire -CURRENT /usr/src/tools/tools/nanobsd/ directory for FreeBSD 11 and 11.1 build machines.
The newer NanoBSD work in FreeBSD Current is needed." Please explain in detail.

Can you share your apu.cfg file?

Thanks in advance.
 
OK here is my APU2 script. Note:On APU2 SDCard Shows up as ada0. On APU1 SDCard Shows up as da0.
apu2.cfg
Code:
NANO_ARCH=amd64
NANO_KERNEL=GENERIC
NANO_DRIVE=ada0
NANO_NAME=APU2
NANO_BOOTLOADER="/boot/boot0"
NANO_BOOT_MBR="/boot/boot0"
NANO_BOOT0CFG="-o packet -s 2 ${NANO_DRIVE}"
customize_cmd cust_pkgng

. common        # Pull in common definitions, keep last

I do have to modify a few things on my build. I simply move /nanobsd directory on FreeBSD11 to safe spot and copy over newest /nanobsd directory.
I have a machine with FreeBSD -CURRENT and I copy the /usr/src/tools/tool/nanobsd/* to a network share and copy over to FreeBSD 11 box.
Nanobsd is nothing more than a set of scripts. The newest work is the best.
 
A partial log of a recent Astaro build:
_cust.cust_pkgng
Code:
+ cust_pkgng
+ mkdir -p /usr/embedded/astaro/_.w/usr/local/etc
+ local 'PKG_CONF=/usr/embedded/astaro/_.w/usr/local/etc/pkg.conf'
+ local 'PKGCMD=env ASSUME_ALWAYS_YES=YES PKG_DBDIR=/var/db/pkg SIGNATURE_TYPE=none /usr/sbin/pkg'
+ touch /usr/embedded/astaro/_.w/usr/local/etc/pkg.conf
+ grep -Eiq '^PKG_DBDIR:.*' /usr/embedded/astaro/_.w/usr/local/etc/pkg.conf
+ echo 'PKG_DBDIR: "/var/db/pkg"'
+ [ ! -d /usr/src/tools/tools/nanobsd/Pkg ]
+ find -s /usr/src/tools/tools/nanobsd/Pkg -iname 'pkg-*'
+ basename /usr/src/tools/tools/nanobsd/Pkg/pkg-1.10.1.txz
+ _NANO_PKG_PACKAGE=pkg-1.10.1.txz
+ [ -z pkg-1.10.1.txz -o ! -f /usr/src/tools/tools/nanobsd/Pkg/pkg-1.10.1.txz ]
+ mkdir -p /usr/embedded/astaro/_.w/_.p
+ mount -t nullfs -o noatime -o ro /usr/src/tools/tools/nanobsd/Pkg /usr/embedded/astaro/_.w/_.p
+ trap 'umount /usr/embedded/astaro/_.w/_.p ; rm -rf /usr/embedded/astaro/_.w/_.p' 1 2 15 EXIT
+ CR 'env ASSUME_ALWAYS_YES=YES PKG_DBDIR=/var/db/pkg SIGNATURE_TYPE=none /usr/sbin/pkg add /_.p/pkg-1.10.1.txz'
+ chroot /usr/embedded/astaro/_.w /bin/sh -exc 'env ASSUME_ALWAYS_YES=YES PKG_DBDIR=/var/db/pkg SIGNATURE_TYPE=none /usr/sbin/pkg add /_.p/pkg-1.10.1.txz'
+ env 'ASSUME_ALWAYS_YES=YES' 'PKG_DBDIR=/var/db/pkg' 'SIGNATURE_TYPE=none' /usr/sbin/pkg add /_.p/pkg-1.10.1.txz
Installing pkg-1.10.1...
Extracting pkg-1.10.1: .......... done
+ cd /usr/src/tools/tools/nanobsd/Pkg
+ sort
+ find dnsmasq-2.77_1,1.txz gettext-runtime-0.19.8.1_1.txz gettext-tools-0.19.8.1.txz gmake-4.2.1_1.txz gmp-6.1.2.txz indexinfo-0.2.6.txz libidn2-2.0.3.txz libunistring-0.9.7.txz nettle-3.3.txz p5-Locale-Maketext-Gettext-1.28_2.txz perl5-5.24.2.txz pkg-1.10.1.txz pkgconf-1.3.7,1.txz readline-7.0.3-4792ed0c9c.txz texinfo-6.4_1,1.txz ytree-1.99.p1_1-8cb3267c37.txz -not -name pkg-1.10.1.txz -print
+ uniq
+ _PKGS='dnsmasq-2.77_1,1.txz
gettext-runtime-0.19.8.1_1.txz
gettext-tools-0.19.8.1.txz
gmake-4.2.1_1.txz
gmp-6.1.2.txz
indexinfo-0.2.6.txz
libidn2-2.0.3.txz
libunistring-0.9.7.txz
nettle-3.3.txz
p5-Locale-Maketext-Gettext-1.28_2.txz
perl5-5.24.2.txz
pkgconf-1.3.7,1.txz
readline-7.0.3-4792ed0c9c.txz
texinfo-6.4_1,1.txz
ytree-1.99.p1_1-8cb3267c37.txz'
+ echo 'dnsmasq-2.77_1,1.txz
[SNIP]
 
Here is what my build box nanobsd directory looks like:
screenshot9.png


I have build directories for apu2, checkpoint, and msi that I added.
I also create a "Per Build" set of files to overlay. You can see the file structure above under Files-Astaro.
So that is my custom location. When I want to build I rename that folder to /Files so that it uses only those files as overlay.

I use a similar scheme for packages with nanobsd/Pkg-Astaro containing the packages for my Astaro build. I rename to /nanobsd/Pkg when building Astaro. That way my fileserver(msi) gets one set of files and packages and a WAP build(astaro) would get different files and packages.
Fully configured and ready to deploy.
 
So just to be clear cust_pkgng function will build whatever package files are in the /nanobsd/Pkg directory. At a minimum it will need pkg.txz
It also seems to run the needed cust.fix_pkg function.
 
Back
Top