我的 virtualbox VM(Ubuntu 16.04)磁盘空间不足。发现有旧内核。我陷入了停滞状态,因为我无法删除它们unmet dependencies
。即使我尝试删除--ignore-missing
,它仍然会出错。
我现在的内核是4.4.0-193-generic
。
所有其他内核是:
linux-headers-4.4.0-169
linux-headers-4.4.0-169-generic
linux-headers-4.4.0-170
linux-headers-4.4.0-170-generic
linux-headers-4.4.0-171
linux-headers-4.4.0-171-generic
linux-headers-4.4.0-173
linux-headers-4.4.0-173-generic
linux-headers-4.4.0-174
linux-headers-4.4.0-174-generic
linux-headers-4.4.0-176
linux-headers-4.4.0-176-generic
linux-headers-4.4.0-177
linux-headers-4.4.0-177-generic
linux-headers-4.4.0-178
linux-headers-4.4.0-178-generic
linux-headers-4.4.0-179
linux-headers-4.4.0-179-generic
linux-headers-4.4.0-184
linux-headers-4.4.0-184-generic
linux-headers-4.4.0-185
linux-headers-4.4.0-185-generic
linux-headers-4.4.0-186
linux-headers-4.4.0-186-generic
linux-headers-4.4.0-187
linux-headers-4.4.0-187-generic
linux-headers-4.4.0-189
linux-headers-4.4.0-189-generic
linux-headers-4.4.0-190
linux-headers-4.4.0-190-generic
linux-headers-4.4.0-31
linux-headers-4.4.0-31-generic
linux-image-4.4.0-169-generic
linux-image-4.4.0-170-generic
linux-image-4.4.0-171-generic
linux-image-4.4.0-173-generic
linux-image-4.4.0-174-generic
linux-image-4.4.0-176-generic
linux-image-4.4.0-177-generic
linux-image-4.4.0-178-generic
linux-image-4.4.0-179-generic
linux-image-4.4.0-184-generic
linux-image-4.4.0-185-generic
linux-image-4.4.0-186-generic
linux-image-4.4.0-187-generic
linux-image-4.4.0-189-generic
linux-image-4.4.0-190-generic
linux-image-4.4.0-31-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 apt -y --ignore-missing 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-headers-generic : Depends: linux-headers-4.4.0-194-generic but it is not going to be installed
linux-image-extra-4.4.0-31-generic : Depends: linux-image-4.4.0-31-generic but it is not going to be installed
linux-image-generic : Depends: linux-modules-extra-4.4.0-194-generic but it is not going to be installed
Recommends: thermald but it is not going to be installed
我没有足够的空间来安装linux-headers-4.4.0-194-generic
。我该如何删除它们???
答案1
好吧,apt
尝试删除旧内核时,使用不起作用。我不得不改用dpkg
,如下所示:
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 dpkg --remove
我尝试运行apt autoremove
,但收到相同的unmet dependencies
消息。因此我运行apt -f install
,然后apt autoremove
再次运行,这次成功了。
现在我可以很好地安装/卸载软件包,并且在此过程中为自己提供了更多的磁盘空间。