![12.04-服务器更新在完整 /boot 后失败,apt 不起作用,未满足对非现有 linux 映像内核的依赖关系](https://linux22.com/image/1098826/12.04-%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%9B%B4%E6%96%B0%E5%9C%A8%E5%AE%8C%E6%95%B4%20%2Fboot%20%E5%90%8E%E5%A4%B1%E8%B4%A5%EF%BC%8Capt%20%E4%B8%8D%E8%B5%B7%E4%BD%9C%E7%94%A8%EF%BC%8C%E6%9C%AA%E6%BB%A1%E8%B6%B3%E5%AF%B9%E9%9D%9E%E7%8E%B0%E6%9C%89%20linux%20%E6%98%A0%E5%83%8F%E5%86%85%E6%A0%B8%E7%9A%84%E4%BE%9D%E8%B5%96%E5%85%B3%E7%B3%BB.png)
/boot 分区已满后无人值守升级失败。使用推荐的命令删除旧内核以创建磁盘空间
sudo apt-get purge linux-image-x.x.x-x-generic
不起作用并给出以下原因:
The following packages have unmet dependencies:
linux-image-generic : Depends: linux-image-3.2.0-38-generic but it is not going to be installed
linux-image-server : Depends: linux-image-3.2.0-38-generic but it is not going to be installed
linux-server : Depends: linux-headers-server (= 3.2.0.38.46) but 3.2.0.40.48 is to be installed
(我通过 rm 旧内核映像在 /boot 上创建了空间)
针对问题提供的所有建议和解决方案 内核版本不匹配导致 APT 受阻和 https://askubuntu.com/questions/166622/error-sub-process-usr-bin-dpkg-returned-an-error-code-1-while-running-sudo-ap?rq=1 不起作用,给出同样未满足的依赖关系。
server:~$ uname -r
3.2.0-40-generic
所以内核是40版本。
server:~$ sudo dpkg --list 'linux-image*'
||/ Name Version Description
+++-====================-============================================================================
un linux-image <none> (no description available)
un linux-image-3.0 <none> (no description available)
ii linux-image-3.2.0-23 3.2.0-23.36 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-36 3.2.0-36.57 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
ii linux-image-3.2.0-37 3.2.0-37.58 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
un linux-image-3.2.0-38 <none> (no description available)
ii linux-image-3.2.0-40 3.2.0-40.64 Linux kernel image for version 3.2.0 on 64 bit x86 SMP
iU linux-image-generic 3.2.0.38.46 Generic Linux kernel image
iU linux-image-server 3.2.0.38.46 Linux kernel image on Server Equipment.
缺少内核 38,但最后两张图片指的是版本 38
server:~$ sudo apt-cache policy linux-server
linux-server:
Installed: 3.2.0.38.46
Candidate: 3.2.0.40.48
Version table:
3.2.0.40.48 0
500 http://us.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ precise-security/main amd64 Packages
*** 3.2.0.38.46 0
100 /var/lib/dpkg/status
3.2.0.23.25 0
500 http://us.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
现在我很困惑。启动较旧的内核 37 会出现相同的未满足的依赖项。尝试强制安装 38 内核失败:
server:~$ sudo dpkg -i --force-overwrite linux-image-generic_3.2.0.38.46_amd64.deb
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-image-3.2.0-38-generic; however:
Package linux-image-3.2.0-38-generic is not installed.
使用 aptitude 会出现同样的问题:尽管它尝试升级/降级几个软件包来解决未满足的依赖关系。
有人可以帮忙吗?
答案1
我遇到了和你非常类似的问题。我最终使用dpkg
删除linux-server
了linux-image-server
我尝试下载旧版本,但它们不在正常的 apt-get 存储库中,因为它们已被新版本取代。
完成此操作后,我可以通过以下方式重新安装正确的版本apt-get
答案2
使用此命令通过以下方式删除旧内核dpkg
:
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo dpkg -r