zoukankan      html  css  js  c++  java
  • ubuntu apt-get 遇到的问题

    装软件的时候总是提示dpkg: warning: files list file for package `*****' missing, assuming package has no files currently installed,导致无法安装任何软件,结果百度+Google了好多教程,最后找到的解决办法如下:
    (亏得没有轻信别人只能重装系统来解决)
      
    #!/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"
     
     
    原理是重新下载所有安装过的软件包,然后从中提取文件列表信息复制到info文件夹里。(所以请在网速较好的时候使用)
  • 相关阅读:
    引用传递函数值
    关于引用(python中的伪指针)的理解
    学生管理系统_排序后通过name删除列表里的字典
    学生管理系统(函数版)
    全局变量和局部变量的理解
    lambda隐藏函数的嵌套
    lambda函数常见用法
    函数的多个返回值
    函数的函数名重名
    函数的嵌套
  • 原文地址:https://www.cnblogs.com/chris-cp/p/4201779.html
Copyright © 2011-2022 走看看