我在内核版本 5.11.0-22-generic 上运行 Ubuntu 21.04。今天它自动更新了我的 NVIDIA 驱动程序,从那时起,当sudo apt upgrade
我得到:
$ sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
amd64-microcode intel-microcode iucode-tool linux-headers-generic-hwe-20.04 thermald
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
linux-image-5.11.0-25-generic
Suggested packages:
fdutils linux-doc | linux-source-5.11.0 linux-tools
linux-modules-extra-5.11.0-25-generic
The following packages will be REMOVED:
linux-image-unsigned-5.11.0-25-generic
The following NEW packages will be installed:
linux-image-5.11.0-25-generic
0 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
2 not fully installed or removed.
Need to get 0 B/11,4 MB of archives.
After this operation, 234 kB disk space will be freed.
Do you want to continue? [Y/n] y
dpkg: linux-image-unsigned-5.11.0-25-generic: dependency problems, but removing
anyway as you requested:
linux-modules-5.11.0-25-generic depends on linux-image-5.11.0-25-generic | linu
x-image-unsigned-5.11.0-25-generic; however:
Package linux-image-5.11.0-25-generic is not installed.
Package linux-image-unsigned-5.11.0-25-generic is to be removed.
(Reading database ... 285850 files and directories currently installed.)
Removing linux-image-unsigned-5.11.0-25-generic (5.11.0-25.27) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.11.0-25-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
/etc/grub.d/00_header: 451: Syntax error: Unterminated quoted string
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 2
dpkg: error processing package linux-image-unsigned-5.11.0-25-generic (--remove):
installed linux-image-unsigned-5.11.0-25-generic package post-removal script su
bprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
linux-image-unsigned-5.11.0-25-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
您必须修复第 42 行内的引文。
使用下面的一行代码:
sudo sed -i 's|GRUB_GFXPAYLOAD}" = "x |GRUB_GFXPAYLOAD}" = "x" |' /etc/grub.d/00_header
然后sudo update-grub
再次运行。