我遇到了空间不足的/boot
问题,并发出了以下命令来尝试清除它:
# rm /boot/vmlinuz-4.4.0-{x, y, z, 70}-generic && dpkg --purge linux-image-4.4.0-{x, y, z, 70}-generic
其中x
,y
是z
我删除的版本,我不记得它们的编号了。
但是当我尝试更新任何内容时,控制台上会显示以下内容:
# apt-get update && apt-get upgrade
Hit:1 http://ftp.heanet.ie/pub/ubuntu xenial InRelease
Ign:2 http://mintlinux.mirror.triple-it.nl/packages serena InRelease
Get:3 http://ftp.heanet.ie/pub/ubuntu xenial-updates InRelease [102 kB]
Ign:4 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:5 http://archive.canonical.com/ubuntu xenial InRelease
Hit:6 http://mintlinux.mirror.triple-it.nl/packages serena Release
Hit:7 http://ppa.launchpad.net/atareao/atareao/ubuntu xenial InRelease
Get:8 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:9 http://dl.google.com/linux/chrome/deb stable Release
Hit:10 http://ppa.launchpad.net/gezakovacs/ppa/ubuntu xenial InRelease
Get:12 http://ftp.heanet.ie/pub/ubuntu xenial-backports InRelease [102 kB]
Hit:14 http://repository.spotify.com stable InRelease
Hit:15 http://ppa.launchpad.net/openjdk-r/ppa/ubuntu xenial InRelease
Hit:16 https://apt.dockerproject.org/repo ubuntu-xenial InRelease
Hit:17 https://deb.nodesource.com/node_6.x xenial InRelease
Hit:18 https://dl.yarnpkg.com/debian stable InRelease
Hit:19 https://packagecloud.io/slacktechnologies/slack/debian jessie InRelease
Fetched 306 kB in 2s (108 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
4 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up linux-image-4.4.0-70-generic (4.4.0-70.91) ...
Internal Error: Could not find image (/boot/vmlinuz-4.4.0-70-generic)
dpkg: error processing package linux-image-4.4.0-70-generic (--configure):
subprocess installed post-installation script returned error exit status 2
dpkg: dependency problems prevent configuration of linux-image-extra-4.4.0-70-generic:
linux-image-extra-4.4.0-70-generic depends on linux-image-4.4.0-70-generic; however:
Package linux-image-4.4.0-70-generic is not configured yet.
dpkg: error processing package linux-image-extra-4.4.0-70-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-image-4.4.0-70-generic; however:
Package linux-image-4.4.0-70-generic is not configured yet.
linux-image-generic depends on linux-image-extra-4.4.0-70-generic; however:
Package linux-image-extra-4.4.0-70-generic is not configured yet.
dpkg: error processing package linux-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-image-extra-virtual:
linux-image-extra-virtual depends on linux-image-generic (= 4.4.0.70.76); however:
Package linux-image-generic is not configured yet.
dpkg: error processing package linux-image-extra-virtual (--configure):
dependency problems - leaving unconfigured
Errors were encountered while processing:
linux-image-4.4.0-70-generic
linux-image-extra-4.4.0-70-generic
linux-image-generic
linux-image-extra-virtual
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
正如您所发现的,在清除软件包之前删除文件会给软件包管理器带来问题。您基本上只需要恢复软件包管理器抱怨的已删除内容。恢复的文件可能为零长度,软件包管理器并不关心,因此请使用“touch”命令。例如:
sudo touch /boot/vmlinuz-4.4.0-70-generic
您可能还需要创建一些目录,但是当包管理器找到它想要的文件时,它就会成功完成。