无法准备引导变量:设备上没有剩余空间 grub-install:错误:efibootmgr 无法注册引导条目:输入/输出错误

Shi*_*dan 7 apt

低于错误。但我认为可用空间足够(使用%是 9%)你能帮我们解决这个问题吗?

lab@lab:~$ sudo -E apt-get install subversion apache2-utils
Reading package lists... Done
Building dependency tree
Reading state information... Done
subversion is already the newest version (1.9.7-4ubuntu1).
apache2-utils is already the newest version (2.4.29-1ubuntu4.3).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up grub-efi-amd64-signed (1.93.4+2.02-2ubuntu8.3) ...
Installing for x86_64-efi platform.
Could not prepare Boot variable: No space left on device
grub-install: error: efibootmgr failed to register the boot entry: Input/output error.
dpkg: error processing package grub-efi-amd64-signed (--configure):
installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent processing triggers for shim-signed:
shim-signed depends on grub-efi-amd64-signed; however:
  Package grub-efi-amd64-signed is not configured yet.

dpkg: error processing package shim-signed (--configure):
dependency problems - leaving triggers unprocessed
Errors were encountered while processing:
grub-efi-amd64-signed
shim-signed
E: Sub-process /usr/bin/dpkg returned an error code (1)

lab@lab:~$ df -k .
Filesystem     1K-blocks     Used Available Use% Mounted on
/dev/sda2      479152840 37427836 417315612   9% /
Run Code Online (Sandbox Code Playgroud)

tu-*_*duh 11

有许多报告称,如果 NVRAM 的使用率超过 50%,efibootmgr 将失败,因为担心能够正确地垃圾收集 EFI 变量,或诸如此类。不幸的是,我找不到一种明确的方法来确定 NVRAM 中的已用/可用空间,所以我很怀疑。

对此有许多潜在的解决方案:

  1. 清除转储文件

    grub 存储 efi 登录 /sys/fs/efi/efivars/dump-*

    尝试删除这些以查看是否足以减少已用空间。然后运行apt -f install以查看错误是否已更改。

  2. BIOS升级

    如果您的硬件提供商有 BIOS/EFI 升级,那么我建议也这样做,然后再试apt -f install一次。

  3. 最后的手段 - 禁用 EFI 检查

    这有点危险,因为从技术上讲,您可以将 NVRAM 填充到无法启动的程度。但是,我已在 Dell R420 上成功使用此过程。

    要覆盖检查,请将“efi_no_storage_paranoia”添加到内核选项。去做这个:

    1. 将“efi_no_storage_paranoia”附加到 GRUB_CMDLINE_LINUX_DEFAULT 和 GRUB_CMDLINE_LINUX 变量中 /etc/default/grub
    2. 通过运行更新 grub sudo update-grub
    3. 重启
    4. apt -f install

为了安全起见,我后来也颠倒了这个过程。 内核安全覆盖参数不是你想留下的东西!

  • 在 Debian Stretch 上,它不是 `/sys/fs/efi/` 而是 `/sys/firmware/efi/` (3认同)
  • 在 Ubuntu 18.04 上它也是 `/sys/firmware/efi/` (2认同)