刚刚完成从 17.10 到 18.04 的更新,似乎无法更新或检索任何新软件包。
以下是我从 sudo apt upgrde 返回的错误:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
gnome-tweak-tool libboost-chrono1.62.0 libboost-program-options1.62.0 libopencv-core3.1 libopencv-imgproc3.1 libsodium18
libtbb2 libva-drm1 libva-wayland1 libva-x11-1 libva1 libx264-148 libx265-130 linux-headers-4.13.0-21
linux-headers-4.13.0-21-generic linux-image-4.13.0-21-generic linux-image-extra-4.13.0-21-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 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 (2.02-2ubuntu8.13) ...
/var/lib/dpkg/info/grub-efi-amd64.config: 13: /etc/default/grub: intel_idle.max_cstate=4: not found
dpkg: error processing package grub-efi-amd64 (--configure):
installed grub-efi-amd64 package post-installation script subprocess returned error exit status 127
Setting up linux-image-4.15.0-51-generic (4.15.0-51.55) ...
dpkg: dependency problems prevent configuration of grub-efi-amd64-signed:
grub-efi-amd64-signed depends on grub-efi-amd64 | grub-pc; however:
Package grub-efi-amd64 is not configured yet.
Package grub-pc is not installed.
dpkg: error processing package grub-efi-amd64-signed (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Setting up friendly-recovery (0.2.38ubuntu1) ...
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 13: /etc/default/grub: intel_idle.max_cstate=4: not found
dpkg: error processing package friendly-recovery (--configure):
installed friendly-recovery package post-installation script subprocess returned error exit status 127
dpkg: dependency problems prevent configuration of 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 unconfigured
No apport report written because MaxReports is reached already
Processing triggers for linux-image-4.15.0-51-generic (4.15.0-51.55) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-51-generic
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
/usr/sbin/grub-mkconfig: 13: /etc/default/grub: intel_idle.max_cstate=4: not found
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-4.15.0-51-generic (--configure):
installed linux-image-4.15.0-51-generic package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
grub-efi-amd64
grub-efi-amd64-signed
friendly-recovery
shim-signed
linux-image-4.15.0-51-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
编辑
输出cat /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
# info -f grub -n 'Simple configuration'
GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="button.lid_init_state=open"
GRUB_CMDLINE_LINUX=""
intel_idle.max_cstate=4
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
答案1
看起来您的/etc/default/grub
配置文件中有一个错误,在下面的这部分(第二段):
GRUB_CMDLINE_LINUX_DEFAULT="button.lid_init_state=open"
GRUB_CMDLINE_LINUX=""
intel_idle.max_cstate=4
该字符串intel_idle.max_cstate=4
应为GRUB_CMDLINE_LINUX_DEFAULT
变量赋值的一部分,即该行后面的引号内=
。由于您将其写在单独的一行中,因此它会被误解为 shell 命令。
修复你的文件,使上面的代码片段如下所示:
GRUB_CMDLINE_LINUX_DEFAULT="button.lid_init_state=open intel_idle.max_cstate=4"
GRUB_CMDLINE_LINUX=""
保存您的更改然后运行sudo update-grub
。
此后,使用 恢复剩余软件包的配置sudo dpkg --configure -a
。