![Ubuntu 在 sudo apt-get update 上仅检查 5 个链接](https://linux22.com/image/885395/Ubuntu%20%E5%9C%A8%20sudo%20apt-get%20update%20%E4%B8%8A%E4%BB%85%E6%A3%80%E6%9F%A5%205%20%E4%B8%AA%E9%93%BE%E6%8E%A5.png)
我今天安装了 Ubuntu 16.04 LTS,然后通过以下方式启用了 universe:
sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
之后我跑了:
sudo apt-get update
列表中显示了相当多的链接。
之后我运行了软件更新程序中途坠毁。 后重启它很好地安装了更新,但再次重启后,每当我运行 apt-get update 时,只需 5 个链接出现,而不是50~60前。
这 5 个链接是:
aditya@Aditya-ASUS:~$ sudo apt-get update
[sudo] password for aditya:
Hit:1 http://archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://security.ubuntu.com/ubuntu xenial-security InRelease [94.5 kB]
Hit:3 http://in.archive.ubuntu.com/ubuntu xenial InRelease
Get:4 http://in.archive.ubuntu.com/ubuntu xenial-updates InRelease [95.7 kB]
Hit:5 http://in.archive.ubuntu.com/ubuntu xenial-backports InRelease
Fetched 190 kB in 2s (71.2 kB/s)
Reading package lists... Done
这是正常的吗或者有问题。
这是我的 Sources.list:
# deb cdrom:[Ubuntu 16.04 LTS _Xenial Xerus_ - Release amd64 (20160420.1)]/ xenial main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://in.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## universe WILL NOT receive any review or updates from the Ubuntu security
## team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial universe
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates universe
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team, and may not be under a free licence. Please satisfy yourself as to
## your rights to use the software. Also, please note that software in
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://in.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://in.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
deb http://archive.ubuntu.com/ubuntu xenial universe main multiverse restricted
# deb-src http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse
# deb-src http://archive.ubuntu.com/ubuntu xenial main universe restricted multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse
答案1
这是正常现象,无需担心。出于某种原因,很难找到关于从 apt-get 到 apt 的更改的文档,但在 16.04 发布周期(或可能是在早期版本 15.10)期间发生了变化,切换到新的 apt 工具,它只更新不同的源,我认为它使用校验和来查看源文件是否确实发生了变化。
答案2
sudo apt-get update
从存储库中获取软件包列表的索引。但它是按顺序进行的,这既是为了安全,也是为了减少软件包索引的下载大小。
对于每个存储库,
第一的,它会尝试将在线存储库中的文件(内联签名文件)的修改时间InRelease
与您计算机中已下载的文件(如果有)的修改时间进行匹配。
如果它发现
InRelease
文件在在线存储库中未被修改,它就不会继续下载索引文件(Packages.gz 等),这些文件更大,是实际索引,前提是它已下载到您的计算机中。因为未修改的签名意味着索引文件未被修改。如果发现
InRelease
文件的修改日期已更改,它将首先获取文件InRelease
。然后再次尝试将校验InRelease
和(在文件中找到)与已下载的索引进行匹配。如果匹配,则不会下载索引。否则,下载索引。
幕后还做了更多的事情。但基本上就你的情况而言,这意味着,由于你刚刚用 更新了软件包列表sudo apt-get update
,因此稍后的输出较短是正常的,因为在这个较短的时间段内,存储库中没有任何变化。
查看此处了解更多信息: