poudriere icon indicating copy to clipboard operation
poudriere copied to clipboard

image: Option to set compatibility property for zpool

Open einsibjarni opened this issue 2 years ago • 3 comments

Prerequisites

  • [x] Have you checked for an existing issue describing your idea?

What is your proposal?

Add an option to set the compatibility property of zpool that poudriere image creates, i.e. compatibility="openzfs-2.1-freebsd"

What is the existing behavior, if any?

When running on FreeBSD 14+, if you try to create a FreeBSD 13.2-RELEASE image with zfs+gpt, it's unbootable since it enables features that the 13.2 bootloader doesn't support and no way to configure the features that are enabled (that I know of)

What is the motivation / use case for the change?

To create bootable zfs+gpt images for FreeBSD 13.2 on 14+

It's likely this problem will pop up again when new features are added to OpenZFS and merged in new major versions of FreeBSD

einsibjarni avatar Dec 13 '23 13:12 einsibjarni

One possibility is to adapt the current script to use makefs -t zfs:

makefs -t zfs -s ${IMAGESIZE} \
    -o poolname="$ZFSPOOLNAME" -o bootfs=${zroot}/${ZFS_BEROOT_NAME}/${ZFS_BOOTFS_NAME} -o rootpath=/ \
    -o fs=${zroot}\;mountpoint=none \
    -o fs=${zroot}/${ZFS_BEROOT_NAME}\;mountpoint=none \
    -o fs=${zroot}/${ZFS_BEROOT_NAME}/${ZFS_BOOTFS_NAME}\;mountpoint=/ \
    -o fs=${zroot}/home\;mountpoint=/home \
    -o fs=${zroot}/tmp\;mountpoint=/tmp\;exec=on\;setuid=off \
    -o fs=${zroot}/usr\;mountpoint=/usr\;canmount=off \
    -o fs=${zroot}/usr/ports\;setuid=off \
    -o fs=${zroot}/usr/src \
    -o fs=${zroot}/usr/obj \
    -o fs=${zroot}/var\;mountpoint=/var\;canmount=off \
    -o fs=${zroot}/var/audit\;setuid=off\;exec=off \
    -o fs=${zroot}/var/crash\;setuid=off\;exec=off \
    -o fs=${zroot}/var/log\;setuid=off\;exec=off \
    -o fs=${zroot}/var/mail\;atime=on \
    -o fs=${zroot}/var/tmp\;setuid=off \
    ${WRKDIR}/raw.img ${WRKDIR}/world # XXX adapt

jlduran avatar Jan 02 '24 10:01 jlduran

One possibility is to adapt the current script to use makefs -t zfs:

Would that work, even if poudriere runs 14.0, but the image created is 13.2? Is -o bootfs=${zroot}/${ZFS_BEROOT_NAME}/${ZFS_BOOTFS_NAME} the secret sauce?

einsibjarni avatar Jan 02 '24 22:01 einsibjarni

We'll see... makefs has a few drawbacks:

  • Support for some characters in the pool name (I may have a fix for this one)
  • Need to run service zpoolreguid onestart to reguid the pool
  • Need to run service zpoolupgrade onestart to upgrade the pool features

The last two can also be seen as a feature. In the meantime, I would prefer to keep using a custom pre-script that passes the compatibility option when creating the zpool (I think this is what you have been doing). I would argue against adding too many options to the vanilla poudriere-image. Although, in this is case it is a valid argument, chances are, if you are going to do something more advanced with poudriere-image, you'll likely need a custom pre-script (-B flag) anyway.

jlduran avatar Jan 05 '24 20:01 jlduran