升级 Ubuntu 18.04 时出现多个 dpkg postinst 脚本和其他错误

升级 Ubuntu 18.04 时出现多个 dpkg postinst 脚本和其他错误

这是apt-get upgrade输出:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  linux-generic linux-headers-generic linux-image-generic
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
6 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
N: Ignoring file '50unattended-upgrades.ucftmp' in directory '/etc/apt/apt.conf.d/' as it has an invalid filename extension
Do you want to continue? [Y/n] y
Setting up grub-pc (2.02-2ubuntu8.2) ...
dpkg: error processing package grub-pc (--configure):
 installed grub-pc package post-installation script subprocess returned error exit status 10
Setting up gdm3 (3.28.2-0ubuntu1.3) ...
dpkg: error processing package gdm3 (--configure):
 installed gdm3 package post-installation script subprocess returned error exit status 10
Setting up unattended-upgrades (1.1ubuntu1.18.04.5) ...
dpkg: error processing package unattended-upgrades (--configure):
 installed unattended-upgrades package post-installation script subprocess returned error exit status 10
Setting up google-chrome-stable (68.0.3440.75-1) ...
update-alternatives: error: cannot scan directory '/var/lib/dpkg/alternatives': No such file or directory
dpkg: error processing package google-chrome-stable (--configure):
 installed google-chrome-stable package post-installation script subprocess returned error exit status 2
No apport report written because MaxReports is reached already
                                                              Setting up console-setup-linux (1.178ubuntu2.3) ...
update-alternatives: error: cannot scan directory '/var/lib/dpkg/alternatives': No such file or directory
dpkg: error processing package console-setup-linux (--configure):
 installed console-setup-linux package post-installation script subprocess returned error exit status 2
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of console-setup:
 console-setup depends on console-setup-linux | console-setup-freebsd | hurd; however:
  Package console-setup-linux is not configured yet.
  Package console-setup-freebsd is not installed.
  Package hurd is not installed.

dpkg: error processing package console-setup (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered while processing:
 grub-pc
 gdm3
 unattended-upgrades
 google-chrome-stable
 console-setup-linux
 console-setup
E: Sub-process /usr/bin/dpkg returned an error code (1)

我该怎么做才能修复它?

答案1

非常简单。正如您收到的错误(例如“Package console-setup-linux 尚未配置”)所暗示的那样,您的应用程序尚未配置。使用以下命令进行配置:

sudo dpkg --configure -a

然后尝试再次升级。如果它给你错误“持有损坏的包裹”输入:

sudo apt -f install

然后运行sudo apt upgrade

注意:apt-get不再需要。您只需键入sudo apt upgrade例如即可完成相同的操作。

相关内容