get_secure_boot_state() in python/vyos/utils/system.py runs cmdl(['mokutil', '--sb-state'], expect=[0, 255]). mokutil exits with 1 when /sys/firmware/efi exists but EFI variables are not available (efivarfs not mounted): EFI variables are not supported on this system. Exit code 1 is not in expect, so the call raises, and the callers do not catch it:
- show secure-boot ends in a traceback;
- add system image aborts in validate_secure_boot: failed to run command: mokutil --sb-state;
- show version too, except in containers (T9269 skips the call there).
Measured with efi=noruntime on OVMF:
show version prints the version block 1.5.1 2/2 (no mokutil call) rolling 0/2 (traceback; show secure-boot: "exit code: 1")
Where exit code 1 happens (mokutil returns 1 only for "EFI variables not supported"; a failed read of the SecureBoot variable returns 255, which is already handled):
- VyOS in a privileged container on a UEFI host, as in the docs' Docker example (--privileged -v /lib/modules:/lib/modules): /sys/firmware/efi is visible, but efivarfs is not mounted inside the container. Measured (podman, OVMF host): show secure-boot ends in PermissionError: [Errno 1] failed to run command: mokutil --sb-state, and add system image stops after "Validating Secure Boot signature" with Error: [Errno 1] failed to run command: mokutil --sb-state. show version works there (T9269 container guard). The same container recipe with 1.5.1 reaches the image-name prompt.
- kernel parameter efi=noruntime (used as a firmware workaround, e.g. on some Apple t2 machines).
- firmware without runtime variable services (some arm64 boards and laptops, older or vendor U-Boot).
Regular hypervisors and clouds (Proxmox/OVMF, Hyper-V, VMware, AWS, Azure, GCP) provide EFI variables at runtime, so they should not be affected (not tested on each).
Cause
T861 (https://github.com/vyos/vyos-1x/pull/4020) added the mokutil call; T6861 (https://github.com/vyos/vyos-1x/pull/4186, #4189) added exit codes 255 and 0. Exit code 1 was never handled.
Suggested fix
Add 1 to the accepted exit codes (treat it as "secure boot state unknown"), or check that /sys/firmware/efi/efivars is an efivarfs mount before calling mokutil, so the installer and show commands continue.