Skip to content

Commit 553f9f1

Browse files
kellyyehDavidZagury
authored andcommitted
[Secure Boot] Fix non-zero status exit on non secure boot system (sonic-net#2715)
What I did Warm-reboot fails on kvm due to non-zero exit upon command bootctl status 2>/dev/null | grep -c "Secure Boot: enabled" How I did it Added || true to return 0 when previous command fails. Added CHECK_SECURE_UPGRADE_ENABLED to check output of previous command Added debug logs How to verify it Run warm-reboot on kvm and physical device when increased verbosity. Expects debug log to indicate secure/non secure boot. Successful warm reboot
1 parent d300e26 commit 553f9f1

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

scripts/fast-reboot

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -618,12 +618,15 @@ fi
618618
if is_secureboot && grep -q aboot_machine= /host/machine.conf; then
619619
load_aboot_secureboot_kernel
620620
else
621-
# check if secure boot is enable in UEFI
622-
SECURE_UPGRADE_ENABLED=$(bootctl status 2>/dev/null | grep -c "Secure Boot: enabled")
623-
if [ ${SECURE_UPGRADE_ENABLED} -eq 1 ]; then
624-
load_kernel_secure
625-
else
621+
# check if secure boot is enable in UEFI
622+
CHECK_SECURE_UPGRADE_ENABLED=0
623+
SECURE_UPGRADE_ENABLED=$(bootctl status 2>/dev/null | grep -c "Secure Boot: enabled") || CHECK_SECURE_UPGRADE_ENABLED=$?
624+
if [[ CHECK_SECURE_UPGRADE_ENABLED -ne 0 ]]; then
625+
debug "Loading kernel without secure boot"
626626
load_kernel
627+
else
628+
debug "Loading kernel with secure boot"
629+
load_kernel_secure
627630
fi
628631
fi
629632

0 commit comments

Comments
 (0)