freebsd / poudriere

Port/Package build and test system
https://github.com/freebsd/poudriere/wiki
BSD 2-Clause "Simplified" License
379 stars 161 forks source link

image: Option to set compatibility property for zpool #1099

Open einsibjarni opened 7 months ago

einsibjarni commented 7 months ago

Prerequisites

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

jlduran commented 6 months ago

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
einsibjarni commented 6 months ago

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?

jlduran commented 6 months ago

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

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.