apt-get -f install 设备上没有剩余空间(Ubuntu 14.04)

apt-get -f install 设备上没有剩余空间(Ubuntu 14.04)

我正在努力奔跑

sudo apt-get -f install

输出:

Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-53 linux-headers-4.4.0-53-generic linux-headers-4.4.0-57 linux-headers-4.4.0-57-generic linux-headers-4.4.0-59 linux-headers-4.4.0-59-generic linux-headers-4.4.0-62 linux-headers-4.4.0-62-generic
  linux-headers-4.4.0-63 linux-headers-4.4.0-63-generic linux-headers-4.4.0-64 linux-headers-4.4.0-64-generic linux-headers-4.4.0-66 linux-headers-4.4.0-66-generic linux-headers-4.4.0-70 linux-headers-4.4.0-70-generic
  linux-headers-4.4.0-71 linux-headers-4.4.0-71-generic linux-headers-4.4.0-72 linux-headers-4.4.0-72-generic linux-headers-4.4.0-75 linux-headers-4.4.0-75-generic linux-headers-4.4.0-78 linux-headers-4.4.0-78-generic
  linux-headers-4.4.0-79 linux-headers-4.4.0-79-generic linux-headers-4.4.0-81 linux-headers-4.4.0-81-generic linux-headers-4.4.0-83 linux-headers-4.4.0-83-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  linux-headers-4.4.0-89
The following NEW packages will be installed:
  linux-headers-4.4.0-89
0 upgraded, 1 newly installed, 0 to remove and 85 not upgraded.
6 not fully installed or removed.
Need to get 9,919 kB of archives.
After this operation, 70.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-89 all 4.4.0-89.112 [9,919 kB]
Fetched 9,919 kB in 0s (23.4 MB/s)
(Reading database ... 467324 files and directories currently installed.)
Preparing to unpack .../linux-headers-4.4.0-89_4.4.0-89.112_all.deb ...
Unpacking linux-headers-4.4.0-89 (4.4.0-89.112) ...
dpkg: error processing archive /var/cache/apt/archives/linux-headers-4.4.0-89_4.4.0-89.112_all.deb (--unpack):
 unable to create '/usr/src/linux-headers-4.4.0-89/arch/frv/include/asm/switch_to.h.dpkg-new' (while processing './usr/src/linux-headers-4.4.0-89/arch/frv/include/asm/switch_to.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)
Errors were encountered while processing:
 /var/cache/apt/archives/linux-headers-4.4.0-89_4.4.0-89.112_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

的输出dpkg -l | grep linux-image为:

ii  linux-image-4.4.0-87-generic     4.4.0-87.110                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iF  linux-image-4.4.0-89-generic     4.4.0-89.112                               amd64        Linux kernel image for version 4.4.0 on 64 bit x86 SMP
iU  linux-image-virtual              4.4.0.89.95                                amd64        This package will always depend on the latest minimal generic kernel image.

好像我目前正在使用版本 .87,而版本 .89 已配置了一半(状态 iF

编辑:

硬盘空间不是问题,输出df -h是:

Filesystem      Size  Used Avail Use% Mounted on
/dev/root       7.8G  4.9G  2.5G  67% /
devtmpfs        494M     0  494M   0% /dev
tmpfs           496M  4.0K  496M   1% /dev/shm
tmpfs           496M  6.9M  489M   2% /run
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           496M     0  496M   0% /sys/fs/cgroup
tmpfs           100M     0  100M   0% /run/user/1001
/dev/xvdf       7.8G  153M  7.2G   3% /database

答案1

我无法说出是什么原因导致错误再次出现在磁盘空间中,但是今晚我确实遇到了这个问题,我通过手动删除一些旧标题然后继续正常操作来解决这个问题。

sudo rm -rf /usr/src/linux-headers-4.4.0-5*
sudo rm -rf /usr/src/linux-headers-4.4.0-6*

此后,我就可以像平常一样使用 apt 进行其他所有操作了。

答案2

很可能设备上仍有剩余空间,但不够inodes

通过运行来确认

df -hi

# example output
Filesystem     Inodes IUsed IFree IUse% Mounted on
udev             596K   575  596K    1% /dev
tmpfs            604K   963  604K    1% /run
/dev/sda1         29M  2,8M   26M   10% /
tmpfs            604K    62  604K    1% /dev/shm
tmpfs            604K     7  604K    1% /run/lock
tmpfs            604K    18  604K    1% /sys/fs/cgroup
tmpfs            604K    38  604K    1% /run/user/1000

什么是 inode?

想象一下一本书,你只能阅读目录中列出的章节。每个目录条目都是一个 inode(指文件或目录)。但目录保留的页数是固定的,比如说三页,相当于 200 个章节。现在,如果每个章节都很短,那么书的末尾就会有空白页,无法写入。

发生了什么?

您似乎有许多小文件或空目录。很可能linux-headers-*安装了许多软件包,这些软件包附带约 20k 个源代码文件。查找这些软件包并删除它们。或者删除包含许多小文件的其他内容。

哎呀,打完字后,我发现原帖评论中提到了 inode。不过,这可能还是一个有用的答案

相关内容