Ubuntu 22.04 Linux内核升级失败求助
Ubuntu 22.04 Linux内核升级失败求助
问题描述
我刚安装了Ubuntu 22.04,几乎什么都做不了。如果我想通过终端安装软件,系统会自动尝试升级内核到
linux-image-5.15.0-56-generic,然后就卡住了。
sudo dpkg --configure -a的输出:dpkg: dependency problems prevent configuration of linux-modules-5.15.0-56-generic: linux-modules-5.15.0-56-generic depends on linux-image-5.15.0-56-generic | linux-image-unsigned-5.15.0-56-generic; however: Package linux-image-5.15.0-56-generic is not installed. Package linux-image-unsigned-5.15.0-56-generic is not installed. dpkg: error processing package linux-modules-5.15.0-56-generic (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: linux-modules-5.15.0-56-generic
apt autoremove的输出(卡在6%):Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: linux-image-5.15.0-56-generic Suggested packages: fdutils linux-doc | linux-source-5.15.0 linux-tools linux-headers-5.15.0-56-generic linux-modules-extra-5.15.0-56-generic The following packages will be REMOVED: linux-headers-5.15.0-43 linux-headers-5.15.0-43-generic linux-image-5.15.0-43-generic linux-modules-5.15.0-43-generic linux-modules-extra-5.15.0-43-generic The following packages will be upgraded: linux-image-5.15.0-56-generic 1 upgraded, 0 newly installed, 5 to remove and 27 not upgraded. 2 not fully installed or removed. Need to get 0 B/11,4 MB of archives. After this operation, 550 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 221817 files and directories currently installed.) Preparing to unpack .../linux-image-5.15.0-56-generic_5.15.0-56.62_amd64.deb ...
解决方案
别慌,我之前也碰到过类似的内核依赖卡壳问题,咱们一步步来解决:
- 终止后台冲突的apt/dpkg进程
有时候之前的安装进程没完全结束,会导致后续操作卡住。先检查并清理这些进程:
# 列出相关进程 ps aux | grep -E 'apt|dpkg' # 杀掉找到的进程(替换<PID>为对应进程号) sudo kill -9 <PID>
如果没找到相关进程,可以直接跳过这步。
- 强制卸载有依赖问题的内核模块包
现在系统里的linux-modules-5.15.0-56-generic因为依赖缺失无法正常配置,咱们先强制把它卸载:
sudo dpkg --remove --force-depends linux-modules-5.15.0-56-generic
- 修复apt依赖并清理缓存
接下来让apt自动修复依赖问题,同时清理掉可能损坏的缓存文件:
sudo apt clean sudo apt autoclean sudo apt --fix-broken install
- 重新完成系统更新
等依赖修复好后,先更新源列表,再尝试完成系统升级:
sudo apt update sudo apt full-upgrade
如果还是出现内核安装卡住的情况,大概率是镜像源的问题。你可以编辑/etc/apt/sources.list文件,把默认源替换成国内更稳定的镜像源(比如国内高校或云服务商的官方镜像),保存后再重新运行上面的更新命令。
- 验证修复结果
最后运行以下命令确认系统状态正常:
sudo dpkg --configure -a sudo apt autoremove --purge
如果没有报错,就说明问题解决了。
备注:内容来源于stack exchange,提问作者Micky Mouse
相关产品推荐
相关产品推荐

