我最近真的搞砸了我的 Kali VM。我意外安装了一个软件包(“fontconfig”)。我不知道它是什么,也不知道为什么安装它花了这么长时间。我试图清除它,然后意识到当清除开始时,许多软件包都被删除了。我迅速取消了清除,并做了一个快照。我试图重新启动以确保我的系统仍然稳定,但现在只能启动到黑屏,光标闪烁。
我回滚了快照,并能够在清除后立即恢复到我的状态。我知道由于我犯的错误,一些配置或重要包被删除了。
查看 term.log 时,我看到了最后的条目。检查后发现这些包确实已被删除。
Log started: 2021-04-26 21:50:52
(Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ... 30%^M(Reading database ... 35%^M(Reading database ... 40%
Removing apt-listchanges (3.22) ...^M
Removing kali-desktop-xfce (2020.1.13) ...^M
Removing atril (1.24.0-1) ...^M
Removing binwalk (2.2.0+dfsg1-1) ...^M
Removing bless (0.6.0-7) ...^M
Removing cherrytree (0.39.4-0) ...^M
Removing chromium-driver (81.0.4044.92-1) ...^M
Removing kali-desktop-core (2020.2.21) ...^M
Removing chromium (81.0.4044.92-1) ...^M
Removing commix (3.0-20191111-0kali1) ...^M
Removing crackmapexec (5.0.2~dev-0kali2) ...^M
Removing creddump7 (0.1+git20190429-0kali1) ...^M
Removing crowbar (4.1-0kali1) ...^M
Removing legion (0.3.6b-0kali2) ...^M
Removing cutycapt (0.0~svn10-0.1+b2) ...^M
Removing faraday (3.10.2-0kali1) ...^M
^X^X^X
我尝试通过重新安装/修复 apt 中损坏的软件包来解决问题。但我总是遇到未满足的依赖关系。
我也尝试清除整个 /var/lib/dpkg/status,但这并没有解决问题。
我尝试过的命令:
sudo apt update
sudo apt install -f
sudo apt --fix-borken install
sudo apt upgrade
sudo apt auto-remove
sudo apt-get clean && sudo apt-get update
sudo apt-get autoclean
sudo apt-get clean
apt --fix-broken install
sudo apt --fix-broken install
apt update && apt install -f
sudo apt update && apt install -f
运行上述大多数命令最终都会让我尝试运行 fix-broken,最终会得到您在本文末尾看到的输出。
似乎删除了很多内容。解决这个问题的唯一方法是手动安装所有这些吗?我该如何尝试安装所有这些?当我尝试sudo apt install
第一个包(libpangoft2-1.0-0)时,我也遇到了未满足的依赖关系。
我现在能做什么?
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
gir1.2-pango-1.0 : Depends: libpangoft2-1.0-0 (= 1.44.7-4) but 1.46.2-3 is to be installed
guymager : Depends: libqt5gui5 (>= 5.0.2) but it is not going to be installed or
libqt5gui5-gles (>= 5.0.2) but it is not going to be installed
keditbookmarks : Depends: libqt5gui5 (>= 5.7.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.7.0) but it is not going to be installed
kio : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
kolourpaint : Depends: libqt5gui5 (>= 5.11.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.11.0~) but it is not going to be installed
kwayland-integration : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libdbusmenu-qt5-2 : Depends: libqt5gui5 (>= 5.0.2) but it is not going to be installed or
libqt5gui5-gles (>= 5.0.2) but it is not going to be installed
libkf5auth5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5bookmarks5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5completion5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5configgui5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5configwidgets5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5crash5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5globalaccel-bin : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5globalaccel5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5globalaccelprivate5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5guiaddons5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5iconthemes-bin : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5iconthemes5 : Depends: libqt5gui5 (>= 5.12.2) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.2) but it is not going to be installed
libkf5idletime5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5itemviews5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5jobwidgets5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5kdelibs4support5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5kdelibs4support5-bin : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5kiofilewidgets5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5kiogui5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5kiowidgets5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5notifications5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5parts5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5sane5 : Depends: libqt5gui5 (>= 5.7.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.7.0) but it is not going to be installed
libkf5solid5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5sonnetui5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5textwidgets5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5wallet-bin : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5waylandclient5 : Depends: libqt5gui5 (>= 5.12.2) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.2) but it is not going to be installed
libkf5widgetsaddons5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5windowsystem5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libkf5xmlgui5 : Depends: libqt5gui5 (>= 5.12.0~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.0~) but it is not going to be installed
libpangocairo-1.0-0 : Depends: libpangoft2-1.0-0 (= 1.44.7-4) but 1.46.2-3 is to be installed
libpangoft2-1.0-0 : Depends: libpango-1.0-0 (= 1.46.2-3) but 1.44.7-4 is to be installed
Breaks: libpangoft2-1.0-0:i386 (!= 1.46.2-3) but 1.44.7-4 is to be installed
libpangoft2-1.0-0:i386 : Breaks: libpangoft2-1.0-0 (!= 1.44.7-4) but 1.46.2-3 is to be installed
libpangoxft-1.0-0 : Depends: libpangoft2-1.0-0 (= 1.44.7-4) but 1.46.2-3 is to be installed
libphonon4qt5-4 : Depends: libqt5gui5 (>= 5.7.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.7.0) but it is not going to be installed
libpolkit-qt5-1-1 : Depends: libqt5gui5 (>= 5.1.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.1.0) but it is not going to be installed
libqscintilla2-qt5-15 : Depends: libqt5gui5 (>= 5.6.0~beta) but it is not going to be installed or
libqt5gui5-gles (>= 5.6.0~beta) but it is not going to be installed
libqt5charts5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqt5designer5 : Depends: libqt5gui5 (>= 5.7.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.7.0) but it is not going to be installed
libqt5help5 : Depends: libqt5gui5 (>= 5.0.2) but it is not going to be installed or
libqt5gui5-gles (>= 5.0.2) but it is not going to be installed
libqt5multimedia5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqt5multimedia5-plugins : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqt5multimediagsttools5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqt5multimediawidgets5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqt5opengl5 : Depends: libqt5gui5 (>= 5.1.0) but it is not going to be installed
Depends: libqt5gui5 (>= 5.12.5) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5) but it is not going to be installed
libqt5printsupport5 : Depends: libqt5gui5 (>= 5.11.0~rc1) but it is not going to be installed or
libqt5gui5-gles (>= 5.11.0~rc1) but it is not going to be installed
libqt5quick5 : Depends: libqt5gui5 (>= 5.1.0) but it is not going to be installed
Depends: libqt5gui5 (>= 5.12.5) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5) but it is not going to be installed
libqt5svg5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqt5waylandclient5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqt5waylandcompositor5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqt5webkit5 : Depends: libqt5gui5 (>= 5.9.0~beta) but it is not going to be installed or
libqt5gui5-gles (>= 5.9.0~beta) but it is not going to be installed
libqt5widgets5 : Depends: libqt5gui5 (>= 5.12.5) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5) but it is not going to be installed
libqt5x11extras5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
libqtermwidget5-0 : Depends: libqt5gui5 (>= 5.7.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.7.0) but it is not going to be installed
ophcrack : Depends: libqt5gui5 (>= 5.0.2) but it is not going to be installed or
libqt5gui5-gles (>= 5.0.2) but it is not going to be installed
phonon4qt5-backend-vlc : Depends: libqt5gui5 (>= 5.0.2) but it is not going to be installed or
libqt5gui5-gles (>= 5.0.2) but it is not going to be installed
python3-pyqt5 : Depends: libqt5gui5 (>= 5.1.0) but it is not going to be installed
Depends: libqt5gui5 (>= 5.12.2) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.2) but it is not going to be installed
python3-pyqt5.qtopengl : Depends: libqt5gui5 (>= 5.1.0) but it is not going to be installed
qt5-gtk-platformtheme : Depends: libqt5gui5 (>= 5.10.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.10.0) but it is not going to be installed
qt5-gtk2-platformtheme : Depends: libqt5gui5 (>= 5.10.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.10.0) but it is not going to be installed
qt5-style-plugin-cleanlooks : Depends: libqt5gui5 (>= 5.2.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.2.0) but it is not going to be installed
qt5-style-plugin-motif : Depends: libqt5gui5 (>= 5.3.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.3.0) but it is not going to be installed
qt5-style-plugin-plastique : Depends: libqt5gui5 (>= 5.2.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.2.0) but it is not going to be installed
qterminal : Depends: libqt5gui5 (>= 5.7.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.7.0) but it is not going to be installed
qtwayland5 : Depends: libqt5gui5 (>= 5.12.5+dfsg~) but it is not going to be installed or
libqt5gui5-gles (>= 5.12.5+dfsg~) but it is not going to be installed
sqlitebrowser : Depends: libqt5gui5 (>= 5.3.0) but it is not going to be installed or
libqt5gui5-gles (>= 5.3.0) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
答案1
运行以下命令:
sudo apt-get update && sudo apt-get autoclean && sudo apt-get clean && sudo apt-get autoremove
这可以清除大部分错误。
完成后,重新启动并运行 sudo apt-get update,然后运行 sudo apt-get upgrade。
如果这不起作用,你很可能需要重新安装 Kali。最好的方法是制作一台新机器并将所有数据复制到它上面。
后续说明: 我将我的所有虚拟机在另一台计算机上备份,以便在需要时可以检索一台可以正常运行的机器。
答案2
没有办法轻松修复此问题。幸运的是,我有 12 月的快照。我可以先 scp 进入系统并备份我需要的内容,然后回滚到 12 月的快照并修复从现在到那时的所有增量。
带上后援人员。还请阅读文档。吸取教训。