首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >apt更新与apt-获取更新

apt更新与apt-获取更新
EN

Unix & Linux用户
提问于 2022-04-24 18:26:23
回答 1查看 732关注 0票数 2

多年来,我一直觉得apt updateapt-get update的结果是相同的。顺便说一句-是的,我知道aptapt-get并不完全一样。

我最近注意到,一旦我在Ubuntu框上运行apt update,它就会检查13个源代码,而apt-get update只检查7个源代码。此外,在/etc/apt/sources.list/etc/apt/sources.list.d/*下面列出了总共7个更新源

我无法在网上找到任何有关这方面的信息。有谁能给我解释一下吗?

*编辑这里是一个类似的输出来自我的造币盒。它表现出了同样的行为。我可能遗漏了什么,但不知道是什么。

代码语言:javascript
复制
pcko@MBP12:~$ sudo apt update
[sudo] password for pcko:     
Ign:1 http://packages.linuxmint.com una InRelease
Hit:2 http://packages.linuxmint.com una Release                                
Hit:4 http://packages.microsoft.com/repos/code stable InRelease                
Hit:5 http://archive.canonical.com/ubuntu focal InRelease                      
Hit:6 http://archive.ubuntu.com/ubuntu focal InRelease              
Get:7 http://archive.ubuntu.com/ubuntu focal-updates InRelease [114 kB]
Get:8 http://archive.ubuntu.com/ubuntu focal-backports InRelease [108 kB]
Get:9 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]
Get:10 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages [1,745 kB]
Get:11 http://archive.ubuntu.com/ubuntu focal-updates/main amd64 DEP-11 Metadata [277 kB]
Get:12 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 Packages [918 kB]
Get:13 http://security.ubuntu.com/ubuntu focal-security/main amd64 DEP-11 Metadata [40.6 kB]
Get:14 http://archive.ubuntu.com/ubuntu focal-updates/universe amd64 DEP-11 Metadata [390 kB]
Get:15 http://security.ubuntu.com/ubuntu focal-security/universe amd64 DEP-11 Metadata [66.3 kB]
Get:16 http://archive.ubuntu.com/ubuntu focal-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:17 http://archive.ubuntu.com/ubuntu focal-backports/main amd64 DEP-11 Metadata [7,980 B]
Get:18 http://archive.ubuntu.com/ubuntu focal-backports/universe amd64 DEP-11 Metadata [30.8 kB]
Get:19 http://security.ubuntu.com/ubuntu focal-security/multiverse amd64 DEP-11 Metadata [2,464 B]
Fetched 3,816 kB in 2s (1,574 kB/s)                                          
Reading package lists... Done
Building dependency tree       
Reading state information... Done
211 packages can be upgraded. Run 'apt list --upgradable' to see them.

pcko@MBP12:~$ sudo apt-get update
Ign:1 http://packages.linuxmint.com una InRelease
Hit:2 http://packages.linuxmint.com una Release                                                                                                              
Hit:3 http://packages.microsoft.com/repos/code stable InRelease                                                                                              
Hit:4 http://archive.ubuntu.com/ubuntu focal InRelease                                                                                                       
Hit:6 http://security.ubuntu.com/ubuntu focal-security InRelease                                             
Hit:7 http://archive.canonical.com/ubuntu focal InRelease                                          
Hit:8 http://archive.ubuntu.com/ubuntu focal-updates InRelease               
Hit:9 http://archive.ubuntu.com/ubuntu focal-backports InRelease
Reading package lists... Done

pcko@MBP12:~$ cd /etc/apt
pcko@MBP12:/etc/apt$ ls
apt.conf.d  auth.conf.d  preferences.d  sources.list  sources.list.d  trusted.gpg.d

pcko@MBP12:/etc/apt$ cat sources.list
#deb cdrom:[Linux Mint 20.3 _Una_ - Release amd64 20220104]/ focal contrib main

# This system was installed using small removable media
# (e.g. netinst, live or single CD). The matching "deb cdrom"
# entries were disabled at the end of the installation process.
# For information about how to configure apt package sources,
# see the sources.list(5) manual.

pcko@MBP12:/etc/apt$ cd sources.list.d/
pcko@MBP12:/etc/apt/sources.list.d$ ls
official-package-repositories.list  vscode.list

pcko@MBP12:/etc/apt/sources.list.d$ cat official-package-repositories.list 
# Do not edit this file manually, use Software Sources instead.

deb http://packages.linuxmint.com una main upstream import backport #id:linuxmint_main

deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu/ focal-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ focal partner

pcko@MBP12:/etc/apt/sources.list.d$ cat vscode.list 
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64,arm64,armhf] http://packages.microsoft.com/repos/code stable main
EN

回答 1

Unix & Linux用户

发布于 2022-04-28 03:14:29

经过进一步研究,我同意@muru的评论是正确的:

请注意,如果apt发现现有信息是最新的(我不记得检查的确切机制,可能是标题提供的时间戳),它就不会执行完整的检查。无论如何,如果您多次尝试这个命令,但是更改顺序,您会发现第一个运行的命令通常会下载更多的文件,不管是哪一个文件。

票数 0
EN
页面原文内容由Unix & Linux提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://unix.stackexchange.com/questions/700214

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档