Why don't I have a BIOS Boot Partition?

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

Because… you didn’t create one?

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:

{
  boot.loader.grub.efiSupport = true;
  boot.loader.grub.device = "nodev";
}

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.

If I select “EFI Default Loader”, Grub opens. I don’t really understand what this is;) How can I overwrite this so that I get Grub default?:wink:

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?

Yes;). I have no USB devices attached.

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.

Ok, that didn’t go well;) I guess I just ran nixos-rebuild and not nixos-install.

It wrote these files:

[root@surface2pro:~]# ls /mnt/sda1/
background.png  converted-font.pf2  EFI  grub  kernels

Now it’s stuck in a loop, only showing this screen, no matter how I power it up.

I’m able to boot from USB, so I will try Super GRUB to get back into the system, but what command should I run once I’m back?

I mean, nixos-rebuild should already have run nixos-install, no?.. and that didn’t go so well

I mean, nixos-rebuild should already have run nixos-install, no?.. and that didn’t go so well

Uhm, no, it’s not exactly the same: you need at least to add --install-bootloader.

I did

surface2prob: export HOST=10.0.0.33 && nixos-rebuild boot --fast --flake ~/flake.nix#surface2pro --target-host root@$HOST --build-host root@$HOST --impure --install-bootloader
  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; 

Using this config

I ended up in the same TPM screen

it reports everything fine, but I still end up in the TPM

updating GRUB 2 menu...
installing the GRUB 2 boot loader into /boot/efi...
Installing for x86_64-efi platform.
Installation finished. No error reported.

[root@surface2pro:/boot]# tree
.
├── background.png
├── converted-font.pf2
├── EFI
│   ├── EFI
│   │   └── NixOS-boot-efi
│   │       └── grubx64.efi
│   └── NixOS-boot
│       └── grubx64.efi
├── grub
│   ├── fonts
│   │   └── unicode.pf2
│   ├── grub.cfg
│   ├── grubenv
│   ├── locale
│   │   ├── ast.mo
│   │   ├── ca.mo
│   │   ├── da.mo
│   │   ├── de_CH.mo
│   │   ├── de@hebrew.mo
│   │   ├── de.mo
│   │   ├── en@arabic.mo
│   │   ├── en@cyrillic.mo
│   │   ├── en@greek.mo
│   │   ├── en@hebrew.mo
│   │   ├── en@piglatin.mo
│   │   ├── en@quot.mo
│   │   ├── eo.mo
│   │   ├── es.mo
│   │   ├── fi.mo
│   │   ├── fr.mo
│   │   ├── gl.mo
│   │   ├── hr.mo
│   │   ├── hu.mo
│   │   ├── id.mo
│   │   ├── it.mo
│   │   ├── ja.mo
│   │   ├── ka.mo
│   │   ├── ko.mo
│   │   ├── lg.mo
│   │   ├── lt.mo
│   │   ├── nb.mo
│   │   ├── nl.mo
│   │   ├── pa.mo
│   │   ├── pl.mo
│   │   ├── pt_BR.mo
│   │   ├── pt.mo
│   │   ├── ro.mo
│   │   ├── ru.mo
│   │   ├── sl.mo
│   │   ├── sr.mo
│   │   ├── sv.mo
│   │   ├── tr.mo
│   │   ├── uk.mo
│   │   ├── vi.mo
│   │   ├── zh_CN.mo
│   │   └── zh_TW.mo
│   ├── state
│   └── x86_64-efi
│       ├── acpi.mod
│       ├── adler32.mod
│       ├── affs.mod
│       ├── afs.mod
│       ├── afsplitter.mod
│       ├── ahci.mod
│       ├── all_video.mod
│       ├── aout.mod
│       ├── appleldr.mod
│       ├── archelp.mod
│       ├── ata.mod
│       ├── at_keyboard.mod
│       ├── backtrace.mod
│       ├── bfs.mod
│       ├── bitmap.mod
│       ├── bitmap_scale.mod
│       ├── bli.mod
│       ├── blocklist.mod
│       ├── boot.mod
│       ├── bsd.mod
│       ├── bswap_test.mod
│       ├── btrfs.mod
│       ├── bufio.mod
│       ├── cat.mod
│       ├── cbfs.mod
│       ├── cbls.mod
│       ├── cbmemc.mod
│       ├── cbtable.mod
│       ├── cbtime.mod
│       ├── chain.mod
│       ├── cmdline_cat_test.mod
│       ├── cmp.mod
│       ├── cmp_test.mod
│       ├── command.lst
│       ├── configfile.mod
│       ├── core.efi
│       ├── cpio_be.mod
│       ├── cpio.mod
│       ├── cpuid.mod
│       ├── crc64.mod
│       ├── cryptodisk.mod
│       ├── crypto.lst
│       ├── crypto.mod
│       ├── cs5536.mod
│       ├── ctz_test.mod
│       ├── datehook.mod
│       ├── date.mod
│       ├── datetime.mod
│       ├── diskfilter.mod
│       ├── disk.mod
│       ├── div.mod
│       ├── div_test.mod
│       ├── dm_nv.mod
│       ├── echo.mod
│       ├── efifwsetup.mod
│       ├── efi_gop.mod
│       ├── efinet.mod
│       ├── efitextmode.mod
│       ├── efi_uga.mod
│       ├── ehci.mod
│       ├── elf.mod
│       ├── eval.mod
│       ├── exfat.mod
│       ├── exfctest.mod
│       ├── ext2.mod
│       ├── extcmd.mod
│       ├── f2fs.mod
│       ├── fat.mod
│       ├── file.mod
│       ├── fixvideo.mod
│       ├── font.mod
│       ├── fshelp.mod
│       ├── fs.lst
│       ├── functional_test.mod
│       ├── gcry_arcfour.mod
│       ├── gcry_blowfish.mod
│       ├── gcry_camellia.mod
│       ├── gcry_cast5.mod
│       ├── gcry_crc.mod
│       ├── gcry_des.mod
│       ├── gcry_dsa.mod
│       ├── gcry_idea.mod
│       ├── gcry_md4.mod
│       ├── gcry_md5.mod
│       ├── gcry_rfc2268.mod
│       ├── gcry_rijndael.mod
│       ├── gcry_rmd160.mod
│       ├── gcry_rsa.mod
│       ├── gcry_seed.mod
│       ├── gcry_serpent.mod
│       ├── gcry_sha1.mod
│       ├── gcry_sha256.mod
│       ├── gcry_sha512.mod
│       ├── gcry_tiger.mod
│       ├── gcry_twofish.mod
│       ├── gcry_whirlpool.mod
│       ├── geli.mod
│       ├── gettext.mod
│       ├── gfxmenu.mod
│       ├── gfxterm_background.mod
│       ├── gfxterm_menu.mod
│       ├── gfxterm.mod
│       ├── gptsync.mod
│       ├── grub.efi
│       ├── gzio.mod
│       ├── halt.mod
│       ├── hashsum.mod
│       ├── hdparm.mod
│       ├── hello.mod
│       ├── help.mod
│       ├── hexdump.mod
│       ├── hfs.mod
│       ├── hfspluscomp.mod
│       ├── hfsplus.mod
│       ├── http.mod
│       ├── iorw.mod
│       ├── iso9660.mod
│       ├── jfs.mod
│       ├── jpeg.mod
│       ├── json.mod
│       ├── keylayouts.mod
│       ├── keystatus.mod
│       ├── ldm.mod
│       ├── legacycfg.mod
│       ├── legacy_password_test.mod
│       ├── linux16.mod
│       ├── linux.mod
│       ├── loadbios.mod
│       ├── loadenv.mod
│       ├── loopback.mod
│       ├── lsacpi.mod
│       ├── lsefimmap.mod
│       ├── lsefi.mod
│       ├── lsefisystab.mod
│       ├── lsmmap.mod
│       ├── ls.mod
│       ├── lspci.mod
│       ├── lssal.mod
│       ├── luks2.mod
│       ├── luks.mod
│       ├── lvm.mod
│       ├── lzopio.mod
│       ├── macbless.mod
│       ├── macho.mod
│       ├── mdraid09_be.mod
│       ├── mdraid09.mod
│       ├── mdraid1x.mod
│       ├── memdisk.mod
│       ├── memrw.mod
│       ├── minicmd.mod
│       ├── minix2_be.mod
│       ├── minix2.mod
│       ├── minix3_be.mod
│       ├── minix3.mod
│       ├── minix_be.mod
│       ├── minix.mod
│       ├── mmap.mod
│       ├── moddep.lst
│       ├── modinfo.sh
│       ├── morse.mod
│       ├── mpi.mod
│       ├── msdospart.mod
│       ├── mul_test.mod
│       ├── multiboot2.mod
│       ├── multiboot.mod
│       ├── nativedisk.mod
│       ├── net.mod
│       ├── newc.mod
│       ├── nilfs2.mod
│       ├── normal.mod
│       ├── ntfscomp.mod
│       ├── ntfs.mod
│       ├── odc.mod
│       ├── offsetio.mod
│       ├── ohci.mod
│       ├── part_acorn.mod
│       ├── part_amiga.mod
│       ├── part_apple.mod
│       ├── part_bsd.mod
│       ├── part_dfly.mod
│       ├── part_dvh.mod
│       ├── part_gpt.mod
│       ├── partmap.lst
│       ├── part_msdos.mod
│       ├── part_plan.mod
│       ├── part_sun.mod
│       ├── part_sunpc.mod
│       ├── parttool.lst
│       ├── parttool.mod
│       ├── password.mod
│       ├── password_pbkdf2.mod
│       ├── pata.mod
│       ├── pbkdf2.mod
│       ├── pbkdf2_test.mod
│       ├── pcidump.mod
│       ├── pgp.mod
│       ├── plainmount.mod
│       ├── play.mod
│       ├── png.mod
│       ├── priority_queue.mod
│       ├── probe.mod
│       ├── procfs.mod
│       ├── progress.mod
│       ├── raid5rec.mod
│       ├── raid6rec.mod
│       ├── random.mod
│       ├── rdmsr.mod
│       ├── read.mod
│       ├── reboot.mod
│       ├── regexp.mod
│       ├── reiserfs.mod
│       ├── relocator.mod
│       ├── romfs.mod
│       ├── scsi.mod
│       ├── search_fs_file.mod
│       ├── search_fs_uuid.mod
│       ├── search_label.mod
│       ├── search.mod
│       ├── serial.mod
│       ├── setjmp.mod
│       ├── setjmp_test.mod
│       ├── setpci.mod
│       ├── sfs.mod
│       ├── shift_test.mod
│       ├── signature_test.mod
│       ├── sleep.mod
│       ├── sleep_test.mod
│       ├── smbios.mod
│       ├── spkmodem.mod
│       ├── squash4.mod
│       ├── strtoull_test.mod
│       ├── syslinuxcfg.mod
│       ├── tar.mod
│       ├── terminal.lst
│       ├── terminal.mod
│       ├── terminfo.mod
│       ├── test_blockarg.mod
│       ├── testload.mod
│       ├── test.mod
│       ├── testspeed.mod
│       ├── tftp.mod
│       ├── tga.mod
│       ├── time.mod
│       ├── tpm.mod
│       ├── trig.mod
│       ├── tr.mod
│       ├── true.mod
│       ├── udf.mod
│       ├── ufs1_be.mod
│       ├── ufs1.mod
│       ├── ufs2.mod
│       ├── uhci.mod
│       ├── usb_keyboard.mod
│       ├── usb.mod
│       ├── usbms.mod
│       ├── usbserial_common.mod
│       ├── usbserial_ftdi.mod
│       ├── usbserial_pl2303.mod
│       ├── usbserial_usbdebug.mod
│       ├── usbtest.mod
│       ├── video_bochs.mod
│       ├── video_cirrus.mod
│       ├── video_colors.mod
│       ├── video_fb.mod
│       ├── videoinfo.mod
│       ├── video.lst
│       ├── video.mod
│       ├── videotest_checksum.mod
│       ├── videotest.mod
│       ├── wrmsr.mod
│       ├── xfs.mod
│       ├── xnu.mod
│       ├── xnu_uuid.mod
│       ├── xnu_uuid_test.mod
│       ├── xzio.mod
│       ├── zfscrypt.mod
│       ├── zfsinfo.mod
│       ├── zfs.mod
│       └── zstd.mod
└── kernels
    ├── 3lrpm6rzmajl0g9rak17d49cmk1dywcp-initrd-linux-6.8.12-initrd
    ├── bmyh7a4j9xim7xxc5x1qk1qvlb2y7186-linux-6.6.48-bzImage
    ├── cwy5h9x3v1fcgyk0q676fcqh3aj4i7b0-initrd-linux-6.1.96-initrd
    ├── fd4v1f6awl2r9a3pnqzyw9hdcbfqdpzk-initrd-linux-6.6.48-initrd
    ├── g31kpn6bgn7hkhj5xsj7x6ra8s12ksnb-initrd-linux-6.1.96-initrd
    ├── gal1l09hsgd9nx7h2q0w27gj7i59kqq8-initrd-linux-6.1.96-initrd
    ├── ldkb11f23w2fcssx10mhh6hq6c8x2zg9-linux-6.1.96-bzImage
    ├── nx8jflxgp1xp84lap9fzg4lk0wyqrf3p-linux-6.8.12-bzImage
    └── qzcqjyz9ad3q7qdqb6nmhh74n4n8dc5w-initrd-linux-6.1.96-initrd

10 directories, 338 files

Try replacing boot.loader.efi.canTouchEfiVariables = true; with boot.loader.grub.efiInstallAsRemovable = true;

Nope.

Does not work.

I guess I have to start a new thread, cause we’re kind of nailed it down to something else.

It seems the NixOS installer installs systemd-boot and I can’t get rid of it, no matter what I try.

Thank you, so far;). I’ll ping you in the new thread;)