When I use apt, it will prompt the following information
for example
I tried
But the message still appears
for example
apt install lrzsz
Code:
root@pve:~# apt-get install lrzsz
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
minicom
The following NEW packages will be installed:
lrzsz
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/116 kB of archives.
After this operation, 943 kB of additional disk space will be used.
Selecting previously unselected package lrzsz.
dpkg: warning: files list file for package 'libpve-cluster-api-perl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'corosync' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'runit-helper' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'vncterm' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'openssh-sftp-server' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libvotequorum8:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libzfs2linux' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'librados2-perl' missing; assuming package has no files currently installed
........
dpkg: warning: files list file for package 'libtinfo6:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libpopt0:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libfaketime:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libstdc++-8-dev:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libacl1-dev:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libdrm-amdgpu1:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libtsan0:amd64' missing; assuming package has no files currently installed
(Reading database ... 41747 files and directories currently installed.)
Preparing to unpack .../lrzsz_0.12.21-10_amd64.deb ...
Unpacking lrzsz (0.12.21-10) ...
Setting up lrzsz (0.12.21-10) ...
Processing triggers for man-db (2.8.5-2) ...
Code:
for package in $(apt-get upgrade 2>&1 |\
grep "warning: files list file for package '" |\
grep -Po "[^'\n ]+'" | grep -Po "[^']+"); do
apt-get install --reinstall "$package";
done
Code:
#!/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()
Code:
#!/bin/bash
set -e
# Clean out /var/cache/apt/archives
apt-get clean
# Fill it with all the .debs we need
apt-get --reinstall -dy install $(dpkg --get-selections | grep '[[:space:]]install' | cut -f1)
DIR=$(mktemp -d -t info-XXXXXX)
for deb in /var/cache/apt/archives/*.deb
do
# Move to working directory
cd "$DIR"
# Create DEBIAN directory
mkdir -p DEBIAN
# Extract control files
dpkg-deb -e "$deb"
# Extract file list, fixing up the leading ./ and turning / into /.
dpkg-deb -c "$deb" | awk '{print $NF}' | cut -c2- | sed -e 's/^\/$/\/./' > DEBIAN/list
# Figure out binary package name
DEB=$(basename "$deb" | cut -d_ -f1)
# Copy each control file into place
cd DEBIAN
for file in *
do
cp -a "$file" /var/lib/dpkg/info/"$DEB"."$file"
done
# Clean up
cd ..
rm -rf DEBIAN
done
rmdir "$DIR"