升級到 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 驅動程式存在問題,我想升級到5.17.4撰寫本文時最新的 Linux 核心。

我找到了一個指導在線,並安裝了內核的 .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 安裝它。例如我直接下載了amd64版本軟體包.debian.org然後使用安裝它

sudo dpkg -i libssl1.1*.deb

之後我就可以再使用 apt 了。

這樣做之後,我意識到您還可以搜索Ubuntu 軟體包儲存庫。他們顯然沒有為 Ubuntu 22.04 提供 libssl1.1 的安裝候選,只為 libssl3 提供一個。也許這就是問題的核心。您還應該能夠使用升級後的版本中的版本。然而,一位來自軟體包.debian.org對我來說效果很好。

答案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

另外,如果上面的網址變成 404,您也可以在這裡取得更新的網址:

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

答案3

對我來說問題的根源是grub-customizer升級到22.04時我丟失了。如果您遇到相同的問題,這個解決方案可能會更好(信用來自 vachaj11https://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/statusfrom half-installedto中的對應條目來完成此操作config-files。使用以下命令在 gedit 中開啟:

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

相關內容