NixOS 20.09 fresh vanilla install: "this GPT partition label contains no BIOS Boot Partition"

I found a similar post from June

It looks like someone had a similar issue in June, before 20.09 existed. I’ve tried to do everything I was able to understand from that post, to no avail.

That’s what turns up when I search for the error on Google. When I search for it on this forum I get a mysterious 500 error.

The error I get

The first time it installed a ton of stuff before giving me this error. If I retry it jumps straight to the error, unless I reboot and start over from scratch.

installing the boot loader...
setting up /etc...
updating GRUB 2 menu...
installing the GRUB 2 boot loader on /dev/sda...
Installing for i386-pc platform.
/nix/store/nkd8zj3mjws9h1n2qv5y0lwshkm23fh6-grub-2.04/sbin/grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
/nix/store/nkd8zj3mjws9h1n2qv5y0lwshkm23fh6-grub-2.04/sbin/grub-install: warning: Embedding is not possible.  GRUB can only be installed in this setup by using blocklists.  However, blocklists are UNRELIABLE and their use is discouraged..
/nix/store/nkd8zj3mjws9h1n2qv5y0lwshkm23fh6-grub-2.04/sbin/grub-install: error: will not proceed with blocklists.
/nix/store/awmamb515bkmqyqpq2gads6lzxfcm5i0-install-grub.pl: installation of GRUB on /dev/sda failed: No such file or directory

I am being extremely unambitious

As far as I can tell, I am following to the letter the 20.09 installation instructions. I’ve customized nothing – installed no apps, changed no options except those related to GRUB, nothing.

I’m using UEFI. It wouldn’t matter if I’ve used BIOS in the past, right? I bought my machine, a Dell Inspiron laptop, in December 2017, so surely it can do UEFI, right?

Here are, verbatim, the commands I issue:

sudo parted /dev/sda -- mklabel gpt
sudo parted /dev/sda -- mkpart primary 512MiB -8GiB
sudo parted /dev/sda -- mkpart primary linux-swap -8GiB 100%
sudo parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB
sudo parted /dev/sda -- set 3 esp on
sudo mkfs.ext4 -L nixos /dev/sda1
sudo mkswap -L swap /dev/sda2
sudo mkfs.fat -F 32 -n boot /dev/sda3
sudo mount /dev/disk/by-label/nixos /mnt
sudo mkdir -p /mnt/boot
sudo mount /dev/disk/by-label/boot /mnt/boot
sudo nixos-generate-config --root /mnt

Here is, minus comments, the configuration.nix file I’m using:

{ config, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
    ];

  boot.loader = {
    systemd-boot.enable = true;
    efi.canTouchEfiVariables = true;
    efi.efiSysMountPoint = "/boot/efi";
    grub = {
      enable = true;
      version = 2;
      efiSupport = true;
      devices = ["/dev/sda"];
    };
  };

  networking.hostName = "jbb-dell";
  networking.wireless.enable = true;

  networking.useDHCP = false;
  networking.interfaces.enp2s0.useDHCP = true;
  networking.interfaces.wlp1s0.useDHCP = true;

  services.xserver.enable = true;
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

  users.users.jeff = {
    uid = 1000;
    isNormalUser = true;
    extraGroups = [
      "docker"
      "wheel"
      "networkmanager"
      "audio"
      "jackaudio"
      "dialout"
      ];
  };

  system.stateVersion = "20.09";
}

First, your config enables both systemd-boot and grub, you only need one.

Second, I think that if you do want grub, you’ll need to have devices = [ "nodev" ];.

This is assuming that you’re on a UEFI system, and booted via UEFI currently (so that efibootmgr can create entries in the system loader).

Aha! Thanks, Cole! Now I’m getting a new boot loader error:

/boot/efi does not exist

My new config is even simpler than before:

{ config, pkgs, ... }:

{
  imports =
    [
      ./hardware-configuration.nix
    ];

  boot.loader = {
    systemd-boot.enable = true;
  };

  networking.hostName = "jbb-dell";
  networking.wireless.enable = true;
  networking.useDHCP = false;
  networking.interfaces.enp2s0.useDHCP = true;
  networking.interfaces.wlp1s0.useDHCP = true;

  system.stateVersion = "20.09";
}

The new error I get is this:

installing the boot loader...
setting up /etc...
Failed to check file system type of "/boot/efi": No such file or directory
Traceback (most recent call last):
  File "/nix/store/42bzcc2l9m0mnkx984y17kbjhmbzi92l-systemd-boot-builder.py", line 258, in <module>
    main()
  File "/nix/store/42bzcc2l9m0mnkx984y17kbjhmbzi92l-systemd-boot-builder.py", line 197, in main
    subprocess.check_call(["/nix/store/3ri1jzc32mdlywwwxpj4lzzc0b1w9awf-systemd-246.4/bin/bootctl", "--path=/boot/efi", "install"])
  File "/nix/store/z65l1jqvxa58zzwwa3bvglb6asj4y8cv-python3-3.8.5/lib/python3.8/subprocess.py", line 364, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/nix/store/3ri1jzc32mdlywwwxpj4lzzc0b1w9awf-systemd-246.4/bin/bootctl', '--path=/boot/efi', 'install']' returned non-zero exit status 1.

I found another post here regarding this same problem, for which the solution involved changing the order of some mkdir and mount operations. But I’m following the NixOS manual verbatim. (The commands I ran this time are unchanged from my first post.)

Should I not use GRUB?

The following passage appears in the manual:

UEFI systems

    You must set the option boot.loader.systemd-boot.enable to true. nixos-generate-config should do this automatically for new configurations when booted in UEFI mode.

That, plus what you’re saying, suggests I shouldn’t use GRUB, doesn’t it?

How would I know whether I booted the installer using GRUB?

You wrote

This is assuming that you’re on a UEFI system, and booted via UEFI currently (so that efibootmgr can create entries in the system loader).

I got no errors that mention efibootmgr; maybe that means UEFI is in fact the way I got here?

What happens if I try using GRUB rather than EFI

My previous comment describes my attempt at using EFI instead of GRUB. I just tried the reverse. installation “worked” but when I booted I got a “no boot device found” error. For that my configuration was this:

{ config, pkgs, ... }:

{
  imports =
    [ 
      ./hardware-configuration.nix
    ];
  boot.loader = {
    grub = {
      enable = true;
      version = 2;
      efiSupport = true;
      devices = ["nodev"]; 
    };
  };

  networking.hostName = "jbb-dell";
  networking.wireless.enable = true;  
  networking.useDHCP = false;
  networking.interfaces.enp2s0.useDHCP = true;
  networking.interfaces.wlp1s0.useDHCP = true;

  services.xserver.enable = true;
  services.xserver.displayManager.sddm.enable = true;
  services.xserver.desktopManager.plasma5.enable = true;

  users.users.jeff = {
    uid = 1000;        
    isNormalUser = true;
    extraGroups = [
      "docker"
      "wheel"          
      "networkmanager" 
      "audio"
      "jackaudio"
      "dialout" 
      ];
  };

  system.stateVersion = "20.09"; 
}

We should probably first establish, for sure, if you are booted with UEFI. If you are, I’d recommend going with systemd-boot, just because it’s easier to get right if you don’t need all of GRUBs features. (Note, GRUB can be used for EFI or traditional BIOS installs! But systemd-boot is only for UEFI boots.)

When you boot the installation media, in your system loader, make sure you choose the option that says EFI, if possible (and avoid boot entries that say Legacy). Once the NixOS ISO is booted, you can check ls /sys/firmware/efi, which will fail if you are booted in BIOS mode.

If you are booting UEFI, and if you choose to use systemd-boot, then yes, you should not also enable Grub. There’s no reason to have two bootloaders, I’m not even quite sure if that’s allowed or what would happen.

Finally, if you’re using UEFI, nixos-install will result in a call to efibootmgr which will tell your system loader about the new UEFI boot loader (systemd-boot).


Now, back to your attempt at systemd-boot… hm. I’m not sure I have a good answer off the top of my head here. The mount commands look good at a glance, you’ve got /boot mounted… The only thing I can wonder is if maybe there’s a chance you missed remounting /boot during your systemd-boot attempt?

One other note, depending on how many things you end up trying, your system loader might wind up with stale entries pointing at … a GRUB binary that may or may not still exist, which could account for an error state/message you my run across. Most system firmwares allow you to remove entries (and then a subsequent nixos-install would re-install it with efibootmgr).

I got it working!

At some point I received a message to the effect of “this doesn’t look like an EFI partition”, so I went with GRUB. For installing GRUB I had been reading the manual wrong – the formatting process is different in that case, among other things requiring no /dev/sda3 partition to be created. Once I fixed that it built with no problems.

In case it helps anyone else, my config is online here.