apt-get报告设备上没有剩余空间

我的机器进入了一个我无法apt-get任何东西的状态。

当我运行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-generic-lts-xenial : Depends: linux-headers-4.4.0-124-generic but it is not installed E: Unmet dependencies. Try using -f. 

所以我做apt-get -f install

 Reading package lists... Done Building dependency tree Reading state information... Done Correcting dependencies... Done The following extra packages will be installed: linux-headers-4.4.0-124 linux-headers-4.4.0-124-generic The following NEW packages will be installed linux-headers-4.4.0-124 linux-headers-4.4.0-124-generic 0 to upgrade, 2 to newly install, 0 to remove and 67 not to upgrade. 8 not fully installed or removed. Need to get 0 B/10.8 MB of archives. After this operation, 87.6 MB of additional disk space will be used. Do you want to continue? [Y/n] y (Reading database ... 1218968 files and directories currently installed.) Preparing to unpack .../linux-headers-4.4.0-124_4.4.0-124.148~14.04.1_all.deb ... Unpacking linux-headers-4.4.0-124 (4.4.0-124.148~14.04.1) ... dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-124_4.4.0-124.148~14.04.1_all.deb (--unpack): unable to create `/usr/src/linux-headers-4.4.0-124/include/net/irda/irqueue.h.dpkg-new' (while processing `./usr/src/linux-headers-4.4.0-124/include/net/irda/irqueue.h'): 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) Preparing to unpack .../linux-headers-4.4.0-124-generic_4.4.0-124.148~14.04.1_amd64.deb ... Unpacking linux-headers-4.4.0-124-generic (4.4.0-124.148~14.04.1) ... dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-124-generic_4.4.0-124.148~14.04.1_amd64.deb (--unpack): error creating directory `./usr/src/linux-headers-4.4.0-124-generic/include/config/altera': 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) Errors were encountered while processing: /var/cache/apt/archives/linux-headers-4.4.0-124_4.4.0-124.148~14.04.1_all.deb /var/cache/apt/archives/linux-headers-4.4.0-124-generic_4.4.0-124.148~14.04.1_amd64.deb E: Sub-process /usr/bin/dpkg returned an error code (1) 

表示磁盘已满。 它有大约3GB和3.7k inode免费,所以我不知道我是否相信这真的是问题:

 root@laptop15:/tmp# df -h Filesystem Size Used Avail Use% Mounted on udev 3.9G 4.0K 3.9G 1% /dev tmpfs 788M 2.3M 786M 1% /run /dev/sda5 20G 17G 2.0G 90% / none 4.0K 0 4.0K 0% /sys/fs/cgroup none 5.0M 0 5.0M 0% /run/lock none 3.9G 31M 3.9G 1% /run/shm none 100M 40K 100M 1% /run/user /dev/sda1 47M 3.2M 44M 7% /boot/efi /dev/sda4 200G 119G 72G 63% /home /dev/sda2 880M 12M 802M 2% /scratch /dev/loop0 87M 87M 0 100% /snap/core/4571 /dev/loop1 87M 87M 0 100% /snap/core/4407 /dev/loop2 87M 87M 0 100% /snap/core/4486 root@laptop15:/tmp# df -i Filesystem Inodes IUsed IFree IUse% Mounted on udev 1005270 496 1004774 1% /dev tmpfs 1008404 592 1007812 1% /run /dev/sda5 1305600 1301852 3748 100% / none 1008404 15 1008389 1% /sys/fs/cgroup none 1008404 5 1008399 1% /run/lock none 1008404 385 1008019 1% /run/shm none 1008404 33 1008371 1% /run/user /dev/sda1 0 0 0 - /boot/efi /dev/sda4 13279232 321559 12957673 3% /home /dev/sda2 65408 14 65394 1% /scratch /dev/loop0 12831 12831 0 100% /snap/core/4571 /dev/loop1 12817 12817 0 100% /snap/core/4407 /dev/loop2 12819 12819 0 100% /snap/core/4486 

我已经释放了一大堆空间,但它没有帮助。 旧的linux-headerslinux-imagelinux-image-extra软件包使用了大量的空间和inode,它们永远不会被删除。 / usr / share包含与linux-headers有关的4.3GB / 960,871文件。

apt-get autoremoveapt-get autoremove -f都以类似的方式失败。 我被困在被告知要腾出空间,但是用尽空间的东西不起作用,因为(它说)没有空间,即使有。

我怎么能走出这个循环呢?

在这种情况下,我倾向于只手动删除/ usr / src /中的一些旧内核头文件。 根据我的经验,这在以后删除标头包时不会导致错误。

在我的机器上,一个内核的头文件超过10k文件,所以3.7k的免费inode在安装内核头文件时不会让你走得太远。 少量的免费inode肯定是你机器上的一个问题,通常可以通过apt-get autoremove来解决,以删除旧内核及其头文件。