E: 配置 dpkg 时,子进程 /usr/bin/dpkg 返回错误代码 (1)

E: 配置 dpkg 时,子进程 /usr/bin/dpkg 返回错误代码 (1)

我尝试通过以下方式强制安装 picoscenes 驱动器

sudo dpkg --force-overwrite -i /var/cache/apt/archives/picoscenes-driver-modules-5.15.0-78-generic_20230803_amd64.deb

在此过程中可能损坏了我的 dpkg 安装程序,鉴于我对 Linux 系统还很陌生,我不确定如何导航,到目前为止我已经尝试过了。

sudo rm /var/cache/apt/archives/picoscenes-driver-modules-5.15.0-78-generic_20230803_amd64.deb

随后sudo apt clean,又给sudo apt install -f我带来了一长串的问题。

Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages were automatically installed and are no longer required:
  amd64-microcode intel-microcode iucode-tool linux-headers-5.15.0-83-generic
  linux-headers-5.4.0-162 linux-headers-5.4.0-162-lowlatency
  linux-headers-generic-hwe-20.04 linux-headers-lowlatency
  linux-hwe-5.15-headers-5.15.0-83 linux-image-unsigned-5.15.0-83-generic
  linux-modules-5.15.0-83-generic linux-modules-5.4.0-162-lowlatency thermald
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: deferring update (trigger activated)
Setting up linux-image-5.15.0-78-generic (5.15.0-78.85~20.04.1) ...
I: /boot/initrd.img is now a symlink to initrd.img-5.15.0-78-generic
Setting up linux-image-unsigned-5.15.0-83-generic (5.15.0-83.92~20.04.1) ...
I: /boot/initrd.img.old is now a symlink to initrd.img-5.15.0-83-generic
Setting up linux-image-5.15.0-73-generic (5.15.0-73.80~20.04.1) ...
Setting up linux-image-5.4.0-155-lowlatency (5.4.0-155.172) ...
Processing triggers for initramfs-tools (0.136ubuntu6.7) ...
update-initramfs: Generating /boot/initrd.img-5.4.0-131-lowlatency
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.4.0-131-lowlatency with 1.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script subprocess returned 
error exit status 1
Processing triggers for linux-image-5.15.0-78-generic (5.15.0-78.85~20.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-78-generic
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.15.0-78-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.15.0-78-generic (--configure):
 installed linux-image-5.15.0-78-generic package post-installation script subpro
cess returned error exit status 1
Processing triggers for linux-image-unsigned-5.15.0-83-generic (5.15.0-83.92~20.
04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-83-generic
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.15.0-83-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-unsigned-5.15.0-83-generic (--configu
re):
 installed linux-image-unsigned-5.15.0-83-generic package post-installation scri
pt subprocess returned error exit status 1
Processing triggers for linux-image-5.15.0-73-generic (5.15.0-73.80~20.04.1) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.15.0-73-generic
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.15.0-73-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.15.0-73-generic (--configure):
 installed linux-image-5.15.0-73-generic package post-installation script subpro
cess returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Processing trigger
s for linux-image-5.4.0-155-lowlatency (5.4.0-155.172) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.4.0-155-lowlatency
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-5.4.0-155-lowlatency with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
dpkg: error processing package linux-image-5.4.0-155-lowlatency (--configure):
 installed linux-image-5.4.0-155-lowlatency package post-installation script sub
process returned error exit status 1
No apport report written because MaxReports is reached already
                                                              Errors were encoun
tered while processing:
 initramfs-tools
 linux-image-5.15.0-78-generic
 linux-image-unsigned-5.15.0-83-generic
 linux-image-5.15.0-73-generic
 linux-image-5.4.0-155-lowlatency
E: Sub-process /usr/bin/dpkg returned an error code (1)

意识到 intramfs-tools 和 Linux 内核映像存在问题后,我尝试

sudo apt remove initramfs-tools
sudo apt clean
sudo apt install initramfs-tools

然后通过查找过时的 Linux 映像dpkg --list | grep linux-image并将其删除,然后sudo apt install-f,这让我回到同样的错误。

分发和版本信息

NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"

更新:我意识到我需要删除配置文件才能完全删除 Linux 映像

sudo dpkg --purge linux-image-5.4.0-152-lowlatency

修复了一些问题,最后一个问题仍与 initramfs-tools 有关。我尝试过清除,然后重新安装,但还是出现错误

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:
 initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

相关内容