Unable to use ZFS in NanoBSD build

Hello,

I have a small problem and hopefully the FreeBSD pro's can spot this one. I am attempting to build a 32 bit version of NanoBSD and with my build script all goes well. All functions and packages work except zfs. When I boot the NanoBSD and type "zpool list" it simply errors out with "internal error: failed to initialize ZFS library". I have tried many tweaks and countless rebuilds but the results are the same. After to many days of building and testing I am now at the point where I must forum :P

Any help would be much appreciated.

Below is my build config.

Code:
NANO_NAME=nano                             # directory will be /usr/obj/nanobsd.nano
NANO_DRIVE="da0"                           # target drive for the usb flash drive
NANO_ARCH=i386                             # architecture
NANO_LABEL=NanoBSD
NANO_BOOTLOADER="boot/boot0"               # boot loader
NANO_BOOT0CFG="-o packet -s 1 -m 3 -t 18"  # boot options
NANO_IMAGES=2                              # primary and secondary image
NANO_PMAKE="make -j 4"

FlashDevice generic 1g

CONF_WORLD="
  TARGET=i386
  TARGET_ARCH=i386
"

CONF_BUILD="
  WITHOUT_ATM=true
  WITHOUT_AUDIT=true
  WITHOUT_BIND_DNSSEC=true
  WITHOUT_BIND_ETC=true
  WITHOUT_BIND_LIBS_LWRES=true
  WITHOUT_BIND_NAMED=true
  WITHOUT_BLUETOOTH=true
  WITHOUT_CALENDAR=true
  WITHOUT_CTM=true
  WITHOUT_CVS=true
  WITHOUT_DICT=true
  WITHOUT_EXAMPLES=true
  WITHOUT_FORTRAN=true
  WITHOUT_FREEBSD_UPDATE=yes
  WITHOUT_GAMES=true
  WITHOUT_GCOV=true
  WITHOUT_GPIB=true
  WITHOUT_HTML=true
  WITHOUT_I4B=true
  WITHOUT_IPFILTER=true
  WITHOUT_IPX=true
  WITHOUT_LIBKSE=true
  WITHOUT_LPR=true
  WITHOUT_MAN=true
  WITHOUT_NDIS=true
  WITHOUT_NIS=true
  WITHOUT_NLS=true
  WITHOUT_NS_CACHING=true
  WITHOUT_OBJC=true
  WITHOUT_PORTSNAP=true
  WITHOUT_PPP=true
  WITHOUT_PROFILE=true
  WITHOUT_RCMDS=true
  WITHOUT_SENDMAIL=true
  WITHOUT_SSP=true
  WITHOUT_SYSINSTALL=true
  WITHOUT_WIRELESS=true
  WITHOUT_WPA_SUPPLICANT_EAPOL=true
"

CONF_INSTALL="
  $CONF_BUILD
  NOPORTDOCS=true
  NO_INSTALL_MANPAGES=true
"

# This function enables three tweaks for embedded systems
cust_embedded_setup() {
  # turn off ascii beastie as boot menu
  echo 'autoboot_delay="4"' >> ${NANO_WORLDDIR}/boot/loader.conf
  echo 'beastie_disable="YES"' >> ${NANO_WORLDDIR}/boot/loader.conf

  # turn on noatime for /cfg for more performance
  sed -i "" -e "/cfg/s/rw/rw,noatime/" ${NANO_WORLDDIR}/etc/fstab

  # No message of the day for me
  rm ${NANO_WORLDDIR}/etc/motd
  touch ${NANO_WORLDDIR}/etc/motd

  # Symlink ZFS cache area to non-readonly area.
  rm -rf $NANO_WORLDDIR/boot/zfs
  chroot $NANO_WORLDDIR sh -c "ln -s /etc/zfs /boot/zfs"
}
customize_cmd cust_embedded_setup

# We allow root to ssh directly
customize_cmd cust_allow_ssh_root

# Install files in /usr/src/tools/tools/nanobsd/Files
customize_cmd cust_install_files

# Install packages in /usr/src/tools/tools/nanobsd/Pkg
install_packages() {
  mkdir -p $NANO_WORLDDIR/packages
  cp -R /usr/src/tools/tools/nanobsd/packages/* $NANO_WORLDDIR/packages
  chroot $NANO_WORLDDIR sh -c "cd packages; pkg_add -v *; cd ..;"
  rm -rf $NANO_WORLDDIR/packages
}
customize_cmd install_packages
 
I'm not familiar with NanoBSD directly, but have you loaded the opensolaris.ko and zfs.ko kernel modules, prior to testing anything ZFS-related? These are usually loaded via loader.conf, but I don't see anything related to that in your script.
 
Thanks for the tip and pardon my total lack of knowledge on NanoBSD as this is my learning attempts to get it going.

I have added a zfs_enable="YES" line into the build script and when booting the NanoBSD image i can also see it in the right place after catting it out. Same error.

Also when the zfs service tries to load the module it produces the error kldload: can't load zfs: no such file or directory.

As far as I am aware my build script does not exclude ZFS so I am not 100% sure why the libs aren't in the image.

Pete
 
Solved my own issue but much thanks to the guidance. What was missing is the NanoBSD module override. It seems default NanoBSD does not include the modules themselves in the build. At least the next person to come along to this post hopefully won't get frustrated like me :P

Code:
NANO_MODULES="zfs opensolaris"
export NANO_BSD
 
Back
Top