从 /boot 中删除旧内核以释放空间

从 /boot 中删除旧内核以释放空间

我想释放 /boot 中的部分空间但我无法这样做。

Filesystem            1K-blocks     Used Available Use% Mounted on
/dev/sda1                474730   463590         0 100% /boot

我已尝试sudo apt-get autoremove --purge但出现以下错误

sudo apt-get autoremove --purge
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
linux-image-extra-4.4.0-137-generic : Depends: linux-image-4.4.0-137-generic but it is not installed
 linux-image-extra-4.4.0-142-generic : Depends: linux-image-4.4.0-142-generic but it is not installed
 linux-image-generic : Depends: linux-image-4.4.0-142-generic but it is not installed
                   Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.

我尝试过sudo apt-get -f install,但由于没有空白空间,我无法成功运行它并出现以下错误

Unpacking linux-image-4.4.0-137-generic (4.4.0-137.163) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0- 
137-generic_4.4.0-137.163_amd64.deb (--unpack):
cannot copy extracted data for './boot/abi-4.4.0-137-generic' to '/boot/abi- 
4.4.0-137-generic.dpkg-new': failed to write (No space left on device)

我还尝试使用dpkg以下代码将其删除

dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p' | xargs sudo apt-get -y purge

我收到上述命令的以下错误。

root@servername:/# dpkg --list | grep linux-image | awk '{ print $2 }' | 
sort -V | sed -n '/'`uname -r`'/q;p' | 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-112-generic : Depends: linux-image-4.4.0-112-generic 
but it is not going to be installed
linux-image-extra-4.4.0-116-generic : Depends: linux-image-4.4.0-116-generic 
but it is not going to be installed
linux-image-extra-4.4.0-119-generic : Depends: linux-image-4.4.0-119-generic 
but it is not going to be installed
linux-image-extra-4.4.0-121-generic : Depends: linux-image-4.4.0-121-generic 
but it is not going to be installed
linux-image-extra-4.4.0-124-generic : Depends: linux-image-4.4.0-124-generic 
but it is not going to be installed
linux-image-extra-4.4.0-127-generic : Depends: linux-image-4.4.0-127-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-21-generic : Depends: linux-image-4.4.0-21-generic 
but it is not going to be installed
linux-image-generic : Depends: linux-image-4.4.0-142-generic but it is not 
going to be installed
                   Depends: linux-image-extra-4.4.0-142-generic but it is not going to be installed
                   Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

我尝试逐个删除旧内核,但仍然没有成功

root@servername:/# sudo apt-get purge linux-image-4.4.0-112-generic
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-112-generic : Depends: linux-image-4.4.0-112-generic 
but it is not going to be installed
linux-image-generic : Depends: linux-image-4.4.0-142-generic but it is not 
going to be installed
                   Depends: linux-image-extra-4.4.0-142-generic but it is 
not going to be installed
                   Recommends: thermald but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

我也尝试过sudo rm -rf /boot/*-34.4.0-{112,116,119,121,124,127,128,21}-* 但还是没有成功。

有人知道如何解决吗?

提前致谢。

答案1

唯一的解决办法是手动删除这些,这将是第一次射频不起作用。可能不符合您的条件。

sudo rm -rf /boot/*-4.4.0-{112,116,119,121,124,127,128,21}-*

相关内容