![升级期间读取 EFI 变量 (SecureBoot) 时出错,grub-efi-amd64-signed 和 shim-signed 更新失败](https://linux22.com/image/930931/%E5%8D%87%E7%BA%A7%E6%9C%9F%E9%97%B4%E8%AF%BB%E5%8F%96%20EFI%20%E5%8F%98%E9%87%8F%20(SecureBoot)%20%E6%97%B6%E5%87%BA%E9%94%99%EF%BC%8Cgrub-efi-amd64-signed%20%E5%92%8C%20shim-signed%20%E6%9B%B4%E6%96%B0%E5%A4%B1%E8%B4%A5.png)
几周前,我使用命令sudo apt update
和在 Ubuntu Server 20.04 LTS 上执行了常规软件更新sudo apt upgrade
。通常,此过程会顺利完成,但这次在设置时冻结了secureboot-db
。按 Crtl+C 停止该软件包的更新后,apt
继续升级并遇到其他一些问题:grub-install
无法安装 x86_64-efi 平台。
经过一番研究,我发现其他人也遇到了同样的问题,并通过取消软件包更新来“解决”了这个问题secureboot-db
(https://askubuntu.com/a/1095718)。下一次更新一切顺利:grub 已更新,我可以重新启动回到 Ubuntu 而没有任何问题。
今天,我需要安装一个新软件包,我觉得在apt upgrade
安装之前先安装一下是个好主意。几分钟后,我看到一个红色的弹出窗口,上面写着:
### Configuring grub-efi-amd64 ###
GRUB failed to install to the following devices: /dev/sda1
Do you want to continue anyway? If you do, your computer may not start up properly.
YES - NO
选择“否”后,系统要求我选择 efi 分区(已选择)并尝试再次安装。几秒钟后,红色弹出窗口再次出现。最后,我按下“是”,升级继续,退出时出现 2 个失败的软件包:grub-efi-amd64-signed
和shim-signed
。
以下是 的完整输出apt upgrade
:
~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
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.142.8+2.04-1ubuntu26.6) ...
od: /sys/firmware/efi/efivars/SecureBoot-8be4df61-93ca-11d2-aa0d-00e098032b8c: read error: Interrupted system call
/usr/share/grub/grub-check-signatures: 22: [: Illegal number:
dpkg: error processing package grub-efi-amd64-signed (--configure):
installed grub-efi-amd64-signed package post-installation script subprocess returned error exit status 255
dpkg: dependency problems prevent processing triggers for shim-signed:
shim-signed depends on grub-efi-amd64-signed | grub-efi-arm64-signed; however:
Package grub-efi-amd64-signed is not configured yet.
Package grub-efi-arm64-signed is not installed.
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)
因此看起来读取 EFI 变量存在问题SecureBoot
。
我应该担心吗?我该如何升级这些软件包而不出现任何错误?我能正常启动吗?
我还没有重新启动我的机器,因为我担心它可能无法重新启动到 Ubuntu。
我读过一些其他帖子和网站,但没有一个解决我遇到的相同问题:
- https://stackoverflow.com/q/53203528
grub-efi-amd64-signed
是关于处理和时出错shim-signed
,但错误消息说“设备上没有剩余空间”。我在读取 EFI 变量时出错。 - 处理时遇到错误:grub-efi-amd64-signed - Ubuntu 20.04.1 LTS升级时也出现错误
grub-efi-amd64-signed
,但等待两周的新更新后问题得到了解决。 - 处理软件包 grub-efi-amd64-signed ubuntu 20.4 时出错似乎存在与我类似的问题,但没有指定任何错误消息。错误退出状态也不同。
- 从 17.10 升级到 18.04 时出现错误(shim-signed 和 grub-efi-amd64-signed)也有类似的问题,但
grub-install
无法添加条目BootOrder
。 - https://wiki.ubuntu.com/UEFI/SecureBoot/Testing概述了 SecureBoot 的工作原理。在该页面的某个地方,有一条注释:“重要的:不正确地更新 secureboot-db 可能会导致所有启用了安全启动的系统无法启动。”。我想知道删除该软件包是否是个好主意。
我相信我的机器上的 SecureBoot 已被禁用,但我无法回去检查它,因为我可能无法回到 Ubuntu。
以下是一些其他命令的输出:
~$ sudo grub-install
Installing for x86_64-efi platform.
grub-install: warning: Cannot read EFI Boot* variables.
grub-install: warning: efivarfs_get_variable: read failed: Interrupted system call.
grub-install: warning: efi_get_variable: ops->get_variable failed: Interrupted system call.
grub-install: error: failed to register the EFI boot entry: Interrupted system call.
~$ sudo update-grub
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-52-generic
Found initrd image: /boot/initrd.img-5.4.0-52-generic
Found linux image: /boot/vmlinuz-5.4.0-51-generic
Found initrd image: /boot/initrd.img-5.4.0-51-generic
/dev/sdb: open failed: No medium found
/dev/sdb: open failed: No medium found
done
~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop0 7:0 0 55.3M 1 loop /snap/core18/1885
loop1 7:1 0 69.2M 1 loop /snap/lxd/18077
loop2 7:2 0 69.2M 1 loop /snap/lxd/18013
loop3 7:3 0 31M 1 loop /snap/snapd/9721
loop5 7:5 0 31M 1 loop /snap/snapd/9607
loop6 7:6 0 55.4M 1 loop /snap/core18/1932
sda 8:0 0 279.5G 0 disk
├─sda1 8:1 0 512M 0 part /boot/efi
└─sda2 8:2 0 279G 0 part /
sr0 11:0 1 1024M 0 rom
任何帮助是极大的赞赏!