Dpkg:警告:包的文件列表文件' x'缺失;假设包中没有当前安装在Ubuntu 16.04中的文件

时间:2017-03-11 05:17:58

标签: terminal upgrade ubuntu-16.04 dpkg

我正在使用带有lubunut桌面环境的Ubuntu 16.04。当我apt-get upgrade时,我遇到以下问题超过3天。我不知道问题意味着什么以及如何解决。

注意:我尝试升级Linux-header-4.4.66前3天,但显示错误。我已经把它删了。现在,我回到Linux-header-4.4.64,之前工作正常。

Error on sudo apt-get dist-upgrade (only last 15 line of 500+ line error):

dpkg: warning: files list file for package 'libxcb-xkb1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libvorbis-dev:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libavahi-core7:amd64' missing; assuming package has no files currently installed
(Reading database ... 37151 files and directories currently installed.)
Preparing to unpack .../libgtk-3-bin_3.18.9-1ubuntu3.2_amd64.deb ...
Adding 'diversion of /usr/sbin/update-icon-caches to /usr/sbin/update-icon-caches.gtk2 by libgtk-3-bin'
dpkg-divert: error: rename involves overwriting '/usr/sbin/update-icon-caches.gtk2' with
  different file '/usr/sbin/update-icon-caches', not allowed
dpkg: error processing archive /var/cache/apt/archives/libgtk-3-bin_3.18.9-1ubuntu3.2_amd64.deb (--unpack):
 subprocess new pre-installation script returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libgtk-3-bin_3.18.9-1ubuntu3.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

1 个答案:

答案 0 :(得分:2)

我昨晚解决了这个问题。如果你懂中文,你可以read this solution on my blog。我会用我糟糕的英语详细说明。

  • 在您的桌面或任何您想要的地方创建三个文件。

    fix.sh
    txt
    fixit.py
    
  • 在这些文件中添加内容

    1. fix.sh :只是一个空文件。

    2. txt :使用'\ n'将日志复制到此文件中以分隔每一行。就像这样:

      dpkg: warning: files list file for package 'libxcb-xkb1:amd64' missing; assuming package has no files currently installed 
      dpkg: warning: files list file for package 'libvorbis-dev:amd64' missing; assuming package has no files currently installed
      
    3. fixit.py :使用以下内容填充文件。

      #!/usr/bin/env python
          # -*- coding: utf-8 -*-
          __author__ = 'Fitzeng'
          import re
          def main():
              fix = open('fix.sh', 'w+')
              for line in open("txt"):
                  pkg = re.match(re.compile('''dpkg: warning: files list file for package '(.+)' '''), line)
                  if pkg:
                      cmd = "sudo apt-get install --reinstall " + pkg.group(1)
                      fix.write(cmd + '\n')
          if __name__ == "__main__":
              main()
      
  • 执行这些文件。

    chmod 777 *
    python fixit.py
    ./fix.sh
    
好的,问题解决了。实际上,你会发现你可以选择重新安装这些软件包。所以,你可以通过多种方式解决它。