Nixos-rebuild switch fails - "Failed to read EFI variable" x 7

Installed via minimal install iso (24.05), following the NixOS manual. Got it to boot on my device but after changing configuration.nix and running nixos-rebuild switch getting the following errors:

Failed to read EFI variable LoaderFirmwareType-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f: Input/output error
Failed to read EFI variable LoaderFirmwareInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f: Input/output error
Failed to read EFI variable LoaderInfo-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f: Input/output error
Failed to read EFI variable LoaderImageIdentifier-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f: Input/output error
Failed to read EFI variable LoaderDevicePartUUID: Input/output error
Failed to read EFI boot order: Input/output error
Failed to determine entries reported by boot loader, ignoring Input/output error
Failed to read EFI variable "LoaderEntrySelected", ignoring Input/output error
Traceback  (most recent call last):
  File "/nix/store/96vj54ikzq9ak4i8dzf6wvl7nhdysbg-systemd-boo/bin/system-boot", line 397, in <module> main()
  File "/nix/store/96vj54ikzq9ak4i8dzf6wvl7nhdysbg-systemd-boo/bin/system-boot", line 380, in main install_bootloader(args)
  File "/nix/store/96vj54ikzq9ak4i8dzf6wvl7nhdysbg-systemd-boo/bin/system-boot", line 299, in install_bootloader installed_out = subprocess.check_output([f"{SYSTEMD}/bin/bootctl", f"--esp-path]{EFI_SYS_MOUNT_POINT}", "status"], universal_newlines=True)
  
  File "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/lib/python3.11/subprocess.py", line 466, in check_output return run(*popenargs, stdout = PIPE, timeout=timeout, check= True,

  File "/nix/store/h723hb9m43lybmvfxkk6n7j4v664qy7b-python3-3.11.9/lib/python3.11/subprocess.py", line 571, in run raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['/nix/store/nswmyag3qi9ar0mxw51p8zm0wv5zxld-systemd-255.9/bin/bootclt', '--esp-path=/boot', 'status']' returned non-zero exit status 1.
warning: error(s) occured while switching to new configuration

Ran nix-store --verify --repair, but still got the same output from rebuild.
Tried running with canTouchEFIVariables as both true and false.
Tried running with the --install-bootloader flag, got these errors:

(canTouchEFIVariables true)

Failed to write 'LoaderSystemToken' EFI variable: Input/output error

(canTouchEFIVariables false)

[ 2631.413332] systemd-gpt-auto-generator[27331]: Failed to read loader partition UUID: Input/output error

Sytem information:
NixOS version: 24.05

Output from nix-info:

- system: `"x86_64-linux"`
- host os: `Linux 6.6.52, NixOS, 24.05 (Ukari), 24.05.5197.944b2aea7f0a`
- multi-user?: `yes`
- sandbox: `yes`
- version: `nix-env (Nix) 2.18.5`
- nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

This one is a red herring and not relevant.

This one is a red herring and not relevant.

Thanks @ElvishJerricco. With so many errors coming up didn’t know which might be key.

That was the last thing I had tried (–install-bootloader & cantouchefivariables false), so rebooted and selected most recent generation - which booted correctly with the changes I had made.

Yea, you probably just need to disable the EFI variables with canTouchEfiVariables = false on this system

2 Likes