尝试更新内核,空间不足,sudo apt-get -f install 也失败

尝试更新内核,空间不足,sudo apt-get -f install 也失败

我在网上搜索过,也按照终端中的建议操作过,但都不起作用。下面是我遇到的问题。似乎清除旧内核的代码有问题,但要修复它,我需要更多的空间,这也是我一开始的全部目的。我对 Linux 非常陌生,绝不是一个程序员,所以请对我坦诚相待。

$ sudo apt autoremove
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-image-extra-4.13.0-36-generic : Depends: linux-image-4.13.0-36-generic but it is not installed
    linux-image-generic-hwe-16.04 : Depends: linux-image-4.13.0-36-generic but it is not installed
    linux-signed-image-4.13.0-36-generic : Depends: linux-image-4.13.0-36-generic (= 4.13.0-36.40~16.04.1) but it is not installed
E: Unmet dependencies. Try using -f.
hunter@hunter-Satellite-C55-C:~$ apt-get -f install
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

$ 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:
    libllvm4.0 linux-headers-4.10.0-35 linux-headers-4.10.0-35-generic
    linux-headers-4.10.0-37 linux-headers-4.10.0-37-generic
    linux-headers-4.10.0-40 linux-headers-4.10.0-40-generic
    linux-headers-4.10.0-42 linux-headers-4.10.0-42-generic
    linux-headers-4.13.0-26 linux-headers-4.13.0-26-generic
    linux-image-4.10.0-35-generic linux-image-4.10.0-37-generic
    linux-image-4.10.0-40-generic linux-image-4.10.0-42-generic
    linux-image-4.13.0-26-generic linux-image-extra-4.10.0-35-generic
    linux-image-extra-4.10.0-37-generic linux-image-extra-4.10.0-40-generic
    linux-image-extra-4.10.0-42-generic linux-image-extra-4.13.0-26-generic
    linux-signed-image-4.10.0-35-generic linux-signed-image-4.10.0-37-generic
    linux-signed-image-4.10.0-40-generic linux-signed-image-4.10.0-42-generic
    linux-signed-image-4.13.0-26-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
    linux-image-4.13.0-36-generic
Suggested packages:
    fdutils linux-tools
The following NEW packages will be installed:
    linux-image-4.13.0-36-generic
0 upgraded, 1 newly installed, 0 to remove and 110 not upgraded.
78 not fully installed or removed.
Need to get 0 B/21.0 MB of archives.
After this operation, 72.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 452182 files and directories currently installed.)
Preparing to unpack .../linux-image-4.13.0-36-generic_4.13.0-36.40~16.04.1_amd64.deb ...
Examining /etc/kernel/preinst.d/
run-parts: executing /etc/kernel/preinst.d/intel-microcode 4.13.0-36-generic /boot/vmlinuz-4.13.0-36-generic
Done.
Unpacking linux-image-4.13.0-36-generic (4.13.0-36.40~16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.13.0-36-generic_4.13.0-36.40~16.04.1_amd64.deb (--unpack):
    cannot copy extracted data for './boot/System.map-4.13.0-36-generic' to '/boot/System.map-4.13.0-36-generic.dpkg-new': failed to write (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)
Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 4.13.0-36-generic /boot/vmlinuz-4.13.0-36-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.13.0-36-generic /boot/vmlinuz-4.13.0-36-generic
Errors were encountered while processing:
    /var/cache/apt/archives/linux-image-4.13.0-36-  generic_4.13.0-36.40~16.04.1_amd64.deb
        E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

由于空间不足,apt 将无法运行;因此,任何自动修复也将失败。您需要手动释放 /boot/ 目录中的一些空间。一种方法是删除要删除的内核的系统映射。如果这没有提供足够的空间,请删除某些内核的 initrd。注意:您需要 root 权限才能删除 /boot/ 中的文件。

相关内容