今天小编在制作镜像时发现竟然安装不了基本的linux命令,例如ps等,报类似以下的错误
libncurses6 : Depends: libtinfo6 (= 6.2+20201114-2+deb11u1) but 6.4-4 is to be installed
重新安装libtinfo6的指令也没用
apt-get --reinstall install libtinfo6 Reinstallation of libtinfo6 is not possible, it cannot be downloaded.
或者提示各种依赖错误
Reading package lists... Done Building dependency tree... Done Reading state information... Done Some packages could not be installed. This may mean that you have requested an impossible situation or if you are using the unstable distribution that some required packages have not yet been created or been moved out of Incoming. The following information may help to resolve the situation: The following packages have unmet dependencies: bash : PreDepends: libtinfo6 (>= 6) but it is not going to be installed ncurses-bin : PreDepends: libtinfo6 (>= 6.3) but it is not going to be installed util-linux : PreDepends: libtinfo6 (>= 6) but it is not going to be installed Recommends: sensible-utils but it is not going to be installed E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
网上有说换回官方的源就ok了,这确实是一个万能方法,可是网络实在太差呀。安装一个包要等半天。最后一查,原来是镜像源没有对应正确的系统版本,版本搞错了。
比如你用的是debian11,却用的debian10的镜像源,就会报这个错误。
修改镜像源的方法, 编辑一下sources.list文件:
vi /etc/apt/sources.list deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
之后更新一下文件列表就可以了
apt-get update
安装你想安装的文件吧。