今天小編在制作鏡像時發現竟然安裝不了基本的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
安裝你想安裝的文档吧。