Nixpkgs: Cannot create efi boot entry - No space left on device

Created on 1 Aug 2017  路  15Comments  路  Source: NixOS/nixpkgs

Issue description

This is the second time this is occurring to me when trying to install. I keep getting an error message saying there's no room on my efi partition, but I i'm giving it a new one gigabyte fat32 partition which is larger than recommended. I thought it might be something to do with my Nvram, but it is only occurred so far when using the NixOS installer.

Here's the output I get:

nixos-install --root /mnt

building the system configuration...
copying NixOS/Nixpkgs sources...
finalising the installation...
Created "/boot/EFI".
Created "/boot/EFI/systemd".
Created "/boot/EFI/BOOT".
Created "/boot/loader".
Created "/boot/loader/entries".
Copied "/nix/store/xckqiwxg8la4p7ln22z7ljalbq1x70xn-systemd-232/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/systemd/systemd-bootx64.efi".
Copied "/nix/store/xckqiwxg8la4p7ln22z7ljalbq1x70xn-systemd-232/lib/systemd/boot/efi/systemd-bootx64.efi" to "/boot/EFI/BOOT/BOOTX64.EFI".
Failed to create EFI Boot variable entry: No space left on device
Traceback (most recent call last):
  File "/nix/store/w9h4ljvqdff1kdd9asjql7z01bc3mf9q-systemd-boot-builder.py", line 149, in <module>
    main()
  File "/nix/store/w9h4ljvqdff1kdd9asjql7z01bc3mf9q-systemd-boot-builder.py", line 134, in main
    subprocess.check_call(["/nix/store/xckqiwxg8la4p7ln22z7ljalbq1x70xn-systemd-232/bin/bootctl", "--path=/boot", "install"])
  File "/nix/store/r7qpc32yr09l9a0d5y3b8i84kw5phx4p-python3-3.5.3/lib/python3.5/subprocess.py", line 271, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/nix/store/xckqiwxg8la4p7ln22z7ljalbq1x70xn-systemd-232/bin/bootctl', '--path=/boot', 'install']' returned non-zero exit status 1

Steps to reproduce

Mount all my partitions, and install. The system is a UEFI system of course.

Create a 1GiB esp, mount to /boot

gdisk /dev/sdf
Command (? for help): n
Partition number (5-128, 17.03-v2 5):
First sector (34-488397134, 17.03-v2 = 225445888) or {+-}size{KMGTP}:
Last sector (225445888-488397134, 17.03-v2 = 488397134) or {+-}size{KMGTP}: +1G
Hex code or GUID (L to show codes, Enter = 8300): ef00
Changed type of partition to 'EFI System'

Command (? for help): w

Format

mkfs.fat -F32 /dev/sdf1
mount /dev/sdf1 /mnt/boot

Install.

Technical details

Relevant configuration:

  hardware.cpu.intel.updateMicrocode = true;

  boot = {
    tmpOnTmpfs = true;
    cleanTmpDir = true;
    loader = { # Bootloader
      efi.canTouchEfiVariables = true;
      efi.efiSysMountPoint = "/boot";
      systemd-boot.enable = true;
    };

    initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci"
                                      "usb_storage" "usbhid" "sd_mod" "sr_mod" ];
  • System: (NixOS: 17.03.1482.1b57bf274a (Gorilla))
  • Nix version: (nix-env (Nix) 1.11.11)
  • Nixpkgs version: ("17.03.1482.1b57bf274a")
  • Sandboxing enabled: (true)
nixos

Most helpful comment

FYI, I've been running into this problem for some time, and I also think this is a firmware problem. The workaround for me was to run this command whenever I receive the "no space left on device" error:

rm /sys/firmware/efi/efivars/dump-*

If you then try again nixos-install (or nixos-rebuild switch) it should work fine.

All 15 comments

what about ls -la /boot

@domenkozar It lists the files normally, and there's plenty of space. Maybe it's my motherboard, I found some information that talked about if the nvram is messed up it can cause this issue. I tried seeing if removing the variables with efibootmgr would fix the issue but after I removed all of them it's still said there was no space.

I reflashed my Motherboard BIOS which should clear the NVRAM and I'm going to see if attempting an install with something else will work, or if it will cause the same problem.

@domenkozar So, after attempting an install on Arch, I was able to create entries which makes me think perhaps this is a NixOS problem.

Although the error suggests it's out of space on /boot, have you checked RAM usage during installation? The NixOS live CD uses a nix store with read-only (on CD media) and read-write (RAM) layers. Everything gets build in this nix store before being copied to /mnt/nix/store, so if you try to install a lot of packages nixos-install it will eat away at your RAM.

subprocess.CalledProcessError: Command '['/nix/store/xckqiwxg8la4p7ln22z7ljalbq1x70xn-systemd-232/bin/bootctl', '--path=/boot', 'install']' returned non-zero exit status 1

i think its the efi variable filesystem thats full, not the /boot filesystem
sounds like a firmware problem

I was referring to the RAM-based Nix store used by the Live CD being full, not /boot. The "No space left on device" error can be misleading.

If you suspect the EFI variable storage is full, you can try efi.canTouchEfiVariables = false in your config.

When you installed Arch, did you use GRUB2 as the EFI boot manager or systemd-boot? The later is what NixOS uses.

@emmanuelrosa I used systemd-boot, same as on NixOS.

@johnramsden was there any progress with the setting that emmanuelrosa suggested?

@tokudan No, i'll give it a try when I get the chance.

FYI, I've been running into this problem for some time, and I also think this is a firmware problem. The workaround for me was to run this command whenever I receive the "no space left on device" error:

rm /sys/firmware/efi/efivars/dump-*

If you then try again nixos-install (or nixos-rebuild switch) it should work fine.

BTW, I found the above workaround in the following Arch wiki page: https://wiki.archlinux.org/index.php/Unified_Extensible_Firmware_Interface

Specifically, it says:

If any userspace tool is unable to modify efi variables data, check for existence of /sys/firmware/efi/efivars/dump-* files. If they exist, delete them, reboot and retry again.

Although for me, it isn't necessary to reboot.

Interesting @wizeman, I'll give that a try when I end up doing an install on the computer I was having a problem on. For now I guess I'll close this issue, and update when I end up having time to install NixOS again

@wizeman

[root@nixos:~]# rm /sys/firmware/efi/efivars/dump-*
rm: cannot remove '/sys/firmware/efi/efivars/dump-*': No such file or directory

my steps https://github.com/NixOS/nixpkgs/issues/34508#issuecomment-362846630

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/20-03-uefi-installation-problem-vs-instructions/7783/1

wizeman's command fixed this for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

langston-barrett picture langston-barrett  路  3Comments

chris-martin picture chris-martin  路  3Comments

teto picture teto  路  3Comments

lverns picture lverns  路  3Comments

copumpkin picture copumpkin  路  3Comments