更新内核失败,initramfs 错误

更新内核失败,initramfs 错误
sudo apt-get upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 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 linux-image-4.15.0-91-generic (4.15.0-91.92) ...
Processing triggers for linux-image-4.15.0-91-generic (4.15.0-91.92) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 4.15.0-91-generic
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-91-generic
/usr/share/initramfs-tools/hooks/amd64_microcode: 106: /usr/share/initramfs-tools/hooks/amd64_microcode: cpio: Exec format error
/usr/share/initramfs-tools/hooks/amd64_microcode: 108: /usr/share/initramfs-tools/hooks/amd64_microcode: cpio: Exec format error
E: amd64-microcode: failed to create or prepend the early initramfs to the initramfs
I: The initramfs will attempt to resume from /dev/zram7
I: (UUID=bcbd72b9-6f5b-48b1-84e4-669dd5486b40)
I: Set the RESUME variable to override this.
/usr/sbin/mkinitramfs: 8: /usr/sbin/mkinitramfs: cpio: Exec format error
E: mkinitramfs failure find 141 cpio 2 gzip 0
update-initramfs: failed for /boot/initrd.img-4.15.0-91-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-4.15.0-91-generic (--configure):
 installed linux-image-4.15.0-91-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-4.15.0-91-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

以下是一些其他的输出

sudo dpkg --configure -a
Setting up linux-image-4.15.0-91-generic (4.15.0-91.92) ...
Processing triggers for linux-image-4.15.0-91-generic (4.15.0-91.92) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 4.15.0-91-generic
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-91-generic
/usr/share/initramfs-tools/hooks/amd64_microcode: 106: /usr/share/initramfs-tools/hooks/amd64_microcode: cpio: Exec format error
/usr/share/initramfs-tools/hooks/amd64_microcode: 108: /usr/share/initramfs-tools/hooks/amd64_microcode: cpio: Exec format error
E: amd64-microcode: failed to create or prepend the early initramfs to the initramfs
I: The initramfs will attempt to resume from /dev/zram7
I: (UUID=bcbd72b9-6f5b-48b1-84e4-669dd5486b40)
I: Set the RESUME variable to override this.
/usr/sbin/mkinitramfs: 8: /usr/sbin/mkinitramfs: cpio: Exec format error
E: mkinitramfs failure find 141 cpio 2 gzip 0
update-initramfs: failed for /boot/initrd.img-4.15.0-91-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-4.15.0-91-generic (--configure):
 installed linux-image-4.15.0-91-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-4.15.0-91-generic

另一个

sudo update-initramfs -c -k 4.15.0-88-generic
update-initramfs: Generating /boot/initrd.img-4.15.0-88-generic
/usr/share/initramfs-tools/hooks/amd64_microcode: 106: /usr/share/initramfs-tools/hooks/amd64_microcode: cpio: Exec format error
/usr/share/initramfs-tools/hooks/amd64_microcode: 108: /usr/share/initramfs-tools/hooks/amd64_microcode: cpio: Exec format error
E: amd64-microcode: failed to create or prepend the early initramfs to the initramfs
I: The initramfs will attempt to resume from /dev/zram7
I: (UUID=bcbd72b9-6f5b-48b1-84e4-669dd5486b40)
I: Set the RESUME variable to override this.
/usr/sbin/mkinitramfs: 8: /usr/sbin/mkinitramfs: cpio: Exec format error
E: mkinitramfs failure find 141 cpio 2 gzip 0
update-initramfs: failed for /boot/initrd.img-4.15.0-88-generic with 1.

有人可以帮忙吗

编辑:将 RESUME 变量设置为 none 后

sudo update-initramfs -c -k 4.15.0-88-generic
update-initramfs: Generating /boot/initrd.img-4.15.0-88-generic
/usr/share/initramfs-tools/hooks/amd64_microcode: 106: /usr/share/initramfs-tools/hooks/amd64_microcode: cpio: Exec format error
/usr/share/initramfs-tools/hooks/amd64_microcode: 108: /usr/share/initramfs-tools/hooks/amd64_microcode: cpio: Exec format error
E: amd64-microcode: failed to create or prepend the early initramfs to the initramfs
/usr/sbin/mkinitramfs: 8: /usr/sbin/mkinitramfs: cpio: Exec format error
E: mkinitramfs failure find 141 cpio 2 gzip 0
update-initramfs: failed for /boot/initrd.img-4.15.0-88-generic with 1.

答案1

经过尝试,我认为问题出在 cpio 包上

sudo apt-get install --reinstall cpio gzip initramfs-tools initramfs-tools-core

它起作用了:我之前尝试过重新安装initramfs-tools initramfs-tools-core。并且gzip工作正常,所以我认为是 cpio,因为cpio --version在重新安装之前给出了奇怪的东西


感谢 Terrance

相关内容