如何修复由于磁盘空间问题导致的升级、安装失败循环

如何修复由于磁盘空间问题导致的升级、安装失败循环

由于磁盘空间不足,我陷入了升级/安装失败循环,但我不知道哪个驱动器已满。我尝试了 clean、autoclean 和 autoremove,但都无济于事。这是 AWS 上的 Ubuntu。我的 /boot 目录中有一堆内核(列在底部),但我不知道如何清理它们,因为 clean、autoclean、autoremove 不起作用。我df在下面列出了升级、安装和命令输出:

sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 linux-headers-virtual : Depends: linux-headers-3.2.0-59-virtual but it is not installed
 linux-virtual : Depends: linux-image-virtual (= 3.2.0.59.70) but 3.2.0.60.71 is installed
E: Unmet dependencies. Try using -f.

sudo apt-get -f install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
linux-headers-3.2.0-52-virtual libgudev-1.0-0 linux-image-3.2.0-45-virtual
linux-headers-3.2.0-55-virtual linux-headers-3.2.0-40 linux-headers-3.2.0-41 linux-headers-3.2.0-36
linux-headers-3.2.0-37 linux-headers-3.2.0-43 linux-headers-3.2.0-38 linux-headers-3.2.0-44
linux-headers-3.2.0-39 linux-headers-3.2.0-45 linux-headers-3.2.0-51 linux-headers-3.2.0-52
linux-headers-3.2.0-53 linux-headers-3.2.0-48 linux-headers-3.2.0-54 linux-headers-3.2.0-55
linux-headers-3.2.0-56 linux-headers-3.2.0-57 linux-headers-3.2.0-37-virtual
linux-image-3.2.0-53-virtual linux-image-3.2.0-48-virtual linux-image-3.2.0-40-virtual
linux-headers-3.2.0-45-virtual linux-image-3.2.0-56-virtual linux-image-3.2.0-43-virtual
linux-headers-3.2.0-53-virtual linux-headers-3.2.0-48-virtual linux-headers-3.2.0-40-virtual
linux-image-3.2.0-51-virtual linux-headers-3.2.0-56-virtual linux-headers-3.2.0-43-virtual
linux-headers-3.2.0-38-virtual linux-image-3.2.0-54-virtual linux-image-3.2.0-41-virtual
linux-headers-3.2.0-51-virtual linux-image-3.2.0-57-virtual gir1.2-gudev-1.0
linux-image-3.2.0-44-virtual linux-image-3.2.0-39-virtual linux-headers-3.2.0-54-virtual
linux-headers-3.2.0-41-virtual linux-headers-3.2.0-36-virtual linux-image-3.2.0-52-virtual
linux-headers-3.2.0-57-virtual linux-headers-3.2.0-44-virtual linux-headers-3.2.0-39-virtual
linux-image-3.2.0-55-virtual
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
linux-headers-3.2.0-60 linux-headers-3.2.0-60-virtual linux-headers-virtual linux-virtual
The following NEW packages will be installed:
linux-headers-3.2.0-60 linux-headers-3.2.0-60-virtual
The following packages will be upgraded:
linux-headers-virtual linux-virtual
2 upgraded, 2 newly installed, 0 to remove and 41 not upgraded.
3 not fully installed or removed.
Need to get 0 B/12.7 MB of archives.
After this operation, 67.7 MB of additional disk space will be used.
Do you want to continue [Y/n]? y
(Reading database ... 463845 files and directories currently installed.)
Unpacking linux-headers-3.2.0-60 (from .../linux-headers-3.2.0-60_3.2.0-60.91_all.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-headers-3.2.0-60_3.2.0-60.91_all.deb (--unpack):
error creating directory `./usr/src/linux-headers-3.2.0-60/arch/cris/arch-v32/drivers/mach-a3': No space left on device
No apport report written because MaxReports is reached already
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Unpacking linux-headers-3.2.0-60-virtual (from .../linux-headers-3.2.0-60-virtual_3.2.0-60.91_amd64.deb) ...
dpkg: error processing /var/cache/apt/archives/linux-headers-3.2.0-60-virtual_3.2.0-60.91_amd64.deb (--unpack):
unable to create `/usr/src/linux-headers-3.2.0-60-virtual/include/config/regulator/max8952.h.dpkg-new' (while processing `./usr/src/linux-headers-3.2.0-60-virtual/include/config/regulator/max8952.h'): No space left on device
No apport report written because MaxReports is reached already
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
/var/cache/apt/archives/linux-headers-3.2.0-60_3.2.0-60.91_all.deb
/var/cache/apt/archives/linux-headers-3.2.0-60-virtual_3.2.0-60.91_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Filesystem      Size  Used Avail Use% Mounted on
/dev/xvda1      7.9G  6.0G  1.6G  80% /
udev            819M   12K  819M   1% /dev
tmpfs           331M  200K  331M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            827M     0  827M   0% /run/shm
/dev/xvdb       147G  188M  140G   1% /mnt

我的 /boot 目录中有一堆内核,但我不知道如何清理它们:

ls -alst /boot
total 273760
  12 drwxr-xr-x  3 root root   12288 Mar 10 17:58 grub
   4 drwxr-xr-x  3 root root    4096 Mar 10 17:56 .
4504 -rw-r--r--  1 root root 4608695 Mar 10 17:56 initrd.img-3.2.0-60-virtual
   4 drwxr-xr-x 25 root root    4096 Mar 10 17:56 ..
4504 -rw-r--r--  1 root root 4608640 Mar 10 17:54 initrd.img-3.2.0-59-virtual
 780 -rw-r--r--  1 root root  795696 Feb 19 04:51 abi-3.2.0-60-virtual
 140 -rw-r--r--  1 root root  140627 Feb 19 04:51 config-3.2.0-60-virtual
2828 -rw-------  1 root root 2893967 Feb 19 04:51 System.map-3.2.0-60-virtual
4856 -rw-------  1 root root 4969360 Feb 19 04:51 vmlinuz-3.2.0-60-virtual
4504 -rw-r--r--  1 root root 4608261 Jan 15 19:49 initrd.img-3.2.0-58-virtual
 780 -rw-r--r--  1 root root  795704 Jan  7 23:40 abi-3.2.0-59-virtual
 140 -rw-r--r--  1 root root  140644 Jan  7 23:40 config-3.2.0-59-virtual
2828 -rw-------  1 root root 2894157 Jan  7 23:40 System.map-3.2.0-59-virtual
4856 -rw-------  1 root root 4970192 Jan  7 23:40 vmlinuz-3.2.0-59-virtual
4504 -rw-r--r--  1 root root 4608753 Dec  9 23:12 initrd.img-3.2.0-57-virtual
 780 -rw-r--r--  1 root root  795704 Dec  3 18:37 abi-3.2.0-58-virtual
 140 -rw-r--r--  1 root root  140644 Dec  3 18:37 config-3.2.0-58-virtual
2828 -rw-------  1 root root 2894046 Dec  3 18:37 System.map-3.2.0-58-virtual
4852 -rw-------  1 root root 4968208 Dec  3 18:37 vmlinuz-3.2.0-58-virtual
 780 -rw-r--r--  1 root root  795704 Nov 12 22:31 abi-3.2.0-57-virtual
 140 -rw-r--r--  1 root root  140644 Nov 12 22:31 config-3.2.0-57-virtual
2828 -rw-------  1 root root 2893904 Nov 12 22:31 System.map-3.2.0-57-virtual
4852 -rw-------  1 root root 4967472 Nov 12 22:31 vmlinuz-3.2.0-57-virtual
4500 -rw-r--r--  1 root root 4607041 Nov  9 06:42 initrd.img-3.2.0-56-virtual
 780 -rw-r--r--  1 root root  795639 Oct 23 10:30 abi-3.2.0-56-virtual
 140 -rw-r--r--  1 root root  140644 Oct 23 10:30 config-3.2.0-56-virtual
2828 -rw-------  1 root root 2893791 Oct 23 10:30 System.map-3.2.0-56-virtual
4852 -rw-------  1 root root 4966992 Oct 23 10:30 vmlinuz-3.2.0-56-virtual
4500 -rw-r--r--  1 root root 4607180 Oct 22 06:42 initrd.img-3.2.0-55-virtual
4500 -rw-r--r--  1 root root 4606152 Oct 21 06:05 initrd.img-3.2.0-54-virtual
 780 -rw-r--r--  1 root root  795639 Oct  2 13:29 abi-3.2.0-55-virtual
 140 -rw-r--r--  1 root root  140644 Oct  2 13:29 config-3.2.0-55-virtual
2828 -rw-------  1 root root 2893791 Oct  2 13:29 System.map-3.2.0-55-virtual
4852 -rw-------  1 root root 4967440 Oct  2 13:29 vmlinuz-3.2.0-55-virtual
 780 -rw-r--r--  1 root root  795492 Sep 10 21:17 abi-3.2.0-54-virtual
 140 -rw-r--r--  1 root root  140644 Sep 10 21:17 config-3.2.0-54-virtual
2828 -rw-------  1 root root 2893300 Sep 10 21:17 System.map-3.2.0-54-virtual
4852 -rw-------  1 root root 4966256 Sep 10 21:17 vmlinuz-3.2.0-54-virtual
4500 -rw-r--r--  1 root root 4605968 Sep  7  2013 initrd.img-3.2.0-53-virtual
 780 -rw-r--r--  1 root root  795492 Aug 22  2013 abi-3.2.0-53-virtual
 140 -rw-r--r--  1 root root  140644 Aug 22  2013 config-3.2.0-53-virtual
2828 -rw-------  1 root root 2893126 Aug 22  2013 System.map-3.2.0-53-virtual
4852 -rw-------  1 root root 4966064 Aug 22  2013 vmlinuz-3.2.0-53-virtual
4400 -rw-r--r--  1 root root 4502983 Aug 20  2013 initrd.img-3.2.0-52-virtual
4400 -rw-r--r--  1 root root 4503043 Aug  8  2013 initrd.img-3.2.0-51-virtual
 780 -rw-r--r--  1 root root  795318 Jul 26  2013 abi-3.2.0-52-virtual
 140 -rw-r--r--  1 root root  140644 Jul 26  2013 config-3.2.0-52-virtual
2828 -rw-------  1 root root 2892320 Jul 26  2013 System.map-3.2.0-52-virtual
4852 -rw-------  1 root root 4964752 Jul 26  2013 vmlinuz-3.2.0-52-virtual
 780 -rw-r--r--  1 root root  795318 Jul 24  2013 abi-3.2.0-51-virtual
 140 -rw-r--r--  1 root root  140644 Jul 24  2013 config-3.2.0-51-virtual
2828 -rw-------  1 root root 2892320 Jul 24  2013 System.map-3.2.0-51-virtual
4848 -rw-------  1 root root 4964240 Jul 24  2013 vmlinuz-3.2.0-51-virtual
4400 -rw-r--r--  1 root root 4502820 Jul 11  2013 initrd.img-3.2.0-48-virtual
 780 -rw-r--r--  1 root root  795318 Jun  6  2013 abi-3.2.0-48-virtual
 140 -rw-r--r--  1 root root  140637 Jun  6  2013 config-3.2.0-48-virtual
2828 -rw-------  1 root root 2892052 Jun  6  2013 System.map-3.2.0-48-virtual
4848 -rw-------  1 root root 4963440 Jun  6  2013 vmlinuz-3.2.0-48-virtual
4400 -rw-r--r--  1 root root 4501891 May 31  2013 initrd.img-3.2.0-45-virtual
 780 -rw-r--r--  1 root root  795099 May 29  2013 abi-3.2.0-45-virtual
 140 -rw-r--r--  1 root root  140637 May 29  2013 config-3.2.0-45-virtual
2824 -rw-------  1 root root 2890696 May 29  2013 System.map-3.2.0-45-virtual
4848 -rw-------  1 root root 4962320 May 29  2013 vmlinuz-3.2.0-45-virtual
4400 -rw-r--r--  1 root root 4502465 May 25  2013 initrd.img-3.2.0-44-virtual
 780 -rw-r--r--  1 root root  795099 May 16  2013 abi-3.2.0-44-virtual
 140 -rw-r--r--  1 root root  140637 May 16  2013 config-3.2.0-44-virtual
2824 -rw-------  1 root root 2890696 May 16  2013 System.map-3.2.0-44-virtual
4848 -rw-------  1 root root 4962032 May 16  2013 vmlinuz-3.2.0-44-virtual
4400 -rw-r--r--  1 root root 4502610 May 16  2013 initrd.img-3.2.0-43-virtual
 780 -rw-r--r--  1 root root  794949 May 15  2013 abi-3.2.0-43-virtual
 140 -rw-r--r--  1 root root  140637 May 15  2013 config-3.2.0-43-virtual
2824 -rw-------  1 root root 2890123 May 15  2013 System.map-3.2.0-43-virtual
4848 -rw-------  1 root root 4961104 May 15  2013 vmlinuz-3.2.0-43-virtual
4400 -rw-r--r--  1 root root 4502840 May  4  2013 initrd.img-3.2.0-41-virtual
2824 -rw-------  1 root root 2890123 Apr 25  2013 System.map-3.2.0-41-virtual
 780 -rw-r--r--  1 root root  794949 Apr 25  2013 abi-3.2.0-41-virtual
 140 -rw-r--r--  1 root root  140637 Apr 25  2013 config-3.2.0-41-virtual
4848 -rw-------  1 root root 4961584 Apr 25  2013 vmlinuz-3.2.0-41-virtual
4400 -rw-r--r--  1 root root 4503343 Apr 10  2013 initrd.img-3.2.0-40-virtual
4360 -rw-r--r--  1 root root 4461457 Mar 28  2013 initrd.img-3.2.0-39-virtual
 780 -rw-r--r--  1 root root  794886 Mar 25  2013 abi-3.2.0-40-virtual
 140 -rw-r--r--  1 root root  140601 Mar 25  2013 config-3.2.0-40-virtual
2824 -rw-------  1 root root 2889468 Mar 25  2013 System.map-3.2.0-40-virtual
4844 -rw-------  1 root root 4959408 Mar 25  2013 vmlinuz-3.2.0-40-virtual
4356 -rw-r--r--  1 root root 4460205 Mar  1  2013 initrd.img-3.2.0-38-virtual
 776 -rw-r--r--  1 root root  792783 Feb 28  2013 abi-3.2.0-39-virtual
 140 -rw-r--r--  1 root root  140503 Feb 28  2013 config-3.2.0-39-virtual
2820 -rw-------  1 root root 2887126 Feb 28  2013 System.map-3.2.0-39-virtual
4844 -rw-------  1 root root 4956208 Feb 28  2013 vmlinuz-3.2.0-39-virtual
 776 -rw-r--r--  1 root root  792783 Feb 19  2013 abi-3.2.0-38-virtual
 140 -rw-r--r--  1 root root  140503 Feb 19  2013 config-3.2.0-38-virtual
2820 -rw-------  1 root root 2886098 Feb 19  2013 System.map-3.2.0-38-virtual
4840 -rw-------  1 root root 4954288 Feb 19  2013 vmlinuz-3.2.0-38-virtual
4356 -rw-r--r--  1 root root 4460212 Feb 18  2013 initrd.img-3.2.0-37-virtual
4356 -rw-r--r--  1 root root 4460424 Feb 18  2013 initrd.img-3.2.0-36-virtual
 776 -rw-r--r--  1 root root  792720 Jan 24  2013 abi-3.2.0-37-virtual
 140 -rw-r--r--  1 root root  140520 Jan 24  2013 config-3.2.0-37-virtual
2820 -rw-------  1 root root 2884868 Jan 24  2013 System.map-3.2.0-37-virtual
4840 -rw-------  1 root root 4955792 Jan 24  2013 vmlinuz-3.2.0-37-virtual
 776 -rw-r--r--  1 root root  792720 Jan  8  2013 abi-3.2.0-36-virtual
 140 -rw-r--r--  1 root root  140520 Jan  8  2013 config-3.2.0-36-virtual
2820 -rw-------  1 root root 2885084 Jan  8  2013 System.map-3.2.0-36-virtual
4840 -rw-------  1 root root 4955248 Jan  8  2013 vmlinuz-3.2.0-36-virtual
4304 -rw-r--r--  1 root root 4405492 Dec 23  2012 initrd.img-3.2.0-25-virtual
2820 -rw-------  1 root root 2885491 May 24  2012 System.map-3.2.0-25-virtual
 776 -rw-r--r--  1 root root  791085 May 24  2012 abi-3.2.0-25-virtual
 140 -rw-r--r--  1 root root  140422 May 24  2012 config-3.2.0-25-virtual
4840 -rw-------  1 root root 4955600 May 24  2012 vmlinuz-3.2.0-25-virtual
 176 -rw-r--r--  1 root root  176764 Nov 27  2011 memtest86+.bin
 176 -rw-r--r--  1 root root  178944 Nov 27  2011 memtest86+_multiboot.bin

答案1

我通过以下方式解决了这个问题:

  1. sudo dpkg --configure -a
  2. 清理旧内核:sudo apt-get autoremove -f
  3. sudo apt-get update
  4. sudo dpkg --remove linux-server
  5. sudo apt-get install -f
  6. sudo apt-get install linux-server

另请参阅:https://askubuntu.com/a/253115/173701

相关内容