清理 /boot 上的空间

清理 /boot 上的空间

好的,我已经尝试了每个论坛建议的所有典型方法。以下是我的 /boot 内容:

$ ls /boot
abi-4.4.0-101-generic     config-4.4.0-98-generic       System.map-4.4.0-104-generic
abi-4.4.0-103-generic     grub                          System.map-4.4.0-89-generic
abi-4.4.0-104-generic     initrd.img-4.4.0-101-generic  System.map-4.4.0-92-generic
abi-4.4.0-89-generic      initrd.img-4.4.0-103-generic  System.map-4.4.0-93-generic
abi-4.4.0-92-generic      initrd.img-4.4.0-104-generic  System.map-4.4.0-96-generic
abi-4.4.0-93-generic      initrd.img-4.4.0-89-generic   System.map-4.4.0-97-generic
abi-4.4.0-96-generic      initrd.img-4.4.0-92-generic   System.map-4.4.0-98-generic
abi-4.4.0-97-generic      initrd.img-4.4.0-93-generic   vmlinuz-4.4.0-101-generic
abi-4.4.0-98-generic      initrd.img-4.4.0-96-generic   vmlinuz-4.4.0-103-generic
config-4.4.0-101-generic  initrd.img-4.4.0-97-generic   vmlinuz-4.4.0-104-generic
config-4.4.0-103-generic  initrd.img-4.4.0-98-generic   vmlinuz-4.4.0-89-generic
config-4.4.0-104-generic  lost+found                    vmlinuz-4.4.0-92-generic
config-4.4.0-89-generic   memtest86+.bin                vmlinuz-4.4.0-93-generic
config-4.4.0-92-generic   memtest86+.elf                vmlinuz-4.4.0-96-generic
config-4.4.0-93-generic   memtest86+_multiboot.bin      vmlinuz-4.4.0-97-generic
config-4.4.0-96-generic   System.map-4.4.0-101-generic  vmlinuz-4.4.0-98-generic
config-4.4.0-97-generic   System.map-4.4.0-103-generic

我试过了:

$ sudo apt-get autoremove
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-image-extra-4.4.0-109-generic : Depends: linux-image-4.4.0-109-generic but it is not installed
 linux-image-extra-4.4.0-128-generic : Depends: linux-image-4.4.0-128-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-128-generic but it is not 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:
  fonts-lato libllvm3.8 linux-headers-4.4.0-101 linux-headers-4.4.0-101-generic
  linux-headers-4.4.0-109 linux-headers-4.4.0-109-generic linux-headers-4.4.0-89
  linux-headers-4.4.0-89-generic linux-headers-4.4.0-92 linux-headers-4.4.0-92-generic
  linux-headers-4.4.0-93 linux-headers-4.4.0-93-generic linux-headers-4.4.0-96
  linux-headers-4.4.0-96-generic linux-headers-4.4.0-97 linux-headers-4.4.0-97-generic
  linux-headers-4.4.0-98 linux-headers-4.4.0-98-generic linux-image-4.4.0-101-generic
  linux-image-4.4.0-109-generic linux-image-4.4.0-89-generic linux-image-4.4.0-92-generic
  linux-image-4.4.0-93-generic linux-image-4.4.0-96-generic linux-image-4.4.0-97-generic
  linux-image-4.4.0-98-generic linux-image-extra-4.4.0-101-generic
  linux-image-extra-4.4.0-109-generic linux-image-extra-4.4.0-89-generic
  linux-image-extra-4.4.0-92-generic linux-image-extra-4.4.0-93-generic
  linux-image-extra-4.4.0-96-generic linux-image-extra-4.4.0-97-generic
  linux-image-extra-4.4.0-98-generic rake ruby ruby-did-you-mean ruby-minitest
  ruby-net-telnet ruby-power-assert ruby-test-unit ruby2.3
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-image-4.4.0-109-generic linux-image-4.4.0-128-generic
Suggested packages:
  fdutils linux-doc-4.4.0 | linux-source-4.4.0 linux-tools
The following NEW packages will be installed:
  linux-image-4.4.0-109-generic linux-image-4.4.0-128-generic
0 upgraded, 2 newly installed, 0 to remove and 428 not upgraded.
20 not fully installed or removed.
Need to get 0 B/44.0 MB of archives.
After this operation, 135 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 583603 files and directories currently installed.)
Preparing to unpack .../linux-image-4.4.0-128-generic_4.4.0-128.154_amd64.deb ...
Examining /etc/kernel/preinst.d/
run-parts: executing /etc/kernel/preinst.d/intel-microcode 4.4.0-128-generic /boot/vmlinuz-4.4.0-128-generic
Done.
Unpacking linux-image-4.4.0-128-generic (4.4.0-128.154) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-128-generic_4.4.0-128.154_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-128-generic' to '/boot/vmlinuz-4.4.0-128-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-128-generic /boot/vmlinuz-4.4.0-128-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-128-generic /boot/vmlinuz-4.4.0-128-generic
Preparing to unpack .../linux-image-4.4.0-109-generic_4.4.0-109.132_amd64.deb ...
Examining /etc/kernel/preinst.d/
run-parts: executing /etc/kernel/preinst.d/intel-microcode 4.4.0-109-generic /boot/vmlinuz-4.4.0-109-generic
Done.
Unpacking linux-image-4.4.0-109-generic (4.4.0-109.132) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-109-generic_4.4.0-109.132_amd64.deb (--unpack):
 cannot copy extracted data for './boot/vmlinuz-4.4.0-109-generic' to '/boot/vmlinuz-4.4.0-109-generic.dpkg-new': failed to write (No space left on device)
No apport report written because the error message indicates a disk full error
                                                                              dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.4.0-109-generic /boot/vmlinuz-4.4.0-109-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-109-generic /boot/vmlinuz-4.4.0-109-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.4.0-128-generic_4.4.0-128.154_amd64.deb
 /var/cache/apt/archives/linux-image-4.4.0-109-generic_4.4.0-109.132_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

我也尝试过:(如何在 /boot 中释放更多空间?

$ sudo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")
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-image-extra-4.4.0-101-generic : Depends: linux-image-4.4.0-101-generic but it is not going to be installed
 linux-image-extra-4.4.0-103-generic : Depends: linux-image-4.4.0-103-generic but it is not going to be installed
 linux-image-extra-4.4.0-109-generic : Depends: linux-image-4.4.0-109-generic but it is not going to be installed
 linux-image-extra-4.4.0-128-generic : Depends: linux-image-4.4.0-128-generic but it is not going to be installed
 linux-image-extra-4.4.0-89-generic : Depends: linux-image-4.4.0-89-generic but it is not going to be installed
 linux-image-extra-4.4.0-92-generic : Depends: linux-image-4.4.0-92-generic but it is not going to be installed
 linux-image-extra-4.4.0-93-generic : Depends: linux-image-4.4.0-93-generic but it is not going to be installed
 linux-image-extra-4.4.0-96-generic : Depends: linux-image-4.4.0-96-generic but it is not going to be installed
 linux-image-extra-4.4.0-97-generic : Depends: linux-image-4.4.0-97-generic but it is not going to be installed
 linux-image-extra-4.4.0-98-generic : Depends: linux-image-4.4.0-98-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-128-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 -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]'
linux-headers-4.4.0-101
linux-headers-4.4.0-101-generic
linux-headers-4.4.0-103
linux-headers-4.4.0-103-generic
linux-headers-4.4.0-62
linux-headers-4.4.0-62-generic
linux-headers-4.4.0-89
linux-headers-4.4.0-89-generic
linux-headers-4.4.0-92
linux-headers-4.4.0-92-generic
linux-headers-4.4.0-93
linux-headers-4.4.0-93-generic
linux-headers-4.4.0-96
linux-headers-4.4.0-96-generic
linux-headers-4.4.0-97
linux-headers-4.4.0-97-generic
linux-headers-4.4.0-98
linux-headers-4.4.0-98-generic
linux-image-4.4.0-101-generic
linux-image-4.4.0-103-generic
linux-image-4.4.0-89-generic
linux-image-4.4.0-92-generic
linux-image-4.4.0-93-generic
linux-image-4.4.0-96-generic
linux-image-4.4.0-97-generic
linux-image-4.4.0-98-generic

$ dpkg -l linux-{image,headers}-"[0-9]*" | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e '[0-9]' | xargs sudo apt-get -y purge
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-image-extra-4.4.0-101-generic : Depends: linux-image-4.4.0-101-generic but it is not going to be installed
 linux-image-extra-4.4.0-103-generic : Depends: linux-image-4.4.0-103-generic but it is not going to be installed
 linux-image-extra-4.4.0-109-generic : Depends: linux-image-4.4.0-109-generic but it is not going to be installed
 linux-image-extra-4.4.0-128-generic : Depends: linux-image-4.4.0-128-generic but it is not going to be installed
 linux-image-extra-4.4.0-89-generic : Depends: linux-image-4.4.0-89-generic but it is not going to be installed
 linux-image-extra-4.4.0-92-generic : Depends: linux-image-4.4.0-92-generic but it is not going to be installed
 linux-image-extra-4.4.0-93-generic : Depends: linux-image-4.4.0-93-generic but it is not going to be installed
 linux-image-extra-4.4.0-96-generic : Depends: linux-image-4.4.0-96-generic but it is not going to be installed
 linux-image-extra-4.4.0-97-generic : Depends: linux-image-4.4.0-97-generic but it is not going to be installed
 linux-image-extra-4.4.0-98-generic : Depends: linux-image-4.4.0-98-generic but it is not going to be installed
 linux-image-generic : Depends: linux-image-4.4.0-128-generic but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

答案1

以超级用户身份执行此操作

1-apt-get autoremove

2- 转到/boot并运行这些

rm *4.4.0-6*
rm *4.4.0-8*
rm *4.4.0-9*
rm *4.4.0-101*

3- 运行update-grub

相关内容