解决dpkg: warning: files list file for package

解决dpkg: warning: files list file for package
apt-get install 安装包时,出现一堆警告;怀疑是之前安装deb包,出现依赖冲突时进行了强行覆盖deb导致的。

警告内容如下(有近两千行警告,依赖缺失问题):

dpkg: warning: files list file for package 'xorg-docs-core' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'wine-gecko2.21:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'wine-gecko2.21:i386' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'fonts-tlwg-sawasdee-ttf' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgcc1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libgcc1:i386' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'gconf-service-backend' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'plainbox-secure-policy' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'gnome-orca' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libreadline6:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'xfonts-base' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'onboard' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libbamf3-2:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-distupgrade' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libxcb-sync-dev:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libwinpr-pool0.1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'gcr' missing; assuming package has no files currently installed
...
...

解决办法,写一个脚本,自动安装修复

step.1 把警告内容全部复制下来,贴到一个文本中命名为 warning.txt
step.2 同在一个文件夹下,写了自动安装的脚本命名为 autoinstall

#!/bin/bash
i=1
for package in $(cat warning.txt | grep "dpkg: warning: files list file for package " | grep -Po "'[^']*'" | sed "s/'//g");
do
  echo "No.${i} ==================start intall ${package}==================="
  apt-get install --reinstall "$package" -y;
  #如果没有安装aptitude, 则可以用apt-get --reinstall "$package";
  i=`expr $i + 1`
done

step.3 给权限 $ sudo chmod 777 autoinstall
step.4 执行脚本 $ sudo ./autoinstall
————————————————
版权声明:本文为CSDN博主「丰色木夕」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/youlinhuanyan/article/details/99575493

packagewarningapt-getreinstallgrep

我来吐槽

*

*