Skip to content

Instantly share code, notes, and snippets.

@kylewlacy
Created March 10, 2018 07:30
Show Gist options
  • Save kylewlacy/14d171b0f117defdda000c8b60981276 to your computer and use it in GitHub Desktop.
Save kylewlacy/14d171b0f117defdda000c8b60981276 to your computer and use it in GitHub Desktop.
Fix for error during NixOS UEFI installation: "Failed to create EFI Boot variable entry: No such file or directory"
# Tested with nixos-minimal-18.03pre130932.cc4677c36ee-x86_64-linux.iso
# Manually mounted /mnt (NixOS root), /mnt/boot (mkfs.ext4 Grub partition), /mnt/boot/efi (mkfs.vfat for EFI boot vars)
[root@nixos:~]# cat /mnt/etc/nixos/hardware-configuration.nix
# Do not modify this file! It was generated by ‘nixos-generate-config’
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, ... }:
{
imports =
[ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/8ee6694b-c5fd-408c-a62b-bff3fed8279b";
fsType = "btrfs";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/b08fc826-a03a-4a55-b58c-c79817c274fa";
fsType = "ext4";
};
fileSystems."/boot/efi" =
{ device = "/dev/disk/by-uuid/DCAD-4D1C";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/1e680b2f-a23a-40bc-8143-00c50820b715"; }
];
nix.maxJobs = lib.mkDefault 4;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}
[root@nixos:~]# cat /mnt/etc/nixos/configuration.nix | head -n20
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Use /boot/efi as the EFI mount point instead of /boot.
boot.loader.efi.efiSysMountPoint = "/boot/efi";
# ...
[root@nixos:~]# nixos-install
building the configuration in /mnt/etc/nixos/configuration.nix...
warning: dumping very large path (> 256 MiB); this may run out of memory
[164 built, 257 copied (1332.4 MiB), 10.6 MiB DL]
copying channel...
installing the boot loader...
setting up /etc...
Initializing machine ID from random generator.
Created "/boot/efi/EFI".
Created "/boot/efi/EFI/systemd".
Created "/boot/efi/EFI/BOOT".
Created "/boot/efi/loader".
Created "/boot/efi/loader/entries".
Copied "/nix/store/7m31df5kk2s0s6b4j0whky06g03ayjns-systemd-237/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/systemd/systemd-bootx64.efi".
Copied "/nix/store/7m31df5kk2s0s6b4j0whky06g03ayjns-systemd-237/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/BOOT/BOOTX64.EFI".
Failed to create EFI Boot variable entry: No such file or directory
Traceback (most recent call last):
File "/nix/store/xg92k6fil20qqb2cssd1513b8189z7p6-systemd-boot-builder.py", line 210, in <module>
main()
File "/nix/store/xg92k6fil20qqb2cssd1513b8189z7p6-systemd-boot-builder.py", line 185, in main
subprocess.check_call(["/nix/store/7m31df5kk2s0s6b4j0whky06g03ayjns-systemd-237/bin/bootctl", "--path=/boot/efi", "install"])
File "/nix/store/p1bp0kpmxi7nzrla7n7c4waqic0a2myk-python3-3.6.4/lib/python3.6/subprocess.py", line 291, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/nix/store/7m31df5kk2s0s6b4j0whky06g03ayjns-systemd-237/bin/bootctl', '--path=/boot/efi', 'install']' returned non-zero exit status 1.
[root@nixos:~]# mount -t sysfs sysfs /mnt/sys
[root@nixos:~]# mount -t efivarfs efivarfs /mnt/sys/firmware/efi/efivars/
[root@nixos:~]# nixos-install
building the configuration in /mnt/etc/nixos/configuration.nix...
copying channel...
installing the boot loader...
setting up /etc...
Copied "/nix/store/7m31df5kk2s0s6b4j0whky06g03ayjns-systemd-237/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/systemd/systemd-bootx64.efi".
Copied "/nix/store/7m31df5kk2s0s6b4j0whky06g03ayjns-systemd-237/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/efi/EFI/BOOT/BOOTX64.EFI".
Created EFI boot entry "Linux Boot Manager".
setting up /etc...
setting root password...
...
Created EFI boot entry "Linux Boot Manager".
Installation finished!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment