2

我遵循了几个指南 [1,2,3] 但无法使其正常工作。Grub 不会提示我输入密码来解锁磁盘,而是会收到以下提示:

error: no such device: 397411472d225490.
error: unknown filesystem.
Entering rescue mode...
grub rescue>

这些是我的配置文件:

/etc/nixos/configuration.nix:

{ config, pkgs, ... }:

{
  imports =
    [ # Include the results of the hardware scan.
      ./hardware-configuration.nix
    ];

  boot.supportedFilesystems = [ "zfs" ];

  boot.initrd.luks.devices."nixos-root" = {
    device = "/dev/disk/by-uuid/f7b6b840-d3c3-4906-ae32-e33b43dd9c76";
    keyFile = "/root/root.key";
    allowDiscards = true;
  };

  boot.loader = {
    efi = {
      efiSysMountPoint = "/efi";
      canTouchEfiVariables = true;
    };

    grub = {
      enable = true; 
      device = "nodev";
      version = 2;
      efiSupport = true;
      enableCryptodisk = true;
      extraInitrd = "/boot/initrd.keys.gz";
      zfsSupport = true;
    };

  };

  networking.hostName = "lostpuppy";
  networking.hostId = "0261fc86";

...
}

/etc/nixos/hardware-configuration.nix:

{ config, lib, pkgs, ... }:

{
  imports =
    [ <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
    ];

  boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "rtsx_usb_sdmmc" ];
  boot.initrd.kernelModules = [ ];
  boot.kernelModules = [ "kvm-intel" ];
  boot.extraModulePackages = [ ];

  fileSystems."/" =
    { device = "zroot/root/nixos";
      fsType = "zfs";
    };

  fileSystems."/home" =
    { device = "zroot/home";
      fsType = "zfs";
    };

  fileSystems."/efi" =
    { device = "/dev/disk/by-uuid/E7FC-1575";
      fsType = "vfat";
    };

  nix.maxJobs = lib.mkDefault 8;
  powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
}

我希望有一个人可以帮助我!

[1] https://zyradyl.moe/2019/08/04/NixOS-Part1-Basic-Setup/(目前离线)

[2] https://elvishjerricco.github.io/2018/12/06/encrypted-boot-on-zfs-with-nixos.html

[3] https://gist.github.com/ladinu/bfebdd90a5afd45dec811296016b2a3f

4

0 回答 0