DPKG:由于触发文件中的语法错误,无法升级

DPKG:由于触发文件中的语法错误,无法升级

我刚刚尝试升级/更新,但由于未满足依赖关系,我遇到了一些问题:

anonymous@anonymous:~$ sudo apt-get upgrade 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 bind9-host : Depends: libbind9-160 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
              Depends: libdns1100 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
              Depends: libisc169 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
              Depends: libisccfg160 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
              Depends: liblwres160 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
 dnsutils : Depends: libbind9-160 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
            Depends: libdns1100 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
            Depends: libisc169 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
            Depends: libisccfg160 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
            Depends: liblwres160 (= 1:9.11.3+dfsg-1ubuntu1.1) but 1:9.11.3+dfsg-1ubuntu1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

因此 bind9 存在一些问题,具体取决于版本 1.1,但我安装了 1.0。因此我尝试修复:

anonymous@anonymous:~$ sudo apt-get  --fix-broken install 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:

# 不再需要一堆软件包

Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libbind9-160 libdns1100 libirs160 libisc169 libisccc160 libisccfg160 liblwres160
The following packages will be upgraded:
  libbind9-160 libdns1100 libirs160 libisc169 libisccc160 libisccfg160 liblwres160
7 upgraded, 0 newly installed, 0 to remove and 251 not upgraded.
27 not fully installed or removed.
Need to get 0 B/1,349 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
dpkg: error: syntax error in file triggers file '/var/lib/dpkg/triggers/File'
E: Sub-process /usr/bin/dpkg returned an error code (2)

嗯……所以不太有用。如果我尝试自动删除,我会收到第一条错误消息。这是 dpkg 提到的触发文件的内容:

  GNU nano 2.9.3                 /var/lib/dpkg/triggers/File                           

/.
/etc
/etc/gnome
/etc/gnome/defaults.list
/usr
/usr/bin
/usr/bin/desktop-file-install
/usr/bin/desktop-file-validate
/usr/bin/update-desktop-database
/usr/share
/usr/share/applications
/usr/share/doc
/usr/share/doc/desktop-file-utils
/usr/share/doc/desktop-file-utils/NEWS.gz
/usr/share/doc/desktop-file-utils/README
/usr/share/doc/desktop-file-utils/changelog.Debian.gz
/usr/share/doc/desktop-file-utils/copyright
/usr/share/emacs
/usr/share/emacs/site-lisp
/usr/share/emacs/site-lisp/desktop-entry-mode.el
/usr/share/lintian
/usr/share/lintian/overrides
/usr/share/lintian/overrides/desktop-file-utils
/usr/share/man
/usr/share/man/man1
/usr/share/man/man1/desktop-file-install.1.gz
/usr/share/man/man1/desktop-file-validate.1.gz
/usr/share/man/man1/update-desktop-database.1.gz
/usr/bin/desktop-file-edit
/usr/share/applications/defaults.list
/usr/share/man/man1/desktop-file-edit.1.gz

答案1

一个选项:我重命名了有问题的触发文件(这样 dpkg 就找不到它了)。然后我重新运行了升级、自动删除等。

这似乎奏效了,因为我可以继续升级。但是我仍然想知道我的触发文件应该是什么样的,以及如何/是否可以以某种方式恢复它...

答案2

验证您的 sources.list 中是否仍然有 security.ubuntu.com 行

deb http://security.ubuntu.com/ubuntu bionic-security main restricted
deb http://security.ubuntu.com/ubuntu bionic-security universe
deb http://security.ubuntu.com/ubuntu bionic-security multiverse

bind9 的安全更新为 1:9.11.3+dfsg-1ubuntu1.1,但只能通过 security.ubuntu.com 获取。我发现我的存储库被一个或另一个脚本禁用了。

相关内容