files list file for package ‘xxx‘ missing

当使用apt-get install或purge时遇到'fileslistfileforpackage'xxx'missing'错误,可以尝试两种方法解决。方法1是执行sudo apt-get update和sudo apt-get install --reinstall xxx。方法2涉及创建并运行一个修复脚本,清理缓存,重建文件列表。此问题通常影响Ubuntu系统及其衍生机型。
摘要由CSDN通过智能技术生成

错误files list file for package 'xxx' missing; assuming package has no files currently installed的解决方法

apt-get install或apt-get purge时报错“files list file for package 'xxx' missing; assuming package has no files currently installed”,其中xxx是具体的包名。

 

方法1:
sudo apt-get update
sudo apt-get install --reinstall xxx


方法2:
vim fix.sh

输入以下shell脚本:

 

#!/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"

 

运行sh fix.sh

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值