如何知道哪个 apt 存储库很慢?

如何知道哪个 apt 存储库很慢?

我运行sudo apt update了大约 30 分钟但还没有完成,如何知道哪个存储库很慢?

Get:88 https://apt.releases.hashicorp.com jammy/main amd64 Packages [119 kB]
Get:89 https://apt.releases.hashicorp.com jammy/main i386 Packages [51.9 kB]
Get:90 https://packages.microsoft.com/repos/edge stable/main amd64 Packages [7,737 B]
Get:91 https://packages.microsoft.com/ubuntu/22.10/prod kinetic/main amd64 Packages [30.0 kB]
Get:92 https://packages.microsoft.com/ubuntu/22.10/prod kinetic/main arm64 Packages [3,273 B]
Get:93 https://packages.microsoft.com/ubuntu/22.10/prod kinetic/main armhf Packages [989 B]
Ign:94 https://dl.modular.com/public/installer/deb/pop jammy/main amd64 Packages
Get:95 https://packages.microsoft.com/repos/code stable/main arm64 Packages [15.9 kB]
Get:96 https://packages.microsoft.com/repos/code stable/main armhf Packages [15.9 kB]
Get:97 https://packages.microsoft.com/repos/code stable/main amd64 Packages [15.9 kB]
Ign:78 https://mirror.repository.id/ubuntu jammy InRelease
Ign:83 https://dl.thorium.rocks/debian stable InRelease
Get:94 https://dl.modular.com/public/installer/deb/pop jammy/main amd64 Packages [2,265 B]
Ign:98 https://dl.thorium.rocks/debian stable Release
Ign:78 https://mirror.repository.id/ubuntu jammy InRelease
Ign:98 https://dl.thorium.rocks/debian stable Release
<-- stuck like forever

我不知道哪一个卡住了,从 ps aux | grep apt 也没有显示导致卡住的存储库

/usr/lib/apt/methods/https
/usr/lib/apt/methods/http

答案1

apt实用程序有多个调试选项,列于man apt.conf

一个有用的调试参数sudo apt updateDebug::pkgAcquire选项,如下所示:

Debug::pkgAcquire
    Log when items are added to or removed from the global download queue.

要调用此选项,请运行:

sudo apt -oDebug::pkgAcquire=1 update

有一个更详细的选项,名为Debug::pkgAcquire::Worker,它记录所有交互。

Debug::pkgAcquire::Worker
    Log all interactions with the sub-processes that actually perform downloads.

类似地,可以使用以下命令运行:

sudo apt -oDebug::pkgAcquire::Worker=1 update

希望这些调试选项可以让您看到apt update进程停滞的位置。

相关内容