如何满足 apt-get upgrade 上未满足的依赖关系?

如何满足 apt-get upgrade 上未满足的依赖关系?

我收到以下错误sudo 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 : Depends: linux-headers-4.4.0-151-generic but it is not installed
 linux-image-generic : Depends: linux-modules-extra-4.4.0-151-generic but it is not installed
                       Recommends: thermald but it is not installed
E: Unmet dependencies. Try using -f.

然后我尝试了sudo apt-get -f install。这又给了我一个错误:

The following additional packages will be installed:
  linux-headers-4.4.0-210 linux-headers-4.4.0-210-generic linux-modules-extra-4.4.0-210-generic
The following NEW packages will be installed:
  linux-headers-4.4.0-210 linux-headers-4.4.0-210-generic linux-modules-extra-4.4.0-210-generic
0 upgraded, 3 newly installed, 0 to remove and 235 not upgraded.
8 not fully installed or removed.
Need to get 47.4 MB of archives.
After this operation, 235 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-modules-extra-4.4.0-210-generic amd64 4.4.0-210.242 [36.6 MB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-210 all 4.4.0-210.242 [10.0 MB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial-updates/main amd64 linux-headers-4.4.0-210-generic amd64 4.4.0-210.242 [786 kB]
Fetched 47.4 MB in 4s (11.0 MB/s)
(Reading database ... 1423830 files and directories currently installed.)
Preparing to unpack .../linux-modules-extra-4.4.0-210-generic_4.4.0-210.242_amd64.deb ...
Unpacking linux-modules-extra-4.4.0-210-generic (4.4.0-210.242) ...
dpkg: error processing archive /var/cache/apt/archives/linux-modules-extra-4.4.0-210-generic_4.4.0-210.242_amd64.deb (--unpack):
 unable to create '/lib/modules/4.4.0-210-generic/kernel/drivers/media/usb/dvb-usb-v2/dvb-usb-az6007.ko.dpkg-new' (while processing './lib/modules/4.4.0-210-generic/kernel/drivers/media/usb/dvb-usb-v2/dvb-usb-az6007.ko'): 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)

我读过了这个帖子。接受的答案不起作用,因为它sudo apt-get remove linux-image-VERSION给出了与相同的错误sudo apt-get -f install。我尝试了第二个获得最多支持的答案,它释放了一些空间:

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           799M   17M  782M   3% /run
/dev/sda1        22G   19G  2.3G  90% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           799M     0  799M   0% /run/user/1000

到:

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            3.9G     0  3.9G   0% /dev
tmpfs           799M   17M  782M   3% /run
/dev/sda1        22G   17G  4.1G  80% /
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
tmpfs           799M     0  799M   0% /run/user/1000

之后,我跑了sudo apt-get cleansudo apt-get autoclean然后sudo apt-get -f install按照这个建议回答。但我遇到了同样的错误。我该怎么做才能解决这个问题?

更新

的输出df -ih为:

Filesystem     Inodes IUsed IFree IUse% Mounted on
udev             993K   411  993K    1% /dev
tmpfs            998K   570  998K    1% /run
/dev/sda1        1.4M  1.4M  1.8K  100% /
tmpfs            998K     1  998K    1% /dev/shm
tmpfs            998K     3  998K    1% /run/lock
tmpfs            998K    16  998K    1% /sys/fs/cgroup
tmpfs            998K     4  998K    1% /run/user/1000

答案1

您的输出中有一些关键线索。

No space left on device可能出于两个原因:空间和/或索引节点

  • 人们用完了空间常见原因:电影和其他大文件太多。偶尔日志文件失控。
  • 人们用完了索引节点当它们有太多(数千个)小文件时。典型的例子是内核头文件和/或内核源文件太多。

你的输出和故障排除似乎让你得出了安全、正确的结论:索引节点才是问题所在。(做得好!)

  • 查找未使用的(较旧的)内核源和内核头包。卸载它们。
  • 有些人从非软件包源安装内核文件。这些文件也计入 inode 中。如果您这样做了,是时候清理它们了。

一旦你的 inode 稍微低一些,apt 将再次工作。

相关内容