运行时出现此错误sudo apt-get upgrade
:
Fetched 322 MB in 1min 57s (2,741 kB/s)
Extracting templates from packages: 100%rade
Preconfiguring packages ...
setting xserver-xorg-legacy/xwrapper/allowed_users from configuration file
dpkg: warning: files list file for package 'indicator-printers' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'account-plugin-google' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'ippusbxd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'account-plugin-facebook' missing; assuming package has no files currently installed
dpkg: unrecoverable fatal error, aborting:
files list file for package 'libc-ares2:amd64' is missing final newline
E: Sub-process /usr/bin/dpkg returned an error code (2)
答案1
当某些文件损坏或提供不完整时,可能会发生这种情况。您需要将以下文件(如果存在)至少暂时移至其他位置:
/var/lib/dpkg/info/libc-ares2:amd64.postrm
/var/lib/dpkg/info/libc-ares2:amd64.list
然后运行:
sudo dpkg --configure -a
sudo apt update
sudo apt upgrade
这应该可以解决主要问题。