升级到 Ubuntu 22.04 导致 libcrypto 错误,apt/dpkg 损坏

升级到 Ubuntu 22.04 导致 libcrypto 错误,apt/dpkg 损坏

我使用的是 Ubuntu 22.04(Jammy Jellyfish),今天从 21.10 升级。我的机器是华硕 Vivobook K3500PH,配备英特尔 i7 第 11 代处理器、Nvidia GTX 1650 Max-Q 显卡。我的系统最初有一个 Linux 5.15 内核,最近从 5.13 内核升级而来。

编辑:此线程也适用于那些没有安装新内核但升级到 Ubuntu 22.04 的人。

背景信息

由于我的 Wi-Fi 驱动程序存在问题,我想升级到最新的 Linux 内核,即5.17.4本文撰写时的最新内核。

我发现了一个指导在线安装内核的 .deb 文件https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.17.4/amd64/。之后,我继续运行sudo dpkg -i *.deb,安装.deb下载的文件。

遇到错误

安装失败,

Reading database ... 224038 files and directories currently installed.)
Preparing to unpack linux-headers-5.17.4-051704_5.17.4-051704.202204200842_all.deb ...
Unpacking linux-headers-5.17.4-051704 (5.17.4-051704.202204200842) over (5.17.4-051704.202204200842) ...
Preparing to unpack linux-headers-5.17.4-051704-generic_5.17.4-051704.202204200842_amd64.deb ...
Unpacking linux-headers-5.17.4-051704-generic (5.17.4-051704.202204200842) over (5.17.4-051704.202204200842) ...
Preparing to unpack linux-image-unsigned-5.17.4-051704-generic_5.17.4-051704.202204200842_amd64.deb ...
Unpacking linux-image-unsigned-5.17.4-051704-generic (5.17.4-051704.202204200842) over (5.17.4-051704.202204200842) ...
/var/lib/dpkg/info/linux-image-unsigned-5.17.4-051704-generic.postrm ... removing pending trigger
Preparing to unpack linux-modules-5.17.4-051704-generic_5.17.4-051704.202204200842_amd64.deb ...
Unpacking linux-modules-5.17.4-051704-generic (5.17.4-051704.202204200842) over (5.17.4-051704.202204200842) ...
Setting up linux-headers-5.17.4-051704 (5.17.4-051704.202204200842) ...
Setting up linux-headers-5.17.4-051704-generic (5.17.4-051704.202204200842) ...
/etc/kernel/header_postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.17.4-051704-generic
   ...done.
Setting up linux-image-unsigned-5.17.4-051704-generic (5.17.4-051704.202204200842) ...
Setting up linux-modules-5.17.4-051704-generic (5.17.4-051704.202204200842) ...
Processing triggers for linux-image-unsigned-5.17.4-051704-generic (5.17.4-051704.202204200842) ...
/etc/kernel/postinst.d/dkms:
 * dkms: running auto installation service for kernel 5.17.4-051704-generic
   ...done.
/etc/kernel/postinst.d/initramfs-tools:
update-initramfs: Generating /boot/initrd.img-5.17.4-051704-generic
I: The initramfs will attempt to resume from /dev/nvme0n1p5
I: (UUID=11ad606c-1f98-4dc1-b567-9b3fe528bd2e)
I: Set the RESUME variable to override this.
/etc/kernel/postinst.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.17.4-051704-generic
Found initrd image: /boot/initrd.img-5.17.4-051704-generic
Found linux image: /boot/vmlinuz-5.15.0-25-generic
Found initrd image: /boot/initrd.img-5.15.0-25-generic
Found linux image: /boot/vmlinuz-5.13.0-40-generic
Found initrd image: /boot/initrd.img-5.13.0-40-generic
/etc/grub.d/bin/grubcfg_proxy: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
run-parts: /etc/kernel/postinst.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-unsigned-5.17.4-051704-generic (--install):
 installed linux-image-unsigned-5.17.4-051704-generic package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 linux-image-unsigned-5.17.4-051704-generic

/etc/grub.d/bin/grubcfg_proxy: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory,我推断可能缺少一个库。根据Stack Exchange 帖子,我去安装所需的库。

但是,无论何时运行apt,对于我尝试过的任何包,都会显示此错误日志:

The following packages will be REMOVED:
  linux-image-5.13.0-19-generic
........
Fetched 140 kB in 2s (80.2 kB/s) 
(Reading database ... 224038 files and directories currently installed.)
Removing linux-image-5.13.0-19-generic (5.13.0-19.19) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.13.0-19-generic
/etc/kernel/postrm.d/zz-update-grub:
Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.17.4-051704-generic
Found initrd image: /boot/initrd.img-5.17.4-051704-generic
Found linux image: /boot/vmlinuz-5.15.0-25-generic
Found initrd image: /boot/initrd.img-5.15.0-25-generic
Found linux image: /boot/vmlinuz-5.13.0-40-generic
Found initrd image: /boot/initrd.img-5.13.0-40-generic
/etc/grub.d/bin/grubcfg_proxy: error while loading shared libraries: libcrypto.so.1.1: cannot open shared object file: No such file or directory
run-parts: /etc/kernel/postrm.d/zz-update-grub exited with return code 127
dpkg: error processing package linux-image-5.13.0-19-generic (--remove):
 installed linux-image-5.13.0-19-generic package post-removal script subprocess returned error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.13.0-19-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

它好像apt坏了,所以我无法安装任何库或软件。

两个错误都指向缺少libcrypto....,因此这可能是错误。我该如何解决这个问题,并安装更新的 Linux 内核版本?

编辑视图https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1969353更多细节。

答案1

从 20.04 升级到 22.04 后,我遇到了同样的问题,但没有尝试安装新内核。

失踪者libcrypto.so.1.1是其一部分libssl1.1,需要安装才能修复此问题。虽然 apt 在这种情况下会损坏,但您仍然可以手动下载适合您的发行版的正确 .deb,然后使用 dpkg 安装它。例如,我直接从软件包信息网然后使用安装

sudo dpkg -i libssl1.1*.deb

之后我就可以再次使用 apt 了。

完成此操作后,我意识到您还可以搜索Ubuntu 软件包存储库。他们显然没有为 Ubuntu 22.04 提供 libssl1.1 的安装候选,只为 libssl3 提供。这可能是问题的核心。您还应该能够使用您升级的版本中的那个。但是,来自软件包信息网对我来说很好用。

答案2

手动安装 libssl1.1 也解决了我的问题:

wget http://debian.mirror.ac.za/debian/pool/main/o/openssl/libssl1.1_1.1.1o-1_amd64.deb
sudo dpkg -i libssl1.1_1.1.1o-1_amd64.deb

如果上面的 URL 变成 404,您也可以在这里获取更新的 URL:

https://packages.debian.org/sid/amd64/libssl1.1/download

答案3

对我来说,问题的根源是我grub-customizer在升级到 22.04 时丢失了。如果你有同样的问题,这个解决方案可能会更好(感谢 vachaj11 来自https://ubuntuforums.org/showthread.php?t=2474284&page=2&p=14095298#post14095298

1.重新安装 grub-customizer

您必须手动添加源 ppa,可以通过运行以下命令执行:

sudo add-apt-repository ppa:danielrichter2007/grub-customizer

现在尝试使用以下命令安装 grub-customizer:

sudo apt install grub-customizer

这有可能会失败,因为 apt 在安装 之前会先尝试删除损坏的 linux-image... 包(并失败,结束整个过程)grub-customizer。如果是这种情况,您必须暂时将 linux-image... 包标记为已卸载,而不是half-installed。例如,您可以通过直接将 中的相应条目修改为 来执行此操作。/var/lib/dpkg/status使用gedit 打开:half-installedconfig-files

sudo gedit /var/lib/dpkg/status

搜索linux-image-5.13.0-46-generic(您的版本可能不同,它是无法卸载的包)。从行尾Status:删除half-installed并替换为config-files。现在保存文件并:

sudo apt install grub-customizer

一定能完成。

2. 打开 grub-customizer

现在修复 grub,如果它有任何损坏。在我的情况下,打开 grub-customizer 后,我得到了更新 grub 的选项,我照做了。我还根据需要重新排序。此外,它还合并了我之前看到的 grub 中的重复条目。

3.卸载损坏的软件包

如果您之前将 linux-image... 的状态更改为config-files,则必须将其恢复为 ,half-installed以便 apt 识别出其中存在问题。现在运行:

sudo apt autoremove

最后应该删除该包。

答案4

手动安装 libssl1.1 解决了我的问题。

wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb

sudo dpkg -i libssl1.1_1.1.1l-1ubuntu1.2_amd64.deb

相关内容