Dpkg: warning: files list file for package 'x&

2019-08-02 09:18发布

I am using Ubuntu 16.04 with lubunut desktop environment. I had the following problem for more than 3 days when I do apt-get upgrade. I don't know what is problem means and how to solve.

Note: 3 days before I try upgrade Linux-header-4.4.66, but it showed an error. I deleted it. Now, I'm back to Linux-header-4.4.64, which worked fine before.

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条回答
闹够了就滚
2楼-- · 2019-08-02 10:01

I solved this problem at last night. If you know Chinese, you can read this solution on my blog. I'll detail it here with my poor English.

  • Create three files in you desktop or anywhere you want.

    fix.sh
    txt
    fixit.py
    
  • Add contents in these files

    1. fix.sh: Just an Empty file.

    2. txt: Copy your log into this file with '\n' to separate each line. Just like this:

      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: fill the file with the following contents.

      #!/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()
      
  • Execute these file.

    chmod 777 *
    python fixit.py
    ./fix.sh
    

OK, problem solved. Actually, you'll find you could alternately just reinstall these packages. So, you can fix it in many ways.

查看更多
登录 后发表回答