freebsd / poudriere

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

Poudriere's error handler for zfs tries to destroy the wrong zpool #1072

Closed davidchisnall closed 5 months ago

davidchisnall commented 1 year ago

The error handler force unmounts ${zroot} not ${tmpzroot}. By default, the pool created with Poudriere has the same name as the pool created by the installer, so this has the effect of force unmounting the root zpool. This unmounts all filesystems except the root, which completely breaks the system.

I have changed this:

        [ -z "${zroot}" ] || zpool destroy -f ${zroot}

to this:

    # If the ZPOOL has an alternative name, delete it using that.  If not then delete it with the 
    if [ -n "${tmpzroot}" ]; then
        zpool destroy -f ${tmpzroot}
    else
        [ -z "${zroot}" ] || zpool destroy -f ${zroot}
    fi

in delete_image in image.sh, but I am not sure whether we actually need to destroy ${zroot} in any situation.

jlduran commented 1 year ago

I wonder if it is related to #1036?

davidchisnall commented 1 year ago

I think that’s what introduced the alternative name, it didn’t update the error handling cleanup.

jlduran commented 1 year ago

I believe you have might be using poudriere-devel from ports. There is no tmpzroot after #1036.

davidchisnall commented 1 year ago

Yup, looks like it's fixed here. Maybe someone could update the port. The poudriere port is on a 2021 release and -devel is a year-old snapshot. The release can't build working ZFS images at all, the -devel version can but kills the host system if anything goes wrong.

jlduran commented 11 months ago

~See: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=274726~ Landed as https://github.com/freebsd/freebsd-ports/commit/59a0b140b063fde5e9ca3bd74d8af9c4bdd7ccd0