dpkg 问题

dpkg 问题

我正在尝试下载 gparted,但它无法正常工作。我收到以下错误代码:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
gparted is already the newest version (1.0.0-0.1build1).
0 upgraded, 0 newly installed, 0 to remove and 21 not upgraded.
4 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 nvidia-dkms-510 (510.54-0ubuntu0.20.04.1) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Loading new nvidia-510.54 DKMS files...
Building for 5.13.0-30-generic
Building for architecture x86_64
Building initial module for 5.13.0-30-generic
Done.

nvidia.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.13.0-30-generic/updates/dkms/

nvidia-modeset.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.13.0-30-generic/updates/dkms/

nvidia-drm.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.13.0-30-generic/updates/dkms/

nvidia-uvm.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.13.0-30-generic/updates/dkms/

nvidia-peermem.ko:
Running module version sanity check.
 - Original module
   - No original module exists within this kernel
 - Installation
   - Installing to /lib/modules/5.13.0-30-generic/updates/dkms/

depmod...

DKMS: install completed.
Setting up nvidia-driver-510 (510.54-0ubuntu0.20.04.1) ...
Setting up ubuntu-advantage-tools (27.6~20.04.1) ...
/var/lib/dpkg/info/ubuntu-advantage-tools.postinst: 309: Syntax error: "}" unexp
ected (expecting "fi")
dpkg: error processing package ubuntu-advantage-tools (--configure):
 installed ubuntu-advantage-tools package post-installation script subprocess re
turned error exit status 2
No apport report written because the error message indicates its a followup erro
r from a previous failure.
                          dpkg: dependency problems prevent configuration of upd
ate-manager-core:
 update-manager-core depends on ubuntu-advantage-tools; however:
  Package ubuntu-advantage-tools is not configured yet.

dpkg: error processing package update-manager-core (--configure):
 dependency problems - leaving unconfigured
Processing triggers for initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: Generating /boot/initrd.img-5.13.0-30-generic
Errors were encountered while processing:
 ubuntu-advantage-tools
 update-manager-core
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

似乎 postinstall 脚本已损坏。使用以下命令删除它

sudo rm /var/lib/dpkg/info/ubuntu-advantage-tools.postinst

然后恢复包安装

sudo apt-get update
sudo apt-get install -f
sudo dpkg --configure -a
sudo apt-get install --reinstall ubuntu-advantage-tools update-manager-core
sudo apt-get upgrade

相关内容