升级后我无法再使用 apt install

升级后我无法再使用 apt install

我已经看到了一些与同一问题相关的问题,但我似乎找不到针对我的具体情况的解决方案。所以我开始吧。

我的 apt 和 dpkg 安装有问题。尝试下载软件包(此处为 python3-pydrive)时,出现此错误:

$ sudo apt install python3-pydrive
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  hwinfo libhd21 libx86emu3
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  python3-cachetools python3-google-auth python3-google-auth-httplib2
  python3-googleapi python3-greenlet python3-oauth2client python3-openssl
  python3-pyasn1 python3-pyasn1-modules python3-rsa python3-sqlalchemy
  python3-sqlalchemy-ext python3-uritemplate
Suggested packages:
  python-greenlet-dev python-greenlet-doc python-openssl-doc
  python3-openssl-dbg python-sqlalchemy-doc python3-fdb python3-pymssql
  python3-mysqldb python3-psycopg2 python3-asyncpg python3-aiosqlite
The following packages will be REMOVED:
  linux-image-5.13.0-39-generic
The following NEW packages will be installed:
  python3-cachetools python3-google-auth python3-google-auth-httplib2
  python3-googleapi python3-greenlet python3-oauth2client python3-openssl
  python3-pyasn1 python3-pyasn1-modules python3-pydrive python3-rsa
  python3-sqlalchemy python3-sqlalchemy-ext python3-uritemplate
0 upgraded, 14 newly installed, 1 to remove and 186 not upgraded.
1 not fully installed or removed.
Need to get 0 B/1’417 kB of archives.
After this operation, 1’337 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 202163 files and directories currently installed.)
Removing linux-image-5.13.0-39-generic (5.13.0-39.44) ...
/etc/kernel/postrm.d/initramfs-tools:
update-initramfs: Deleting /boot/initrd.img-5.13.0-39-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 theme: /usr/share/grub/themes/kawaiki/theme.txt
/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-39-generic (--remove):
 installed linux-image-5.13.0-39-generic package post-removal script subprocess return
ed error exit status 1
dpkg: too many errors, stopping
Errors were encountered while processing:
 linux-image-5.13.0-39-generic
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

我把原因缩小到 grub-customizer。我的发行版出现了一些问题,并且已经重置了一次安装。虽然我前段时间使用 grub-customizer 设置了 grub 以使其看起来更好,但通过重置我没有保留原始 grub-customizer 安装,因此不再有该应用程序。

这是我尝试过的

我读过这些问题

https://ubuntuforums.org/showthread.php?t=2474284
https://serverfault.com/questions/818445/error-while-loading-shared-libraries-libcrypto-so-1-1
升级到 22.04 后无法删除旧的 linux 镜像
从 18.10 升级到 19.04 后如何修复内核问题?
如何正确重置所有 grub/boot 设置?
升级到 Ubuntu 22.04 导致 libcrypto 错误,apt/dpkg 损坏
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/1969353

我通过以下方式手动下载并安装了缺失的 libssl1 库https://packages.ubuntu.com/impish/libssl1.1并且sudo dpkg --install libssl1.1*.deb运行正常,但问题并未解决。我尝试重置 grub,但我不知道该怎么做,而且没有update-grub成功。我记不清我做了什么,但我几乎做了上面帖子中能做的一切。

有什么想法我可以尝试吗?

编辑:按顺序回答前 4 条评论:

apt autoremove失败并出现相同错误

我正在使用 Ubuntu 22.04 LTS

mkdir $HOME/backup最后一步失败,出现同样的sudo mv /etc/grub.d/bin/ $HOME/backup/错误sudo apt -f install

是的,通过安装 libssl1 库,应该可以修复该问题。但错误仍然存​​在。我检查了一下,该库安装的文件确实/usr/lib/i386-linux-gnu/libcrypto.so.1.1存在。

有效!!!

谢谢没有人解决方案!我运行了这个来修复它。它基本上将许多 grub 文件移动到备份文件夹。

mkdir $HOME/backup
sudo mv /etc/grub.d/bin/ $HOME/backup/
ls /etc/grub.d/ | grep proxy | xargs -I '{}' mv {} $HOME/backup/

答案1

为了将其添加为答案,以下两件事有所帮助:

重新安装 libssl1 库:
https://packages.ubuntu.com/impish/libssl1.1sudo dpkg --install libssl1.1*.deb

并删除旧的 grub 文件:

mkdir $HOME/backup
sudo mv /etc/grub.d/bin/ $HOME/backup/
ls /etc/grub.d/ | grep proxy | xargs -I '{}' mv {} $HOME/backup/

相关内容