尝试清理 /boot 时遇到的主要问题

尝试清理 /boot 时遇到的主要问题

这里是 12.04 LTS,首先让我先给你一个 uname -a 输出

3.2.0-35-generic-pae #55-Ubuntu SMP 2012 年 12 月 5 日星期三 18:04:39 UTC i686 i686 i386 GNU/Linux

所以我的启动分区是 100%。这真是大错特错,所以我想清理它,以便升级这台机器上的 vmware tools。我运行了通常的

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-    9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge

然而,当我尝试这样做时,我不断收到有关未满足依赖关系的问题。

正在读取软件包列表... 完成 正在构建依赖关系树 正在读取状态信息... 完成 您可能需要运行“apt-get -f install”来更正这些问题: 以下软件包具有未满足的依赖关系: linux-generic:依赖:linux-headers-generic(= 3.2.0.37.44),但需要安装 3.2.0.38.46 linux-headers-generic:依赖:linux-headers-3.2.0-38-generic 但不会安装 linux-image-generic:依赖:linux-image-3.2.0-37-generic 但不会安装 linux-image-generic-pae:依赖:linux-image-3.2.0-37-generic-pae 但不会安装 E:未满足的依赖关系。尝试不使用软件包(或指定解决方案)执行“apt-get -f install”。

如果我尝试安装任何东西,当然会因为 /boot 上没有足够的空间而失败。所以我暂时将一些较旧的内核移到了 /tmp。这是我的 /tmp

drwxr-xr-x  2 root root     4096 Jan 14 19:34 hsperfdata_root
-rw-r--r--  1 root root  7906868 May 29  2012 initrd.img-2.6.28-19-server.old.0
-rw-r--r--  1 root root 17083030 Oct 26 10:57 initrd.img-3.2.0-27-generic
-rw-r--r--  1 root root 17096219 Oct 26 11:00 initrd.img-3.2.0-27-generic-pae
-rw-r--r--  1 root root 17085508 Dec 31 08:20 initrd.img-3.2.0-33-generic
-rw-r--r--  1 root root 17099160 Dec 31 08:20 initrd.img-3.2.0-33-generic-pae
-rw-r--r--  1 root root 17091480 Dec 31 08:23 initrd.img-3.2.0-34-generic
drwxr-xr-x 10 root root     4096 Feb 22 11:07 mkinitramfs_LzTuqq
-rw-------  1 root root        0 Feb 22 11:07 mkinitramfs-OL_lNbawL
-rw-------  1 root root  2249889 Jul  6  2012 System.map-3.2.0-27-generic
-rw-------  1 root root  2311276 Jul  6  2012 System.map-3.2.0-27-generic-pae
-rw-------  1 root root  2251905 Oct 18 13:27 System.map-3.2.0-33-generic
-rw-------  1 root root  2313292 Oct 18 13:41 System.map-3.2.0-33-generic-pae
-rw-------  1 root root  2252451 Nov 15 07:04 System.map-3.2.0-34-generic
-rw-------  1 root root  4855808 Jul  6  2012 vmlinuz-3.2.0-27-generic
-rw-------  1 root root  5010688 Jul  6  2012 vmlinuz-3.2.0-27-generic-pae
-rw-------  1 root root  4861280 Oct 18 13:27 vmlinuz-3.2.0-33-generic
-rw-------  1 root root  5015328 Oct 18 13:41 vmlinuz-3.2.0-33-generic-pae
-rw-------  1 root root  4862688 Nov 15 07:04 vmlinuz-3.2.0-34-generic
drwx------  2 root root     4096 Jan 14 19:34 vmware-root

所以现在我尝试使用 aptitude safe-upgrade 来查看它是否能修复内核的问题,它似乎确实安装了 3.2.0-38,但是 3.2.0-37 不在 /boot 中,所以我认为这就是问题所在。

下面是我的启动内容(移动到 /tmp 后使用了 49%,进行 aptitude safe-upgrade 后使用了 %69)。

-rw-r--r-- 1 root root   795776 Jul  6  2012 abi-3.2.0-27-generic
-rw-r--r-- 1 root root   800453 Jul  6  2012 abi-3.2.0-27-generic-pae
-rw-r--r-- 1 root root   797027 Oct 18 13:27 abi-3.2.0-33-generic
-rw-r--r-- 1 root root   801704 Oct 18 13:41 abi-3.2.0-33-generic-pae
-rw-r--r-- 1 root root   797082 Nov 15 07:04 abi-3.2.0-34-generic
-rw-r--r-- 1 root root   797121 Dec  5 13:52 abi-3.2.0-35-generic
-rw-r--r-- 1 root root   801798 Dec  5 14:06 abi-3.2.0-35-generic-pae
-rw-r--r-- 1 root root   797231 Jan  8 17:48 abi-3.2.0-36-generic
-rw-r--r-- 1 root root   801908 Jan  8 18:03 abi-3.2.0-36-generic-pae
-rw-r--r-- 1 root root   797340 Feb 19 08:29 abi-3.2.0-38-generic
-rw-r--r-- 1 root root   802017 Feb 19 08:44 abi-3.2.0-38-generic-pae
-rw-r--r-- 1 root root   147463 Jul  6  2012 config-3.2.0-27-generic
-rw-r--r-- 1 root root   147401 Jul  6  2012 config-3.2.0-27-generic-pae
-rw-r--r-- 1 root root   147497 Oct 18 13:27 config-3.2.0-33-generic
-rw-r--r-- 1 root root   147435 Oct 18 13:41 config-3.2.0-33-generic-pae
-rw-r--r-- 1 root root   147514 Nov 15 07:04 config-3.2.0-34-generic
-rw-r--r-- 1 root root   147514 Dec  5 13:52 config-3.2.0-35-generic
-rw-r--r-- 1 root root   147452 Dec  5 14:06 config-3.2.0-35-generic-pae
-rw-r--r-- 1 root root   147514 Jan  8 17:48 config-3.2.0-36-generic
-rw-r--r-- 1 root root   147452 Jan  8 18:03 config-3.2.0-36-generic-pae
-rw-r--r-- 1 root root   147497 Feb 19 08:29 config-3.2.0-38-generic
-rw-r--r-- 1 root root   147435 Feb 19 08:44 config-3.2.0-38-generic-pae
drwxr-xr-x 3 root root     5120 Feb 22 11:25 grub
-rw-r--r-- 1 root root 17092973 Dec 31 10:09 initrd.img-3.2.0-35-generic
-rw-r--r-- 1 root root 17101417 Dec 31 10:09 initrd.img-3.2.0-35-generic-pae
-rw-r--r-- 1 root root 17093970 Jan 18 06:52 initrd.img-3.2.0-36-generic
-rw-r--r-- 1 root root 17103977 Jan 18 06:52 initrd.img-3.2.0-36-generic-pae
-rw-r--r-- 1 root root 17090717 Feb 22 11:23 initrd.img-3.2.0-38-generic
-rw-r--r-- 1 root root 17098330 Feb 22 11:25 initrd.img-3.2.0-38-generic-pae
drwxr-xr-x 2 root root    12288 Jul  2  2009 lost+found
-rw-r--r-- 1 root root   176764 Nov 27  2011 memtest86+.bin
-rw-r--r-- 1 root root   178944 Nov 27  2011 memtest86+_multiboot.bin
-rw------- 1 root root  2252128 Dec  5 13:52 System.map-3.2.0-35-generic
-rw------- 1 root root  2314162 Dec  5 14:06 System.map-3.2.0-35-generic-pae
-rw------- 1 root root  2252687 Jan  8 17:48 System.map-3.2.0-36-generic
-rw------- 1 root root  2314721 Jan  8 18:03 System.map-3.2.0-36-generic-pae
-rw------- 1 root root  2253664 Feb 19 08:29 System.map-3.2.0-38-generic
-rw------- 1 root root  2315698 Feb 19 08:44 System.map-3.2.0-38-generic-pae
-rw------- 1 root root  4863712 Dec  5 13:52 vmlinuz-3.2.0-35-generic
-rw------- 1 root root  5017984 Dec  5 14:06 vmlinuz-3.2.0-35-generic-pae
-rw------- 1 root root  4864480 Jan  8 17:48 vmlinuz-3.2.0-36-generic
-rw------- 1 root root  5019456 Jan  8 18:03 vmlinuz-3.2.0-36-generic-pae
-rw------- 1 root root  4864128 Feb 19 08:29 vmlinuz-3.2.0-38-generic
-rw------- 1 root root  5018240 Feb 19 08:44 vmlinuz-3.2.0-38-generic-pae

无论我做什么,我都无法以正确的方式清除旧内核。它总是给我一个依赖性错误并建议我尝试 apt-get-f install。好吧,甚至 apt-get -f install 也给我错误。

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
  linux-generic linux-image-generic linux-image-generic-pae
The following packages will be upgraded:
  linux-generic linux-image-generic linux-image-generic-pae
3 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
4 not fully installed or removed.
Need to get 0 B/6,944 B of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.2.0-37-generic; however:
  Package linux-image-3.2.0-37-generic is not installed.
dpkg: error processing linux-image-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency         problems prevent configuration of linux-generic:
 linux-generic depends on linux-image-generic (= 3.2.0.37.44); however:
  Package linux-image-generic is not configured yet.
 linux-generic depends on linux-headers-generic (= 3.2.0.37.44); however:
  Version of linux-headers-generic on system is 3.2.0.38.46.
dpkg: error processing linux-generic (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency     problems prevent configuration of linux-image-generic-pae:
 linux-image-generic-pae depends on linux-image-3.2.0-37-generic-pae; however:
  Package linux-image-3.2.0-37-generic-pae is not installed.
dpkg: error processing linux-image-generic-pae (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              dpkg: dependency     problems prevent configuration of linux-image-server:
 linux-image-server depends on linux-image-generic-pae; however:
  Package linux-image-generic-pae is not configured yet.
dpkg: error processing linux-image-server (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Errors were encountered     while processing:
 linux-image-generic
 linux-generic
 linux-image-generic-pae
 linux-image-server
E: Sub-process /usr/bin/dpkg returned an error code (1)

无论我尝试什么,它都会继续引用那些 liux 图像/内核。

请帮忙!

答案1

首先,您需要满足所有依赖关系,使您的系统处于正常状态。

运行以下命令来执行此操作。

sudo apt-get --reinstall --force-yes install linux-image-3.2.0-37-generic linux-image-generic linux-headers-generic linux-image-3.2.0-37-generic-pae linux-image-generic-pae

小心使用--force-yes。除非您真的需要,否则不要使用该开关,并且在清除时要特别小心,它可能会弄乱您的系统。

一旦您的系统处于正常状态,请在将其直接传送到 apt-get 之前查看该命令将清除什么。

dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

如果要清除列出的软件包,请使用管道重复该命令以sudo apt-get -y purge

相关内容