我恳请有经验的人帮我解决以下棘手的问题。最近,我的自动软件更新程序建议我更新linux-firmware
。更新失败,此后每次更新我都会收到这样的消息。我尝试在谷歌上搜索解决方案并修复该问题,但从未成功。以下是我尝试过的总结:
这是我执行后得到的结果sudo apt install linux-firmware
:
$ sudo apt install linux-firmware
Reading package lists... Done
Building dependency tree
Reading state information... Done
linux-firmware is already the newest version (1.187.24).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
6 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Setting up initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-firmware (1.187.24) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-91-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/kubuntu--vg-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-91-generic with 1.
dpkg: error processing package linux-firmware (--configure):
installed linux-firmware package post-installation script subprocess returned error exit status 1
Setting up linux-image-5.4.0-92-generic (5.4.0-92.103) ...
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-firmware; however:
Package linux-firmware is not configured yet.
dpkg: error processing package linux-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 5.4.0.92.96); however:
Package linux-image-generic is not configured yet.
dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because MaxReports is reached already
dpkg: dependency problems prevent configuration of linux-generic-hwe-18.04:
linux-generic-hwe-18.04 depends on linux-generic; however:
Package linux-generic is not configured yet.
dpkg: error processing package linux-generic-hwe-18.04 (--configure):
dependency problems - leaving unconfigured
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-91-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/kubuntu--vg-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-91-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Processing triggers for linux-image-5.4.0-92-generic (5.4.0-92.103) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-92-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/kubuntu--vg-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-92-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.4.0-92-generic (--configure):
installed linux-image-5.4.0-92-generic package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-firmware
linux-image-generic
linux-generic
linux-generic-hwe-18.04
initramfs-tools
linux-image-5.4.0-92-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
这是我尝试时得到的输出sudo dpkg --configure -a
:
$ sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-image-5.4.0-92-generic; however:
Package linux-image-5.4.0-92-generic is not configured yet.
dpkg: error processing package linux-image-generic (--configure):
dependency problems - leaving unconfigured
Setting up initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: deferring update (trigger activated)
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 5.4.0.92.96); however:
Package linux-image-generic is not configured yet.
dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
Setting up linux-firmware (1.187.24) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-91-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/kubuntu--vg-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-91-generic with 1.
dpkg: error processing package linux-firmware (--configure):
installed linux-firmware package post-installation script subprocess returned error exit status 1
dpkg: dependency problems prevent configuration of linux-generic-hwe-18.04:
linux-generic-hwe-18.04 depends on linux-generic; however:
Package linux-generic is not configured yet.
dpkg: error processing package linux-generic-hwe-18.04 (--configure):
dependency problems - leaving unconfigured
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-91-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/kubuntu--vg-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-91-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-image-generic
linux-generic
linux-firmware
linux-generic-hwe-18.04
initramfs-tools
最后,我还尝试了sudo apt --fix-broken install
:
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
6 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-firmware (1.187.24) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-91-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/kubuntu--vg-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-91-generic with 1.
dpkg: error processing package linux-firmware (--configure):
installed linux-firmware package post-installation script subprocess returned error exit status 1
Setting up linux-image-5.4.0-92-generic (5.4.0-92.103) ...
dpkg: dependency problems prevent configuration of linux-image-generic:
linux-image-generic depends on linux-firmware; however:
Package linux-firmware is not configured yet.
dpkg: error processing package linux-image-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic:
linux-generic depends on linux-image-generic (= 5.4.0.92.96); however:
Package linux-image-generic is not configured yet.
dpkg: error processing package linux-generic (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of linux-generic-hwe-18.04:
linux-generic-hwe-18.04 depends on linux-generic; however:
Package linux-generic is not configured yet.
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report wrrom a previous failure.
No apport report written because MaxReports is reached already
dpkg: error processing package linux-gen
dependency problems - leaving unconfigured
Processing triggers for initramfs-tools (0.136ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-91-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/kubuntu--vg-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-91-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Processing triggers for linux-image-5.4.0-92-generic (5.4.0-92.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-92-generic
I: The initramfs will attempt to resume from /dev/dm-2
I: (/dev/mapper/kubuntu--vg-swap_1)
I: Set the RESUME variable to override this.
Error 24 : Write error : cannot write compressed block
E: mkinitramfs failure cpio 141 lz4 -9 -l 24
update-initramfs: failed for /boot/initrd.img-5.4.0-92-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.4.0-92-generic (--configure):
installed linux-image-5.4.0-92-generic package post-installation script subprocess returned error exit status 1
No apport report written because MaxReports is reached already
Errors were encountered while processing:
linux-firmware
linux-image-generic
linux-generic
linux-generic-hwe-18.04
initramfs-tools
linux-image-5.4.0-92-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
我希望有人能帮我解决这个问题。非常感谢!
答案1
看起来是旧内核的问题。让我们一起一步步解决这个问题。
首先,清除所有不再使用或导致错误的旧内核:
dpkg -l | egrep "linux-(signed|modules|image|headers)" | grep -v $(uname -r | cut -d - -f 1) | awk {'print $2'} | xargs sudo apt purge -y
再次运行
apt -f
:sudo apt --fix-broken install
或者,您也可以使用稍微复杂的方法来做同样的事情。
删除错误包的安装后文件并运行全新更新:
cd /var/lib/dpkg/info/ && sudo mv linux-firmware* ~/ && sudo mv linux-image-generic* ~/ && sudo mv linux-generic* ~/ && sudo mv linux-generic-hwe-18.0* ~/ && sudo mv initramfs-tools* ~/ && sudo mv linux-image-5.4.0-92-generic* ~/
跑步
apt -f
sudo apt --fix-broken install
现在再次更新:
sudo apt update && sudo apt upgrade -y
现在重新安装软件包:
sudo apt install linux-firmware linux-image-generic linux-generic linux-generic-hwe-18.04 initramfs-tools linux-image-5.4.0-92-generic
另一种方法是通过一行复制粘贴即可完成上述步骤。
sudo dpkg --purge --force-all linux-firmware linux-image-generic linux-generic linux-generic-hwe-18.04 initramfs-tools linux-image-5.4.0-92-generic && sudo apt -f install && sudo apt update && sudo apt upgrade && sudo apt install linux-firmware linux-image-generic linux-generic linux-generic-hwe-18.04 initramfs-tools linux-image-5.4.0-92-generic