当我启动我的 Ubuntu 20.04 服务器(virtualbox vdi,local dev)时,出现以下错误:
Error: invalid environment block.
press any key to continue....
现在,当我运行更新时,所有内容均可正确安装,但 grub 除外,它会引发此错误:
dpkg: error processing package grub-common (--configure):
installed grub-common package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of grub2-common:
grub2-common depends on grub-common (= 2.04-1ubuntu26.17); however:
Package grub-common is not configured yet.
dpkg: error processing package grub2-common (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of grub-pc-bin:
grub-pc-bin depends on grub-common (= 2.04-1ubuntu26.17); however:
Package grub-common is not configured yet.
dpkg: error processing package grub-pc-bin (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of grub-pc:
grub-pc depends on grub-common (= 2.04-1ubuntu26.17); however:
Package grub-common is not configured yet.
grub-pc depends on grub2-common (= 2.04-1ubuntu26.17); however:
Package grub2-common is not configured yet.
grub-pc depends on grub-pc-bin (= 2.04-1ubuntu26.17); however:
Package grub-pc-bin is not configured yet.
dpkg: error processing package grub-pc (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
Errors were encountered while processing:
grub-common
grub2-common
grub-pc-bin
grub-pc
E: Sub-process /usr/bin/dpkg returned an error code (1)
我尝试过的解决方案
我从系统磁盘启动了服务器并
e2fsck /dev/sda2 -y
按照建议运行错误:环境块无效。按任意键继续(Ubuntu 20.04 ZFS),但没有运气。跑步
sudo dpkg --configure -a && sudo apt --fix-broken install
跑步
dpkg --purge --force-depends grub-common && apt-get -f install
有小费吗?
答案1
似乎有一个损坏的/boot/grub/grubenv
。这种情况的常见原因可能是硬件缺陷、电缆松动或可能在 grub 中关闭电源。
删除文件并运行,sudo grub-editenv list
同时创建一个空文件,并允许您继续。
相关:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1946097
https://sarata.com/manpages/grub-editenv.1.html
答案2
我没有足够的信息,但您可以随时尝试的常见方法是:
sudo dpkg --configure -a
sudo apt --fix-broken install
或这个:
dpkg --purge --force-depends grub-common
apt-get -f install
或者也许只是这个有效:
apt update & apt-upgrade