grub-install:错误:无法获取“/boot/efi”的规范路径

grub-install:错误:无法获取“/boot/efi”的规范路径
nixos-install
building the configuration in /mnt/etc/nixos/configuration.nix...
copying channel...
installing the boot loader...
setting up /etc...
updating GRUB 2 menu...
mktemp: failed to create directory via template ‘/tmp/os-prober.XXXXXX’: No such file or directory
grub-probe: error: cannot find a GRUB drive for /dev/sdb1.  Check your device.map.
installing the GRUB 2 EFI boot loader into /boot/efi...
Installing for x86_64-efi platform.
/nix/store/j5fn7ksaaxxjq5ljzaa2kirjnygfrd2d-grub-2.02/sbin/grub-install: error: failed to get canonical path of `/boot/efi'.
/nix/store/bj5abk7dpchvp9ajrmcy0px7zip9qpib-install-grub.pl: installation of GRUB EFI into /boot/efi failed

我有以下启动配置:

  # Use the GRUB 2 boot loader.
  boot.loader.grub.enable = true;
  boot.loader.grub.useOSProber = true;
  boot.loader.grub.version = 2;
  boot.loader.grub.efiSupport = true;
  boot.loader.grub.efiInstallAsRemovable = true;
  boot.loader.efi.efiSysMountPoint = "/boot/efi";
  # Define on which hard drive you want to install Grub.
  boot.loader.grub.device = "nodev"; # or "nodev" for efi only
  boot.loader.systemd-boot.enable = true;
  #boot.extraModprobeConfig = "options nouveau noaccel=1 runpm=0 nofbaccel=1 modeset=1";
  #boot.kernelPackages = pkgs.linuxPackages_latest;

可能是什么原因导致此问题?什么是“规范”路径?

答案1

我必须将启动分区安装在.../boot而不是/mnt/boot...

答案2

由于 ESP 分区的指定挂载点是/boot/efi

boot.loader.efi.efiSysMountPoint = "/boot/efi";

它必须安装在下面/mnt,即/mnt/boot/efi在运行时nixos-install(与 相同nixos-rebuild)。该错误failed to get canonical path of '/boot/efi'表明情况并非如此。

一个常见的错误是将 ESP 安装在 中/mnt/boot,您似乎遇到过这个错误。安装 ESP/boot也是错误的方法。

相关内容