The branch main has been updated by imp:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=a62eaf71ddb7463cf51d2be8be6506befbcfff8d

commit a62eaf71ddb7463cf51d2be8be6506befbcfff8d
Author:     Phil Krylov <[email protected]>
AuthorDate: 2025-06-22 02:39:30 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2026-06-10 12:35:02 +0000

    bsdinstall(8): Fix GPT label conflicts with disks not managed by us
    
    Signed-off-by: Phil Krylov <[email protected]>
    Reviewed by: imp
    Pull Request: https://github.com/freebsd/freebsd-src/pull/1735
---
 usr.sbin/bsdinstall/scripts/zfsboot | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/usr.sbin/bsdinstall/scripts/zfsboot 
b/usr.sbin/bsdinstall/scripts/zfsboot
index a973b03d17fd..dbf7e19c6f5b 100755
--- a/usr.sbin/bsdinstall/scripts/zfsboot
+++ b/usr.sbin/bsdinstall/scripts/zfsboot
@@ -242,6 +242,7 @@ ZPOOL_SET='zpool set %s "%s"'
 hline_alnum_arrows_punc_tab_enter="Use alnum, arrows, punctuation, TAB or 
ENTER"
 hline_arrows_space_tab_enter="Use arrows, SPACE, TAB or ENTER"
 hline_arrows_tab_enter="Press arrows, TAB or ENTER"
+msg_all_possible_gpt_labels_already_taken="All possible GPT labels already 
taken"
 msg_an_unknown_error_occurred="An unknown error occurred"
 msg_back="Back"
 msg_cancel="Cancel"
@@ -840,6 +841,24 @@ zfs_create_diskpart()
 
        case "$ZFSBOOT_PARTITION_SCHEME" in
        ""|GPT*) f_dprintf "$funcname: Creating GPT layout..."
+               #
+               # 0. Check for potential GPT label conflicts with disks not
+               # managed by us and adjust $index accordingly
+               #
+               while [ -e /dev/gpt/efiboot$index ] ||
+                       [ -e /dev/gpt/gptboot$index ] ||
+                       [ -e /dev/gpt/boot$index ] ||
+                       [ -e /dev/gpt/swap$index ] ||
+                       [ -e /dev/gpt/zfs$index ]; do
+                       index=$(( $index + 1 ))
+                       if [ $index -ge 4096 ]; then
+                               f_dprintf "$funcname: all possible GPT labels 
already taken"
+                               msg_error="$msg_error: $funcname" f_show_err \
+                                       
"$msg_all_possible_gpt_labels_already_taken"
+                               return $FAILURE
+                       fi
+               done
+
                #
                # 1. Create GPT layout using labels
                #

Reply via email to