无法执行apt --fix-broken install及系统更新、升级问题求助
无法执行apt --fix-broken install及系统更新、升级问题求助
各位大佬,我遇到个头疼的问题:这几年一直没法更新包或者升级系统。本来以为清理旧内核能解决问题,结果连purge旧内核都做不到,一执行就弹出下面的错误:
Reading package lists... Done Building dependency tree... Done Reading state information... Done You might want to run 'apt --fix-broken install' to correct these. The following packages have unmet dependencies: linux-generic-hwe-22.04 : Depends: linux-image-generic-hwe-22.04 (= 6.2.0.36.37~22.04.14) but 6.2.0.37.38~22.04.15 is installed linux-image-5.15.0-88-generic : Conflicts: linux-image-unsigned-5.15.0-88-generic but 5.15.0-88.98 is installed linux-image-unsigned-5.15.0-88-generic : Conflicts: linux-image-5.15.0-88-generic but 5.15.0-88.98 is installed E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
尝试的解决方案
针对这种内核包依赖冲突的情况,你可以按下面的步骤操作试试:
强制卸载冲突的内核包
先把这两个互相冲突的内核包强制移除,执行以下命令:sudo dpkg --remove --force-all linux-image-5.15.0-88-generic linux-image-unsigned-5.15.0-88-generic修复系统依赖
接着运行系统提示的修复命令,让apt自动处理剩下的依赖问题:sudo apt --fix-broken install清理旧内核并验证
依赖修复完成后,再用常规命令清理冗余的旧内核:sudo apt autoremove --purge最后执行更新和升级命令,确认系统能正常操作:
sudo apt update && sudo apt upgrade
如果上面的步骤还是没解决问题,你可以先备份/var/lib/dpkg/status文件,再手动编辑该文件,删除掉关于这两个冲突内核包的所有条目,之后重新运行apt --fix-broken install试试。
备注:内容来源于stack exchange,提问作者TimonOfAthens




