解决 Ubuntu 无法定位软件包问题

本部分主要介绍:解决 E:无法定位软件包 错误,提供两种方法解决。一种为无图像界面;另一种为有图形界面的

E:无法定位软件包:产生原因

  1. 产生 E:无法定位软件包 安全提示原因有很多。如网络链接问题、apt 源过期等……。

    • 问题如下

      shen@shen-Ubuntu:~$ sudo apt install tree
      正在读取软件包列表... 完成
      正在分析软件包的依赖关系树 
      正在读取状态信息... 完成 
      E: 无法定位软件包 tree
      
    • 一般提示方法有执行 sudo apt-get update 更新源列表,但是往往此命令执行等待时间长,或者直接报错等问题(源服务器不在中国大陆,网络链接有问题)。

    • 实际解决此错误的根本在于 /etc/apt/sources.list 文件,也就是源列表,将源服务器更改为中国大陆的服务器,便可解决以上问题。

    • 参考地址

解决 Ubuntu 无法定位软件包:E:无法定位软件包

  1. 解决问题方法一

    • 备份 /etc/apt/sources.list 文件

      1. 执行命令 sudo cp /etc/apt/sources.list /etc/apt/sources.list.old
    • 打开 /etc/apt/sources.list 文件,删除文件原有内容,再复制粘贴 阿里的源 (网易、清华都可以)

      1. 打开文件 sudo vim /etc/apt/sources.list

      2. 复制阿里源(Ubuntu18.04 配置如下)

        deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
        deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
        ​
        deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
        deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
        ​
        deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
        deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
        ​
        deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
        deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
        ​
        deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
        deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
        
    • 重新获取软件包列表

      1. sudo apt-get update
    • 在执行安装命令

      1. sudo apt-get install tree
  2. 解决问题方法二

    • 步骤 1

      步骤一.png
    • 步骤 2

      步骤二.png
    • 步骤 3

      步骤三.png
    • 步骤 4

      步骤四.png
    • 重新获取软件包列表 ,执行 sudo apt-get update 命令

      shen@shen-Ubuntu:~$ sudo apt-get update
      [sudo] shen 的密码: 
      命中:1 http://mirrors.aliyun.com/ubuntu bionic InRelease
      命中:2 http://mirrors.aliyun.com/ubuntu bionic-updates InRelease 
      命中:3 http://mirrors.aliyun.com/ubuntu bionic-backports InRelease 
      命中:4 http://mirrors.aliyun.com/ubuntu bionic-security InRelease              
      命中:5 http://archive.canonical.com/ubuntu bionic InRelease
      正在读取软件包列表... 完成
      
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容