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

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

我已经释放了大量空间,但这并没有什么帮助。大量的空间和 inode 被旧的和linux-headers从未被删除的软件包占用。例如,/usr/share 包含 4.3GB / 960,871 个与 相关的文件。linux-imagelinux-image-extralinux-headers

apt-get autoremove并且apt-get autoremove -f都以类似的方式失败。我被告知要释放空间,但占用空间的东西不起作用,因为(它说)没有空间,即使有空间。

请问我怎样才能摆脱这种循环?

答案1

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

在我的计算机上,一个内核的头文件有超过 10k 个文件,因此在安装内核头文件时,3.7k 个可用 inode 对您来说没什么用。可用 inode 数量少肯定是您计算机上的一个问题,通常可以通过apt-get autoremove删除旧内核及其头文件来解决。

相关内容