Ubuntu的Unable to locate package无法更新源问题解决方案

Posted 秋寻草

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu的Unable to locate package无法更新源问题解决方案相关的知识,希望对你有一定的参考价值。

https://blog.csdn.net/long19910605/article/details/47017889/

问题:

  更新源时提示不能联网(does the network require authentication?),但是明明可以ping通外网啊,原来是不能访问这个默认源,所以更换一下源

[email protected]:~$ sudo apt-get update 
Get:1 http://ppa.launchpad.net/nginx/stable/ubuntu xenial InRelease [2,281 B]
Err:1 http://ppa.launchpad.net/nginx/stable/ubuntu xenial InRelease
  Clearsigned file isnt valid, got NOSPLIT (does the network require authentication?)
Fetched 2,281 B in 0s (4,585 B/s)
Reading package lists... Done
E: Failed to fetch http://ppa.launchpad.net/nginx/stable/ubuntu/dists/xenial/InRelease  Clearsigned file isn‘t valid, got ‘NOSPLIT‘ (does the network require authentication?)
E: Some index files failed to download. They have been ignored, or old ones used instead.
[email protected]:~$ sudo apt-get install nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package nginx

 

  编辑:sudo vi /etc/apt/sources.list

在下方添加163的源

deb http://mirrors.163.com/ubuntu/ precise main restricted
deb-src http://mirrors.163.com/ubuntu/ precise main restricted
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted
deb http://mirrors.163.com/ubuntu/ precise universe
deb-src http://mirrors.163.com/ubuntu/ precise universe
deb http://mirrors.163.com/ubuntu/ precise-updates universe
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe
deb http://mirrors.163.com/ubuntu/ precise multiverse
deb-src http://mirrors.163.com/ubuntu/ precise multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted
deb http://mirrors.163.com/ubuntu/ precise-security universe
deb-src http://mirrors.163.com/ubuntu/ precise-security universe
deb http://mirrors.163.com/ubuntu/ precise-security multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse
deb http://extras.ubuntu.com/ubuntu precise main
deb-src http://extras.ubuntu.com/ubuntu precise main

再次执行:sudo apt-get update

     sudo apt install nginx

[email protected]:~$ sudo apt-get update
Ign:1 http://mirrors.163.com/ubuntu precise InRelease
Get:2 http://mirrors.163.com/ubuntu precise Release [49.6 kB]
Get:3 http://mirrors.163.com/ubuntu precise Release.gpg [198 B]
Get:4 http://mirrors.163.com/ubuntu precise/main amd64 Packages [1,273 kB]
Get:5 http://mirrors.163.com/ubuntu precise/main i386 Packages [1,274 kB]
Get:6 http://mirrors.163.com/ubuntu precise/restricted amd64 Packages [8,452 B]
Get:7 http://mirrors.163.com/ubuntu precise/restricted i386 Packages [8,431 B]
Get:8 http://mirrors.163.com/ubuntu precise/universe amd64 Packages [4,786 kB]
Get:9 http://mirrors.163.com/ubuntu precise/universe i386 Packages [4,796 kB]
Get:10 http://mirrors.163.com/ubuntu precise/multiverse amd64 Packages [119 kB]
Get:11 http://mirrors.163.com/ubuntu precise/multiverse i386 Packages [121 kB]
Fetched 12.4 MB in 6s (1,952 kB/s)                                                                                                                                                                                                              
AppStream cache update completed, but some metadata was ignored due to errors.
Reading package lists... Done
W: http://mirrors.163.com/ubuntu/dists/precise/Release.gpg: Signature by key 630239CC130E1A7FD81A27B140976EAF437D05B5 uses weak digest algorithm (SHA1)
[email protected]:~$ sudo apt install nginx
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libgd2-noxpm nginx-common nginx-full
Suggested packages:
  libgd-tools
The following NEW packages will be installed:
  libgd2-noxpm nginx nginx-common nginx-full
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 604 kB of archives.
After this operation, 1,865 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.163.com/ubuntu precise/main amd64 libgd2-noxpm amd64 2.0.36~rc1~dfsg-6ubuntu2 [200 kB]
Get:2 http://mirrors.163.com/ubuntu precise/universe amd64 nginx-common all 1.1.19-1 [17.8 kB]
Get:3 http://mirrors.163.com/ubuntu precise/universe amd64 nginx-full amd64 1.1.19-1 [379 kB]
Get:4 http://mirrors.163.com/ubuntu precise/universe amd64 nginx all 1.1.19-1 [6,612 B]
Fetched 604 kB in 0s (825 kB/s)
Selecting previously unselected package libgd2-noxpm:amd64.
(Reading database ... 219416 files and directories currently installed.)
Preparing to unpack .../libgd2-noxpm_2.0.36~rc1~dfsg-6ubuntu2_amd64.deb ...
Unpacking libgd2-noxpm:amd64 (2.0.36~rc1~dfsg-6ubuntu2) ...
Selecting previously unselected package nginx-common.
Preparing to unpack .../nginx-common_1.1.19-1_all.deb ...
Unpacking nginx-common (1.1.19-1) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../nginx-full_1.1.19-1_amd64.deb ...
Unpacking nginx-full (1.1.19-1) ...
Selecting previously unselected package nginx.
Preparing to unpack .../nginx_1.1.19-1_all.deb ...
Unpacking nginx (1.1.19-1) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for systemd (229-4ubuntu21.4) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libgd2-noxpm:amd64 (2.0.36~rc1~dfsg-6ubuntu2) ...
Setting up nginx-common (1.1.19-1) ...
Setting up nginx-full (1.1.19-1) ...
Setting up nginx (1.1.19-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for ufw (0.35-0ubuntu2) ...
Processing triggers for systemd (229-4ubuntu21.4) ...
Processing triggers for ureadahead (0.100.0-19) ...

 

以上是关于Ubuntu的Unable to locate package无法更新源问题解决方案的主要内容,如果未能解决你的问题,请参考以下文章

ubuntu Unable to locate package sysv-rc-conf

Ubuntu的Unable to locate package无法更新源问题解决方案

Ubuntu安装pip提示Unable to locate package python3-pip3

[Ubuntu] Error: unable to locate package{成功解决}

[Ubuntu] Error: unable to locate package{成功解决}

[Ubuntu] Error: unable to locate package{成功解决}