系统更新、完整 /boot、软件安装和未满足的软件包依赖关系的问题

系统更新、完整 /boot、软件安装和未满足的软件包依赖关系的问题

再会,

我最近收到“软件更新”通知,说我的电脑有软件更新。我点击了“显示更新”,然后点击了“立即安装”。

这导致了以下错误消息:

Not enough free disk space
The upgrade needs a total of 312 M free space on disk '/boot'. Please free at least an additional 312 M of disk space on '/boot'. You can remove old kernels using 'sudo apt autoremove', and you could also set COMPRESS=xz in /etc/initramfs-tools/initramfs.conf to reduce the size of your initramfs.

尝试“sudo apt-get 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-32-generic : Depends:
linux-image-4.13.0-32-generic but it is not installed 
linux-image-extra-4.4.0-104-generic : Depends:
linux-image-4.4.0-104-generic but it is not installed 
linux-image-generic-hwe-16.04 : Depends: linux-image-4.13.0-32-generic
but it is not installed  linux-signed-image-4.13.0-32-generic :
Depends: linux-image-4.13.0-32-generic (= 4.13.0-32.35~16.04.1) but it
is not installed E: Unmet dependencies. Try using -f.

然后尝试“sudo apt-get -f install”似乎有效:

sudo apt-get -f install Reading package lists... Done Building
dependency tree        Reading state information... Done Correcting
dependencies... Done The following additional packages will be
installed:   linux-image-4.13.0-32-generic
linux-image-4.4.0-104-generic Suggested packages:   fdutils
linux-tools linux-doc-4.4.0 | linux-source-4.4.0 The following NEW
packages will be installed   linux-image-4.13.0-32-generic
linux-image-4.4.0-104-generic 0 to upgrade, 2 to newly install, 0 to
remove and 520 not to upgrade. 26 not fully installed or removed. Need
to get 0 B/78,7 MB of archives. After this operation, 139 MB of
additional disk space will be used. Do you want to continue? [Y/n]

但需要引导内的额外空间,而我没有......

(Reading database ... 547814 files and directories currently installed.)
Preparing to unpack .../linux-image-4.13.0-32-generic_4.13.0-32.35~16.04.1_amd64.deb ...
Examining /etc/kernel/preinst.d/
Done.
Unpacking linux-image-4.13.0-32-generic (4.13.0-32.35~16.04.1) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.13.0-32-generic_4.13.0-32.35~16.04.1_amd64.deb (--unpack):
 cannot copy extracted data for './boot/config-4.13.0-32-generic' to '/boot/config-4.13.0-32-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-32-generic /boot/vmlinuz-4.13.0-32-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.13.0-32-generic /boot/vmlinuz-4.13.0-32-generic
Preparing to unpack .../linux-image-4.4.0-104-generic_4.4.0-104.127_amd64.deb ...
Examining /etc/kernel/preinst.d/
Done.
Unpacking linux-image-4.4.0-104-generic (4.4.0-104.127) ...
dpkg: error processing archive /var/cache/apt/archives/linux-image-4.4.0-104-generic_4.4.0-104.127_amd64.deb (--unpack):
 cannot copy extracted data for './boot/System.map-4.4.0-104-generic' to '/boot/System.map-4.4.0-104-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.4.0-104-generic /boot/vmlinuz-4.4.0-104-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 4.4.0-104-generic /boot/vmlinuz-4.4.0-104-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-4.13.0-32-generic_4.13.0-32.35~16.04.1_amd64.deb
 /var/cache/apt/archives/linux-image-4.4.0-104-generic_4.4.0-104.127_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

然后我尝试用这个清除旧内核指导其他的,由于未满足依赖关系,同样无法工作。

所以......我感觉有点陷入了循环......

提前感谢任何答案:)。

所有版本的结果相同:

sudo dpkg --remove linux-image-extra-4.10.0-38-generic (Reading database ... 543098 files and directories currently installed.) Removing linux-image-extra-4.10.0-38-generic (4.10.0-38.42~16.04.1) ... run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.10.0-38-generic /boot/vmlinuz-4.10.0-38-generic run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.10.0-38-generic /boot/vmlinuz-4.10.0-38-generic update-initramfs: Generating /boot/initrd.img-4.10.0-38-generic gzip: stdout: No space left on device E: mkinitramfs failure cpio 141 gzip 1 update-initramfs: failed for /boot/initrd.img-4.10.0-38-generic with 1. run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1 dpkg: error processing package linux-image-extra-4.10.0-38-generic (--remove): subprocess installed post-removal script returned error exit status 1 Errors were encountered while processing: linux-image-extra-4.10.0-38-generic anthony@entdroid:~$ 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-32-generic : Depends: linux-image-4.13.0-32-generic but it is not installed linux-image-extra-4.4.0-104-generic : Depends: linux-image-4.4.0-104-generic but it is not installed linux-signed-image-4.13.0-32-generic : Depends: linux-image-4.13.0-32-generic (= 4.13.0-32.35~16.04.1) but it is not installed E: Unmet dependencies. Try using -f. anthony@entdroid:~$ sudo apt install --fix-missing 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-32-generic : Depends: linux-image-4.13.0-32-generic but it is not installed linux-image-extra-4.4.0-104-generic : Depends: linux-image-4.4.0-104-generic but it is not installed linux-signed-image-4.13.0-32-generic : Depends: linux-image-4.13.0-32-generic (= 4.13.0-32.35~16.04.1) but it is not installed E: Unmet dependencies. Try using -f.

其他事情:

uname -a: Linux username 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux ls -alh /boot: total 450M drwxr-xr-x 6 root root 4,0K Feb 23 20:16 . drwxr-xr-x 24 root root 4,0K Feb 23 19:14 .. -rw-r--r-- 1 root root 1,4M Jul 20 2017 abi-4.10.0-28-generic -rw-r--r-- 1 root root 1,4M Okt 10 2017 abi-4.10.0-38-generic -rw-r--r-- 1 root root 1,4M Nov 9 2017 abi-4.10.0-40-generic -rw-r--r-- 1 root root 1,4M Dez 4 2017 abi-4.10.0-42-generic -rw-r--r-- 1 root root 1,5M Jan 19 2018 abi-4.13.0-31-generic -rw-r--r-- 1 root root 1,2M Nov 10 2017 abi-4.4.0-101-generic -rw-r--r-- 1 root root 1,2M Dez 4 2017 abi-4.4.0-103-generic -rw-r--r-- 1 root root 1,2M Jan 19 2018 abi-4.4.0-112-generic -rw-r--r-- 1 root root 1,2M Okt 10 2017 abi-4.4.0-98-generic -rw-r--r-- 1 root root 201K Jul 20 2017 config-4.10.0-28-generic -rw-r--r-- 1 root root 201K Okt 10 2017 config-4.10.0-38-generic -rw-r--r-- 1 root root 201K Nov 9 2017 config-4.10.0-40-generic -rw-r--r-- 1 root root 201K Dez 4 2017 config-4.10.0-42-generic -rw-r--r-- 1 root root 209K Jan 19 2018 config-4.13.0-31-generic -rw-r--r-- 1 root root 212K Jan 29 20:28 config-4.15.0-45-generic -rw-r--r-- 1 root root 187K Nov 10 2017 config-4.4.0-101-generic -rw-r--r-- 1 root root 187K Dez 4 2017 config-4.4.0-103-generic -rw-r--r-- 1 root root 187K Jan 19 2018 config-4.4.0-112-generic -rw-r--r-- 1 root root 187K Okt 10 2017 config-4.4.0-98-generic drwxr-xr-x 5 root root 4,0K Jan 1 1970 efi drwxr-xr-x 5 root root 1,0K Feb 23 19:14 grub drwxr-xr-x 5 root root 1,0K Nov 19 2017 grub.bak -rw-r--r-- 1 root root 43M Dez 11 2017 initrd.img-4.10.0-28-generic -rw-r--r-- 1 root root 43M Dez 11 2017 initrd.img-4.10.0-38-generic -rw-r--r-- 1 root root 43M Dez 11 2017 initrd.img-4.10.0-40-generic -rw-r--r-- 1 root root 43M Dez 11 2017 initrd.img-4.10.0-42-generic -rw-r--r-- 1 root root 39M Dez 11 2017 initrd.img-4.4.0-101-generic -rw-r--r-- 1 root root 39M Dez 11 2017 initrd.img-4.4.0-103-generic -rw-r--r-- 1 root root 39M Dez 11 2017 initrd.img-4.4.0-98-generic drwx------ 2 root root 12K Nov 19 2017 lost+found -rw-r--r-- 1 root root 179K Jan 28 2016 memtest86+.bin -rw-r--r-- 1 root root 181K Jan 28 2016 memtest86+.elf -rw-r--r-- 1 root root 181K Jan 28 2016 memtest86+_multiboot.bin -rw------- 1 root root 3,6M Jul 20 2017 System.map-4.10.0-28-generic -rw------- 1 root root 3,6M Okt 10 2017 System.map-4.10.0-38-generic -rw------- 1 root root 3,6M Nov 9 2017 System.map-4.10.0-40-generic -rw------- 1 root root 3,6M Dez 4 2017 System.map-4.10.0-42-generic -rw------- 1 root root 3,7M Jan 19 2018 System.map-4.13.0-31-generic -rw------- 1 root root 3,9M Jan 29 20:28 System.map-4.15.0-45-generic -rw------- 1 root root 3,8M Nov 10 2017 System.map-4.4.0-101-generic -rw------- 1 root root 3,8M Dez 4 2017 System.map-4.4.0-103-generic -rw------- 1 root root 3,8M Jan 19 2018 System.map-4.4.0-112-generic -rw------- 1 root root 3,8M Okt 10 2017 System.map-4.4.0-98-generic -rw-r--r-- 1 root root 7,1M Nov 19 2017 vmlinuz-4.10.0-28-generic -rw------- 1 root root 7,1M Okt 10 2017 vmlinuz-4.10.0-38-generic -rw------- 1 root root 7,1M Nov 19 2017 vmlinuz-4.10.0-38-generic.efi.signed -rw------- 1 root root 7,1M Nov 9 2017 vmlinuz-4.10.0-40-generic -rw------- 1 root root 7,1M Nov 22 2017 vmlinuz-4.10.0-40-generic.efi.signed -rw------- 1 root root 7,1M Dez 4 2017 vmlinuz-4.10.0-42-generic -rw------- 1 root root 7,1M Dez 11 2017 vmlinuz-4.10.0-42-generic.efi.signed -rw------- 1 root root 7,4M Jan 19 2018 vmlinuz-4.13.0-31-generic -rw------- 1 root root 7,8M Jan 30 11:08 vmlinuz-4.15.0-45-generic -rw------- 1 root root 6,8M Nov 10 2017 vmlinuz-4.4.0-101-generic -rw------- 1 root root 6,8M Nov 22 2017 vmlinuz-4.4.0-101-generic.efi.signed -rw------- 1 root root 6,8M Dez 4 2017 vmlinuz-4.4.0-103-generic -rw------- 1 root root 6,8M Dez 11 2017 vmlinuz-4.4.0-103-generic.efi.signed -rw------- 1 root root 6,8M Jan 19 2018 vmlinuz-4.4.0-112-generic -rw------- 1 root root 6,8M Okt 10 2017 vmlinuz-4.4.0-98-generic -rw------- 1 root root 6,8M Nov 19 2017 vmlinuz-4.4.0-98-generic.efi.signed

答案1

您需要手动删除图像,没有其他选择,首先输入uname -a查看您正在使用的内核版本,然后删除所有其他版本。

粘贴 uname -a 和 ls -alh /boot 输出,我会给你删除的命令。

rm -rf /boot/abi-4.13.*;rm -rf /boot/abi-4.4.*;rm -rf /boot/initrd.img-4.13.*;rm -rf /boot/initrd.img-4.4.*; rm -rf /boot/initrd.img-4.10.0-38-generic; rm -rf /boot/initrd.img-4.10.0-28-generic /boot/initrd.img-4.10.0-40-generic  /boot/vmlinuz-4.13.* /boot/vmlinuz-4.4.*

然后你可以重试,它一定会起作用

答案2

步骤 1:列出所有需要删除的旧内核。这很简单 - 您已经打印了上面的列表。只需记下或打印出内核版本号即可。不要将当前正在运行的内核包含在列表中。

步骤 2:使用 dpkg 删除一个旧内核。示例:sudo dpkg --remove linux-image-extra-4.10.0-28-generic

步骤3:再试sudo apt autoremove一次sudo apt install --fix-missing

如果您遇到相同的空间不足错误,请使用另一个旧内核重复步骤 2。

通过删除每个旧内核释放空间后,最终您将有足够的空间让 --fix missing 运行。然后 autoremove 就会运行。

您似乎还有超过 500 个软件包等待升级。一旦 apt 再次正常工作,请升级它们。

每季度左右运行一次 autoremove 以正确清理 /boot 并防止空间不足问题再次出现。

相关内容