I’m a bit confused, cause I’ve done this a few times now;)
I’ve installed NixOS on a Surface 2 Pro and I’m trying to run nixos-rebuild, but I get this:
updating GRUB 2 menu...
installing the GRUB 2 boot loader on /dev/disk/by-id/ata-LITEONIT_LMT-19nmBGA-64G-DS_002336138399...
Installing for i386-pc platform.
/nix/store/2bmssmvfgy3vjs4hx1g1psm0zfhh719h-grub-2.12-rc1/sbin/grub-install: warning: this GPT partition label contains no BIOS Boot Partition; embedding won't be possible.
/nix/store/2bmssmvfgy3vjs4hx1g1psm0zfhh719h-grub-2.12-rc1/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/2bmssmvfgy3vjs4hx1g1psm0zfhh719h-grub-2.12-rc1/sbin/grub-install: error: will not proceed with blocklists.
/nix/store/llkj95cm704dgxj9qcxa1rd3crafdk1n-install-grub.pl: installation of GRUB on /dev/disk/by-id/ata-LITEONIT_LMT-19nmBGA-64G-DS_002336138399 failed: Inappropriate ioctl for device
Shared connection to 10.0.0.33 closed.
warning: error(s) occurred while switching to the new configuration
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/disk/by-id/ata-LITEONIT_LMT-19nmBGA-64G-DS_002336138399";
content = {
type = "gpt";
partitions = [
{ # BIOS Boot Partition
size = "1M";
type = "21686148-6449-6E6F-744E-656564454649";
content = {
type = "raw";
file = "${pkgs.grub2_full}/boot/grub_x86_64_hybrid.img";
};
}
{
name = "ESP";
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
}
{
name = "root";
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
}
];
};
};
};
};
}
# fdisk -l
Disk /dev/sda: 59,63 GiB, 64023257088 bytes, 125045424 sectors
Disk model: LITEONIT LMT-19n
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: BF9F77DC-FA05-4E74-A357-98C7E8FBAF84
Device Start End Sectors Size Type
/dev/sda1 4096 1052671 1048576 512M EFI System
/dev/sda2 1052672 125033828 123981157 59,1G Linux filesystem
If you’re booting in BIOS mode with a GPT partitioning scheme, you have to create a MBR protective partition at the start of the disk. You could technically go without one, but not if you’re using GRUB 2: it needs that extra space to embed itself in the disk.
For EFI you must create an EFI system partition (ESP) formatted with a vfat filesystem, which is where the bootloader and kernels will be installed.
Ah, you do have an ESP. In that case it looks like you’re trying to boot in EFI mode but didn’t configure GRUB for EFI, make sure you have these in your configuration:
ok, I had actually done that step, but I had to select “EFI Default Loader” in this menu on boot, or else it would just load the installation done by NixOS installer.
That screenshot is showing the systemd-boot UI. Unless you’re dual-booting NixOS with another distro, it looks like you’re still loading the installer bootloader. Did you remove the installer media?
If so, you probably have two bootloaders installed, for some reason.
Maybe you started by installing systemd-boot, then switched to GRUB and some files were not removed correctly.
Anyway, I would clear the EFI system partition and re-run nixos-install.
boot.loader.grub = {
# no need to set devices, disko will add all devices that have an EF02 partition to the list already
device = "nodev";
efiSupport = true;
#efiInstallAsRemovable = true;
};
boot.loader.systemd-boot.enable = false;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
boot.loader.grub.configurationLimit = 50;
boot.loader.timeout = 10;