apt-get 更新列表的大小太大

apt-get 更新列表的大小太大

该问题包含针对 Ubuntu 中的一个错误的规避方法:

以及执行 apt-get update 时节省带宽的一些一般建议。

那个错误是关闭2012 年 8 月 8 日,因此如果错误再次出现,您可能只需要与此问题相关的信息。如果发生这种情况,请在 Launchpad 上提交另一份错误报告。


我全新安装了 Ubuntu 12.04,到目前为止一切运行良好。我特别赞扬 Ubuntu 团队发布的这个版本。

apt-get update我只注意到存储库更新的大小现在约为 ~13MB。通常,全新安装后第一次运行时的大小约为这个大小,后续更新的大小约为 ~ 23kb - 1300kb。

的输出apt-get update与我之前版本的 Ubuntu 的输出相同(这很正常)。它有点太长了,但请看我运行后得到的示例输出apt-get update

Ign http://archive.canonical.com precise InRelease
Ign http://dl.google.com stable InRelease
Ign http://dl.google.com stable InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Hit http://download.virtualbox.org precise InRelease
Ign http://security.ubuntu.com precise-security InRelease
Ign http://linux.dropbox.com precise InRelease
Ign http://extras.ubuntu.com precise InRelease
Ign http://download.skype.com stable InRelease
Hit http://archive.canonical.com precise Release.gpg
Get:1 http://dl.google.com stable Release.gpg [198 B]
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net oneiric InRelease
Ign http://ppa.launchpad.net precise InRelease
Get:2 http://security.ubuntu.com precise-security Release.gpg [198 B]
Get:3 http://extras.ubuntu.com precise Release.gpg [72 B]
Hit http://download.virtualbox.org precise/contrib i386 Packages
Ign http://download.skype.com stable Release.gpg
Hit http://linux.dropbox.com precise Release.gpg
Ign http://us.archive.ubuntu.com precise InRelease
Ign http://us.archive.ubuntu.com precise-updates InRelease
Ign http://us.archive.ubuntu.com precise-backports InRelease
Hit http://archive.canonical.com precise Release
Get:4 http://dl.google.com stable Release.gpg [198 B]
Ign http://ppa.launchpad.net oneiric InRelease
Ign http://ppa.launchpad.net oneiric InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Ign http://ppa.launchpad.net precise InRelease
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release.gpg
Get:5 http://security.ubuntu.com precise-security Release [49.6 kB]
Hit http://extras.ubuntu.com precise Release
Ign http://download.skype.com stable Release
Ign http://download.virtualbox.org precise/contrib TranslationIndex
Get:6 http://us.archive.ubuntu.com precise Release.gpg [198 B]
Hit http://archive.canonical.com precise/partner i386 Packages
Hit http://linux.dropbox.com precise Release
Get:7 http://ppa.launchpad.net precise Release.gpg [316 B]
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://extras.ubuntu.com precise/main Sources
Get:8 http://ppa.launchpad.net precise Release.gpg [316 B]
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release.gpg
Get:9 http://us.archive.ubuntu.com precise-updates Release.gpg [198 B]
Ign http://archive.canonical.com precise/partner TranslationIndex
Ign http://download.skype.com stable/non-free i386 Packages/DiffIndex
Get:10 http://dl.google.com stable Release [1,347 B]
Hit http://linux.dropbox.com precise/main i386 Packages
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net oneiric Release.gpg
Hit http://extras.ubuntu.com precise/main i386 Packages
Ign http://extras.ubuntu.com precise/main TranslationIndex
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net oneiric Release.gpg
Hit http://ppa.launchpad.net oneiric Release.gpg
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release.gpg
Get:11 http://us.archive.ubuntu.com precise-backports Release.gpg [198 B]
Ign http://download.skype.com stable/non-free TranslationIndex
Get:12 http://dl.google.com stable Release [1,347 B]
Hit http://ppa.launchpad.net precise Release.gpg
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Ign http://linux.dropbox.com precise/main TranslationIndex
Hit http://ppa.launchpad.net precise Release
Ign http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Get:13 http://ppa.launchpad.net precise Release [11.9 kB]
Get:14 http://us.archive.ubuntu.com precise Release [49.6 kB]
Hit http://download.skype.com stable/non-free i386 Packages
Get:15 http://dl.google.com stable/main i386 Packages [1,268 B]
Ign http://dl.google.com stable/main TranslationIndex
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net oneiric Release
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net oneiric Release
Get:16 http://security.ubuntu.com precise-security/main Sources [7,089 B]
Hit http://ppa.launchpad.net oneiric Release
Get:17 http://dl.google.com stable/main i386 Packages [769 B]
Ign http://dl.google.com stable/main TranslationIndex
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise Release
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main i386 Packages
Get:18 http://security.ubuntu.com precise-security/restricted Sources [14 B]
Get:19 http://security.ubuntu.com precise-security/universe Sources [3,653 B]
Get:20 http://security.ubuntu.com precise-security/multiverse Sources [696 B]
Get:21 http://security.ubuntu.com precise-security/main i386 Packages [32.9 kB]
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Get:22 http://us.archive.ubuntu.com precise-updates Release [49.6 kB]
Ign http://ppa.launchpad.net precise/main Sources/DiffIndex
Ign http://ppa.launchpad.net precise/main i386 Packages/DiffIndex
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main i386 Packages
Get:23 http://security.ubuntu.com precise-security/restricted i386 Packages [14 B]
Get:24 http://security.ubuntu.com precise-security/universe i386 Packages [8,594 B]
Get:25 http://security.ubuntu.com precise-security/multiverse i386 Packages [1,393 B]
Hit http://security.ubuntu.com precise-security/main TranslationIndex
Hit http://security.ubuntu.com precise-security/multiverse TranslationIndex
Hit http://security.ubuntu.com precise-security/restricted TranslationIndex
Hit http://security.ubuntu.com precise-security/universe TranslationIndex
Ign http://ppa.launchpad.net precise/main TranslationIndex
Get:26 http://us.archive.ubuntu.com precise-backports Release [49.6 kB]
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Get:27 http://ppa.launchpad.net precise/main i386 Packages [1,276 B]
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main Sources
Get:28 http://us.archive.ubuntu.com precise/main Sources [934 kB]
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main i386 Packages
Hit http://security.ubuntu.com precise-security/main Translation-en
Hit http://security.ubuntu.com precise-security/multiverse Translation-en
Hit http://security.ubuntu.com precise-security/restricted Translation-en
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net oneiric/main Sources
Hit http://ppa.launchpad.net oneiric/main i386 Packages
Ign http://ppa.launchpad.net oneiric/main TranslationIndex
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net oneiric/main Sources
Hit http://security.ubuntu.com precise-security/universe Translation-en
Ign http://archive.canonical.com precise/partner Translation-en_US
Hit http://ppa.launchpad.net oneiric/main i386 Packages
Ign http://ppa.launchpad.net oneiric/main TranslationIndex
Hit http://ppa.launchpad.net oneiric/main Sources
Hit http://ppa.launchpad.net oneiric/main i386 Packages
Ign http://ppa.launchpad.net oneiric/main TranslationIndex
Hit http://ppa.launchpad.net precise/main Sources
Ign http://extras.ubuntu.com precise/main Translation-en_US
Ign http://download.virtualbox.org precise/contrib Translation-en_US
Ign http://archive.canonical.com precise/partner Translation-en
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Ign http://extras.ubuntu.com precise/main Translation-en
Ign http://download.virtualbox.org precise/contrib Translation-en
Hit http://ppa.launchpad.net precise/main Sources
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://ppa.launchpad.net precise/main TranslationIndex
Hit http://ppa.launchpad.net precise/main Sources
Ign http://linux.dropbox.com precise/main Translation-en_US
Hit http://ppa.launchpad.net precise/main i386 Packages
Ign http://download.skype.com stable/non-free Translation-en_US
Ign http://linux.dropbox.com precise/main Translation-en
Ign http://download.skype.com stable/non-free Translation-en
Ign http://dl.google.com stable/main Translation-en_US
Ign http://dl.google.com stable/main Translation-en
Ign http://dl.google.com stable/main Translation-en_US
Get:29 http://us.archive.ubuntu.com precise/restricted Sources [5,470 B]
Get:30 http://us.archive.ubuntu.com precise/universe Sources [5,019 kB]
Ign http://dl.google.com stable/main Translation-en
Get:31 http://us.archive.ubuntu.com precise/multiverse Sources [155 kB]
Get:32 http://us.archive.ubuntu.com precise/main i386 Packages [1,274 kB]
Get:33 http://us.archive.ubuntu.com precise/restricted i386 Packages [8,431 B]
Get:34 http://us.archive.ubuntu.com precise/universe i386 Packages [4,796 kB]
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net oneiric/main Translation-en_US
Ign http://ppa.launchpad.net oneiric/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net oneiric/main Translation-en_US
Ign http://ppa.launchpad.net oneiric/main Translation-en
Ign http://ppa.launchpad.net oneiric/main Translation-en_US
Ign http://ppa.launchpad.net oneiric/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Ign http://ppa.launchpad.net precise/main Translation-en_US
Ign http://ppa.launchpad.net precise/main Translation-en
Get:35 http://us.archive.ubuntu.com precise/multiverse i386 Packages [121 kB]
Hit http://us.archive.ubuntu.com precise/main TranslationIndex
Hit http://us.archive.ubuntu.com precise/multiverse TranslationIndex
Hit http://us.archive.ubuntu.com precise/restricted TranslationIndex
Hit http://us.archive.ubuntu.com precise/universe TranslationIndex
Get:36 http://us.archive.ubuntu.com precise-updates/main Sources [31.2 kB]
Get:37 http://us.archive.ubuntu.com precise-updates/restricted Sources [765 B]
Get:38 http://us.archive.ubuntu.com precise-updates/universe Sources [10.1 kB]
Get:39 http://us.archive.ubuntu.com precise-updates/multiverse Sources [696 B]
Get:40 http://us.archive.ubuntu.com precise-updates/main i386 Packages [96.5 kB]
Get:41 http://us.archive.ubuntu.com precise-updates/restricted i386 Packages [770 B]
Get:42 http://us.archive.ubuntu.com precise-updates/universe i386 Packages [27.7 kB]
Get:43 http://us.archive.ubuntu.com precise-updates/multiverse i386 Packages [1,393 B]
Hit http://us.archive.ubuntu.com precise-updates/main TranslationIndex
Hit http://us.archive.ubuntu.com precise-updates/multiverse TranslationIndex
Hit http://us.archive.ubuntu.com precise-updates/restricted TranslationIndex
Hit http://us.archive.ubuntu.com precise-updates/universe TranslationIndex
Get:44 http://us.archive.ubuntu.com precise-backports/main Sources [700 B]
Get:45 http://us.archive.ubuntu.com precise-backports/restricted Sources [14 B]
Get:46 http://us.archive.ubuntu.com precise-backports/universe Sources [1,680 B]
Get:47 http://us.archive.ubuntu.com precise-backports/multiverse Sources [14 B]
Get:48 http://us.archive.ubuntu.com precise-backports/main i386 Packages [559 B]
Get:49 http://us.archive.ubuntu.com precise-backports/restricted i386 Packages [14 B]
Get:50 http://us.archive.ubuntu.com precise-backports/universe i386 Packages [1,391 B]
Get:51 http://us.archive.ubuntu.com precise-backports/multiverse i386 Packages [14 B]
Hit http://us.archive.ubuntu.com precise-backports/main TranslationIndex
Hit http://us.archive.ubuntu.com precise-backports/multiverse TranslationIndex
Hit http://us.archive.ubuntu.com precise-backports/restricted TranslationIndex
Hit http://us.archive.ubuntu.com precise-backports/universe TranslationIndex
Hit http://us.archive.ubuntu.com precise/main Translation-en
Hit http://us.archive.ubuntu.com precise/multiverse Translation-en
Hit http://us.archive.ubuntu.com precise/restricted Translation-en
Hit http://us.archive.ubuntu.com precise/universe Translation-en
Hit http://us.archive.ubuntu.com precise-updates/main Translation-en
Hit http://us.archive.ubuntu.com precise-updates/multiverse Translation-en
Hit http://us.archive.ubuntu.com precise-updates/restricted Translation-en
Hit http://us.archive.ubuntu.com precise-updates/universe Translation-en
Hit http://us.archive.ubuntu.com precise-backports/main Translation-en
Hit http://us.archive.ubuntu.com precise-backports/multiverse Translation-en
Hit http://us.archive.ubuntu.com precise-backports/restricted Translation-en
Hit http://us.archive.ubuntu.com precise-backports/universe Translation-en
Fetched 12.8 MB in 1min 33s (137 kB/s)

这是 12.04 中的新功能吗?或者,如果这是非预期的,有什么方法可以修复它吗?谢谢。

答案1

我认为这里有几件事值得注意。

查看相同的 us.archive.ubuntu.com 或 archive.ubuntu.com 档案,您可以看到 Main 和 Universe 分布包.bz2文件每小时被标记为修改两次,即使它们包含相同的内容。这些存储库实际上被冻结了。由于它们保存了 main 和 universe 中每个包的条目,这导致平均下载量非常大。这导致服务器apt-get update再次发送巨大的包文件,即使实际上没有任何变化。包文件包含存储库中每个包的最新版本的版本号和描述。实际发布文件包含上次实际更改的日期和时间。

chilicuil 已为此提交了一份错误报告,在撰写本文时,这被认为是 Ubuntu 存档镜像机制的问题。谢谢 chilicuil。错误位于http://bugs.launchpad.net/launchpad/+bug/1001780

请注意,该错误已被关闭,因此不再需要或使用以下规避措施:

由于受影响的存储库是未更改的分发存储库,因此避免此问题的一种方法是在运行之前立即运行以下命令sudo apt-get update。 请务必根据您使用的存档站点的名称以及您正在使用的版本的名称调整它们。 并非每个人都需要所有四个命令 - 请参阅命令末尾的注释。 不要将它们用于开发版本。

  • sudo touch /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_main_binary-i386_Packages
  • sudo touch /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_universe_binary-i386_Packages # If you have enabled Ubuntu Universe
  • sudo touch /var/lib/apt/list/us.archive.ubuntu.com_ubuntu_dists_precise_main_source_Sources # If you have enabled sources
  • sudo touch /var/lib/apt/lists/us.archive.ubuntu.com_ubuntu_dists_precise_universe_source_Sources # If you have enabled both Universe and sources

这些命令通过更新存档文件上的时间来告诉系统这些文件是最新的。不要在其他存储库上运行这些命令,或者在修复错误后运行这些命令。

现在问题已经解决,如果您定期运行 apt-get 并且互联网连接速度较慢或费用昂贵,那么考虑如何进一步减少运行 apt-get 时的带宽可能是有意义的。

  1. 较少地运行更新可能是有意义的,或者,选择一个比主存储库更新频率较低的存储库。

  2. 许多软件源列表中都包含“源”存储库。这对于执行 apt-get source 非常有用包裹名字,但这可能有点过时了。

    除非你每天都获取源代码,否则你可以考虑删除源设置,然后再次启用它,并且仅在需要下载某些源代码时才进行更新。各种软件包的源代码总是在变化,因此要下载的索引也总是在变化。

    您还可以考虑使用 Ubuntu 分布式开发来开发较小的软件包,使用 bazaar。换句话说:

    bzr 分支 lp:ubuntu/源名称

    这将以压缩格式下载软件包源及其历史记录。较大软件包的历史记录可能包含许多兆字节,因此您可能希望将此策略限制在较小的软件包上。如果您可以使用此策略代替“apt-get source 包裹名字“您可以将源存储库完全排除在您的存储库列表之外。

答案2

我尝试切换到镜像而不是使用us.archive.ubuntu.com,问题已经解决!使用通常的 Ubuntu 服务器,我发现仅仅半小时后检查,我就会从 获得另一个 ~13MB 的提取量apt-get update;然而,使用镜像后,提取量下降到 < 1MB。

基本上我所做的就是打开/etc/apt/sources.list并替换:

deb http://us.archive.ubuntu.com/ubuntu precise main restricted universe multiverse

deb http://us-west-1.ec2.archive.ubuntu.com.s3.amazonaws.com/ubuntu precise main restricted universe multiverse

我不知道 Amazon S3 镜像有什么特别之处,但你可以找到你附近的镜子看看是否有帮助。第一次提取很大(~16MB),但后续提取小于 1MB。

答案3

仅更新感兴趣的索引文件的解决方法:

大多数情况下,我们会更新软件包列表以添加 PPA。因此,这是一个解决方法

  1. 创建一个文件并将/etc/apt/apt.conf.d/99mysettings
    行放入文件中Apt::Get::List-Cleanup 'false';

    如何 ?:在终端中输入这些内容sudo gedit /etc/apt/apt.conf.d/99mysettings

    解释:这会导致apt-get不删除已经下载的索引文件。

  2. 禁用您现在不想更新的存储库。您可以到这里 查看如何禁用存储库

  3. apt-get update然后在终端中运行命令。等到它结束。

  4. 最后,再次启用几分钟前禁用的所有存储库。现在,您已使用所有以前的索引更新了 PPA 索引

希望这会有所帮助。

答案4

尝试转到更新管理器并删除一些 ppa。一些 ppa(如 spotify)并不重要,因为它可以正常工作,并且已经安装在我的笔记本电脑上,所以我不需要那个 ppa(仅作为示例)。

PPA 的

只需尝试删除一些 PPA。

相关内容