安装/更新时 initramfs 出现错误

安装/更新时 initramfs 出现错误

apt大约一周以来,我在更新或运行任何命令时都遇到了错误。升级到 LTS 18.04 并没有解决这个问题,删除所有旧内核也没有解决这个问题。空间也不是问题。

尝试重新安装initramfs无效。我收到的错误是:

   Reading package lists...
Building dependency tree...
Reading state information...
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up linux-image-4.15.0-47-generic (4.15.0-47.50) ...
Setting up initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: deferring update (trigger activated)
Processing triggers for linux-image-4.15.0-47-generic (4.15.0-47.50) ...
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-4.15.0-47-generic
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.15.0-47-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-47-generic (--configure):
 installed linux-image-4.15.0-47-generic package post-installation script subprocess returned error exit status 1
Processing triggers for initramfs-tools (0.130ubuntu3.7) ...
update-initramfs: Generating /boot/initrd.img-4.15.0-47-generic
E: /usr/share/initramfs-tools/hooks/fsck failed with return 1.
update-initramfs: failed for /boot/initrd.img-4.15.0-47-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-4.15.0-47-generic
 initramfs-tools

谁知道我能做什么?

谢谢。

答案1

运行自动删除和清理对我的情况有用。

apt-get auto-remove && apt-get clean && apt-get update && apt-get upgrade

答案2

警告:如果你的硬盘已加密,请不要这样做,除非你确切知道自己在做什么

initramfs-tools对我来说,这是包装的问题

我已经做了:

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

然后我不再收到错误

@jameshibbard 提出了一个重要的观点:如果您使用全驱动器加密,或者加密您的 initramfs 输出(squashfs vmlinuz pacakges in /boot)作为新功能,请小心,因为切换版本initramfs-tools可能会使您的系统无法启动。

如果你不知道这意味着什么,那么你的系统很可能不是加密,除非您记得在安装过程中选择它。我注意到现在有些图形安装程序将其作为一个选项,如果我没记错的话,包括 Ubuntu。

尽职尽责。

答案3

我已经遇到这个错误一年多了。现在我找到了解决办法。

cd ~
mkdir initramfs
cd initramfs
sudo cp -a /boot .
cd boot
sudo update-initramfs -ut -b .
sudo cp -a * /boot
sudo apt-get autoremove

解释:/boot 位于不同的分区,空间不足,无法执行操作。解决方案:在有足够空间的驱动器上执行更新,然后复制回结果。

答案4

sudo apt remove initramfs-tools
sudo apt clean
sudo apt install initramfs-tools
sudo apt-get autoremove
sudo apt-get autoclean
sudo apt-get clean
sudo apt-get update 
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get -f install
sudo dpkg --configure -a

这对我来说就是解决方案。

相关内容