apt-get update后的操作顺序

apt-get update后的操作顺序

打字时

$apt-get update

哪个apt先检查: sources.list文件还是/var/lib/apt/lists目录?

答案1

让我们来看看:

$ sudo strace apt-get update |& grep -E 'sources\.list|/var/lib/apt/lists' | head
stat("/etc/apt/sources.list", {st_mode=S_IFREG|0644, st_size=1515, ...}) = 0
openat(AT_FDCWD, "/etc/apt/sources.list", O_RDONLY|O_NOCTTY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/var/lib/apt/lists/", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
...

所以它sources.list首先检查。这是有道理的,因为sources.list(以及 中的文件sources.list.d)决定存储库apt“知道”,而不是/var/lib/apt/lists.

相关内容