子进程 /usr/bin/dpkg 返回错误代码 (1)。尝试升级

子进程 /usr/bin/dpkg 返回错误代码 (1)。尝试升级

当我尝试安装任何东西时,遇到以下错误。

Do you want to continue? [Y/n] y
Setting up linux-image-4.13.5-041305-generic (4.13.5-041305.201710050600) ...
Running depmod.
update-initramfs: deferring update (hook will be called later)
The link /initrd.img is a dangling linkto /boot/initrd.img-4.13.5-041305-generic
vmlinuz(/boot/vmlinuz-4.13.5-041305-generic
) points to /boot/vmlinuz-4.13.5-041305-generic
 (/boot/vmlinuz-4.13.5-041305-generic) -- doing nothing at /var/lib/dpkg/info/linux-image-4.13.5-041305-generic.postinst line 491.
Examining /etc/kernel/postinst.d.
run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.13.5-041305-generic /boot/vmlinuz-4.13.5-041305-generic
run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.13.5-041305-generic /boot/vmlinuz-4.13.5-041305-generic
update-initramfs: Generating /boot/initrd.img-4.13.5-041305-generic
E: /usr/share/initramfs-tools/hooks/fixrtc failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.13.5-041305-generic with 1.
run-parts: /etc/kernel/postinst.d/initramfs-tools exited with return code 1
Failed to process /etc/kernel/postinst.d at /var/lib/dpkg/info/linux-image-4.13.5-041305-generic.postinst line 1052.
dpkg: error processing package linux-image-4.13.5-041305-generic (--configure):
 subprocess installed post-installation script returned error exit status 2
Errors were encountered while processing:
 linux-image-4.13.5-041305-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)

我重启了很多次,但都没有成功。我已经安装了 shadowsocksR 和 openvpn。不知道我在安装这两个软件时是否遇到了这个问题。有人能帮我吗?

谢谢。

答案1

我遇到了同样的问题,并做了一些调试。在我的计算机上,这是内容的最后一部分/usr/share/initramfs-tools/hooks/fixrtc

# We use date, hwclock and dumpe2fs
copy_exec /bin/date /bin
copy_exec /sbin/hwclock /sbin
copy_exec /sbin/dumpe2fs /sbin

看来这个钩子的任务是将这三个工具添加到 initramfs 中。当你运行 时update-initramfs -u -k all -v,它会向你提供详细的输出,说明它做了什么以及何时失败。对我来说,它处理了datehwclock然后失败了。所以很明显,它无法添加dumpe2fs

为了解决这个问题,我dumpe2fs使用以下命令进行安装:sudo apt install e2fsprogs。之后,它运行正常。

相关内容