我已经清除了当前内核!

我已经清除了当前内核!

帮助 - 我已清除当前内核 (linux-image-2.6.32-43-server),但无法重新安装,因为引导扇区已满。如何清除引导扇区以重新安装内核?

$ ls /boot
abi-2.6.32-44-server         initrd.img-3.2.0-39-generic
abi-3.2.0-34-generic         initrd.img-3.2.0-40-generic
abi-3.2.0-35-generic         initrd.img-3.2.0-41-generic
abi-3.2.0-36-generic         lost+found
abi-3.2.0-37-generic         memtest86+.bin
abi-3.2.0-38-generic         memtest86+_multiboot.bin
abi-3.2.0-39-generic         System.map-2.6.32-44-server
abi-3.2.0-40-generic         System.map-3.2.0-34-generic
abi-3.2.0-41-generic         System.map-3.2.0-35-generic
config-2.6.32-44-server      System.map-3.2.0-36-generic
config-3.2.0-34-generic      System.map-3.2.0-37-generic
config-3.2.0-35-generic      System.map-3.2.0-38-generic
config-3.2.0-36-generic      System.map-3.2.0-39-generic
config-3.2.0-37-generic      System.map-3.2.0-40-generic
config-3.2.0-38-generic      System.map-3.2.0-41-generic
config-3.2.0-39-generic      vmcoreinfo-2.6.32-44-server
config-3.2.0-40-generic      vmlinuz-2.6.32-44-server
config-3.2.0-41-generic      vmlinuz-3.2.0-34-generic
grub                         vmlinuz-3.2.0-35-generic
initrd.img-2.6.32-44-server  vmlinuz-3.2.0-36-generic
initrd.img-3.2.0-34-generic  vmlinuz-3.2.0-37-generic
initrd.img-3.2.0-35-generic  vmlinuz-3.2.0-38-generic
initrd.img-3.2.0-36-generic  vmlinuz-3.2.0-39-generic
initrd.img-3.2.0-37-generic  vmlinuz-3.2.0-40-generic
initrd.img-3.2.0-38-generic  vmlinuz-3.2.0-41-generic


$ sudo apt-get purge linux-image-3.2.0-3*
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'linux-image-3.2.0-38-lowlatency' for regex 'linux-image-3.2.0-3*'
Note, selecting 'linux-image-3.2.0-1615-armadaxp' for regex 'linux-image-3.2.0-3*'
[...CUT...]

    Package linux-image-3.2.0-39-lowlatency is not installed, so not removed
    Package linux-image-3.2.0-40-lowlatency is not installed, so not removed
    Package linux-image-3.2.0-41-lowlatency is not installed, so not removed
    You might want to run 'apt-get -f install' to correct these:
    The following packages have unmet dependencies.
    linux-image-server : Depends: linux-image-3.2.0-43-generic but it is not going to be installed
    E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

DPKG输出

$ dpkg-query -l linux-image*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
un  linux-image    <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
un  linux-image-2. <none>         (no description available)
rc  linux-image-2. 2.6.32-34.77   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-35.78   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-36.79   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-37.81   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-38.83   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-39.86   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-40.87   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-41.91   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-42.96   Linux kernel image for version 2.6.32 on x86
rc  linux-image-2. 2.6.32-43.97   Linux kernel image for version 2.6.32 on x86
ii  linux-image-2. 2.6.32-44.98   Linux kernel image for version 2.6.32 on x86
un  linux-image-3. <none>         (no description available)
ii  linux-image-3. 3.2.0-34.53    Linux kernel image for version 3.2.0 on 64 b
ii  linux-image-3. 3.2.0-35.55    Linux kernel image for version 3.2.0 on 64 b
ii  linux-image-3. 3.2.0-36.57    Linux kernel image for version 3.2.0 on 64 b
ii  linux-image-3. 3.2.0-37.58    Linux kernel image for version 3.2.0 on 64 b
ii  linux-image-3. 3.2.0-38.61    Linux kernel image for version 3.2.0 on 64 b
ii  linux-image-3. 3.2.0-39.62    Linux kernel image for version 3.2.0 on 64 b
ii  linux-image-3. 3.2.0-40.64    Linux kernel image for version 3.2.0 on 64 b
ii  linux-image-3. 3.2.0-41.66    Linux kernel image for version 3.2.0 on 64 b
in  linux-image-3. <none>         (no description available)
iU  linux-image-se 3.2.0.43.51    Linux kernel image on Server Equipment.

答案1

我刚刚遇到了同样的问题。唯一有帮助的方法是使用以下命令手动删除 /boot 中的足够文件

cd /boot
rm initrd.img-3.2.0-24-generic-pae initrd.img-3.2.0-29-generic-pae

为了

apt-get -f install

才能正常完成。然后使用

 dpkg --list|grep linux-image

识别 Linux 映像并删除足够多的旧映像,例如

apt-get purge linux-image-3.2.0-24-generic-pae linux-image-3.2.0-29-generic-pae ...

最后可能会有一些额外的空间可以回收

apt-get autoclean
apt-get autoremove

(我从其他答案中得出上述结论 - 这对我有用)

我相信我已经看到 Ubuntu 现在具有一些“清理旧内核”功能,但显然它在这里没有发挥作用。

相关内容