在 21.04 中安装任何软件包时出错

在 21.04 中安装任何软件包时出错

使用时出现以下错误apt install

/usr/share/initramfs-tools/hooks/cryptroot: 18: .: cannot open /lib/cryptsetup/functions: No such file
E: /usr/share/initramfs-tools/hooks/cryptroot failed with return 2.
update-initramfs: failed for /boot/initrd.img-5.11.0-31-generic with 2.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error   exit status 2
Errors were encountered while processing:
 initramfs-tools
 E: Sub-process /usr/bin/dpkg returned an error code (1)

根据@Karel 的建议:

安装时收到以下错误cryptsetup

 update-initramfs: Generating /boot/initrd.img-5.11.0-31-generic
 Error: /sbin/zdb is not executable.
 Error: /sbin/zpool is not executable.
 Error: /sbin/zfs is not executable.
 Error: /sbin/mount.zfs is not executable.
 Error: /lib/udev/vdev_id is not executable.
 Error: /lib/udev/zvol_id is not executable.
 E: /usr/share/initramfs-tools/hooks/zfs failed with return 2.
update-initramfs: failed for /boot/initrd.img-5.11.0-31-generic    with 2.
dpkg: error processing package initramfs-tools (--configure):
 installed initramfs-tools package post-installation script        subprocess returned error exit status 2
Errors were encountered while processing:
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

您收到以下错误消息:

无法打开 /lib/cryptsetup/functions:没有此文件

/lib/cryptsetup/functions由 Ubuntu 20.04 及更高版本中的 cryptsetup 提供。

  1. 运行以列出名称中dpkg -l *5.11.0-31*|grep ii包含字符串的已安装软件包。5.11.0-31

  2. 5.11.0-31使用上一步清除名称中包含字符串的软件包,但要小心,只清除内核和支持文件包名称。sudo dpkg -P package_namelinux-

  3. 运行sudo update-grub重建GRUB启动菜单。

  4. 运行sudo reboot以重新启动。

  5. 安装 cryptsetup。

    sudo apt update
    sudo apt install cryptsetup
    

相关内容