Grub error unknown filesystem


A few days ago my nixos grub install all of a sudden started giving the error “unknown filesystem” and dropping into a rescue shell, rendering my nixos install unable to boot. Today I started troubleshooting it via chroot but reinstalling gave the same error but this time when installing grub. Instead of troubleshooting further I decided to completely reinstall my system as it would just be easier, or so I thought.

When reinstalling I get the exact same error when running nixos-install. I have mounted my esp on /mnt/boot as the manual says with /mnt being a btrfs subvolume for my root system and /mnt/home being another subvolume. All mounts are displayed with their correct filesystem type when running the mount command. However the grub install part gives the error error: unknown filesystem. Followed by Installation of GRUB EFI into /boot failed: No such file or directory. I know /mnt/boot is correctly mounted as I can see its contents however when I run grub-probe /mnt/boot I get the same error: unknown filesystem. My esp is a FAT32 partition with the esp flag set and it used to work just fine, I have not made any changes to my partition layout. How can I get grub to install?

Sounds like a failing flash drive? 1. Backup anything important from your other partitions now, 2. Have you tried writing a file to /boot to see if that reproduces the error?

Just tried writing to it and it doesn’t seem to be failing, test file persisted across reboot. Crystaldiskinfo gives a good health as well so that doesn’t seem to be it. It’s a 2 month old laptop as well so I wouldn’t expect the ssd to fail so quickly

What is in your hardware-configuration.nix? And does it match up with what you expect from lsblk?

This is my 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, modulesPath, ... }:

  imports =
    [ (modulesPath + "/installer/scan/not-detected.nix")

  boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "/dev/disk/by-uuid/266f666b-6892-4d79-bb9a-4c6b5ee42e7d";
      fsType = "btrfs";
      options = [ "subvol=@nixos" ];

  fileSystems."/home" =
    { device = "/dev/disk/by-uuid/266f666b-6892-4d79-bb9a-4c6b5ee42e7d";
      fsType = "btrfs";
      options = [ "subvol=@home" ];

  fileSystems."/boot" =
    { device = "/dev/disk/by-uuid/9835-FD28";
      fsType = "vfat";

  swapDevices = [ ];

  # Enables DHCP on each ethernet and wireless interface. In case of scripted networking
  # (the default) this is the recommended approach. When using systemd-networkd it's
  # still possible to use this option, but it's recommended to use it in conjunction
  # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
  networking.useDHCP = lib.mkDefault true;
  # networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;

  nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; = lib.mkDefault config.hardware.enableRedistributableFirmware;

It is in line with what I would expect from my lsblk output:

NAME        FSTYPE    FSVER LABEL       UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
loop0       squashfs  4.0                                                          0   100% /nix/.ro-store
└─sda1      vfat      FAT32 NIXOS-GNOME 1F10-103C                              57.5G     4% /iso
├─nvme0n1p1 vfat      FAT32 ESP         9835-FD28                             106.2M    55% /mnt/boot
├─nvme0n1p3 BitLocker 2                                                                     
├─nvme0n1p4 ntfs            WINRETOOLS  C6D8C545D8C53489                                    
├─nvme0n1p5 ntfs            Image       7234C5A234C569A5                                    
├─nvme0n1p6 ntfs            DELLSUPPORT 8EC85C81C85C698B                                    
└─nvme0n1p7 btrfs                       266f666b-6892-4d79-bb9a-4c6b5ee42e7d  212.7G    13% /mnt/home

I can view the contents of /mnt/boot just fine, it’s just the grub install and grub-probe command that give errors.