ubuntu20.4 执行sudo apt-get update出现错误 libnettle.so.6 动态链接库错误

 一、错误描述

sudo apt-get update 报错提示  libnettle.so.6 动态链接库错误

$ sudo apt update
/usr/lib/apt/methods/https: error while loading shared libraries: libnettle.so.6: cannot open shared object file: No such file or directory
/usr/lib/apt/methods/https: error while loading shared libraries: libnettle.so.6: cannot open shared object file: No such file or directory
/usr/lib/apt/methods/https: error while loading shared libraries: libnettle.so.6: cannot open shared object file: No such file or directory
/usr/lib/apt/methods/https: error while loading shared libraries: libnettle.so.6: cannot open shared object file: No such file or directory
Failed to start apt-news.service: Unit apt-news.service not found.
Failed to start esm-cache.service: Unit esm-cache.service not found.
正在读取软件包列表... 完成
E: Method https has died unexpectedly!
E: 子进程 https 返回了一个错误号 (127)
E: 获取软件包的渠道 /usr/lib/apt/methods/https 所需的驱动程序没有正常启动
E: Method https has died unexpectedly!
E: 子进程 https 返回了一个错误号 (127)
E: 获取软件包的渠道 /usr/lib/apt/methods/https 所需的驱动程序没有正常启动
E: Method https has died unexpectedly!
E: 子进程 https 返回了一个错误号 (127)
E: 获取软件包的渠道 /usr/lib/apt/methods/https 所需的驱动程序没有正常启动
E: Method https has died unexpectedly!
E: 子进程 https 返回了一个错误号 (127)
E: 获取软件包的渠道 /usr/lib/apt/methods/https 所需的驱动程序没有正常启动
E: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic/InRelease
E: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-updates/InRelease
E: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-backports/InRelease
E: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-security/InRelease
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。

 二、错误原因及解决办法

错误原因:

  • 导致原因应该是在安装gnutls的时候报错:Libnettle 3.1 was not found,所以安装 了nettle,之后出现的。
  • 问题应该是在安装 nettle 的时候,安装到了/usr/lib64/lib目录下了。update 默认会到系统目录下/usr/lib下寻找依赖关系,软件按系统依赖查找的原因造成。

解决方法:

  • 查看 nettle 的路径: find /usr -name 'libnettle*' 
$ find /usr -name 'libnettle*'
/usr/lib/x86_64-linux-gnu/libnettle.so.7.0
/usr/lib/x86_64-linux-gnu/libnettle.so.7
/usr/lib64/libnettle.a
/usr/lib64/libnettle.so.6.0
/usr/lib64/libnettle.so.6.4
/usr/lib64/libnettle.so
/usr/lib64/libnettle.so.6
/usr/share/doc/libnettle7

  • 给 /usr/lib64/libnettle.so.6 建立一个的链接到 /usr/lib/libnettle.so.6
$ sudo ln -s /usr/lib64/libnettle.so.6 /usr/lib/libnettle.so.6
  •  查看 nettle 的路径: find /usr -name 'libnettle*' ,多了 /usr/lib/libnettle.so.6
$ find /usr -name 'libnettle*'
/usr/lib/x86_64-linux-gnu/libnettle.so.7.0
/usr/lib/x86_64-linux-gnu/libnettle.so.7
/usr/lib/libnettle.so.6
/usr/lib64/libnettle.a
/usr/lib64/libnettle.so.6.0
/usr/lib64/libnettle.so.6.4
/usr/lib64/libnettle.so
/usr/lib64/libnettle.so.6
/usr/share/doc/libnettle7
  •  试下 sudo apt-get update 现在报错的提示 libhogweed.so.4 动态链接库错误
$ sudo apt update
/usr/lib/apt/methods/https: error while loading shared libraries: libhogweed.so.4: cannot open shared object file: No such file or directory
/usr/lib/apt/methods/https: error while loading shared libraries: libhogweed.so.4: cannot open shared object file: No such file or directory
/usr/lib/apt/methods/https: error while loading shared libraries: libhogweed.so.4: cannot open shared object file: No such file or directory
/usr/lib/apt/methods/https: error while loading shared libraries: libhogweed.so.4: cannot open shared object file: No such file or directory
Failed to start apt-news.service: Unit apt-news.service not found.
Failed to start esm-cache.service: Unit esm-cache.service not found.
正在读取软件包列表... 完成
E: Method https has died unexpectedly!
E: 子进程 https 返回了一个错误号 (127)
E: 获取软件包的渠道 /usr/lib/apt/methods/https 所需的驱动程序没有正常启动
E: Method https has died unexpectedly!
E: 子进程 https 返回了一个错误号 (127)
E: 获取软件包的渠道 /usr/lib/apt/methods/https 所需的驱动程序没有正常启动
E: Method https has died unexpectedly!
E: 子进程 https 返回了一个错误号 (127)
E: 获取软件包的渠道 /usr/lib/apt/methods/https 所需的驱动程序没有正常启动
E: Method https has died unexpectedly!
E: 子进程 https 返回了一个错误号 (127)
E: 获取软件包的渠道 /usr/lib/apt/methods/https 所需的驱动程序没有正常启动
E: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic/InRelease
E: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-updates/InRelease
E: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-backports/InRelease
E: 无法下载 https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/bionic-security/InRelease
E: 部分索引文件下载失败。如果忽略它们,那将转而使用旧的索引文件。
  •  给 /usr/lib64/libhogweed.so.4 建立一个的链接到 /usr/lib/libhogweed.so.4
$ sudo ln -s /usr/lib64/libhogweed.so.4 /usr/lib/libhogweed.so.4
  •  $ sudo apt update
    ~$ sudo apt update
    获取:1 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic InRelease [242 kB]
    获取:2 https://mirrors.tuna.tsinghua.edu.cn/ubuntu bionic-updates InRelease [88.7 kB]
    
    ---------------------
    
    已下载 30.0 MB,耗时 8秒 (3,593 kB/s)
    正在读取软件包列表... 完成
    正在分析软件包的依赖关系树
    正在读取状态信息... 完成
    有 13 个软件包可以升级。请执行 ‘apt list --upgradable’ 来查看它们。

你可能感兴趣的:(libnettle,sudo,apt,update,ubuntu)