当前位置: 首页>>技术教程>>正文


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

, ,

问题描述

这个问题包含对Ubuntu中的错误的规避:

以及在进行apt-get更新时节省带宽的一些一般建议。

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


我对Ubuntu 12.04运行了一个干净的安装,到目前为止一切都运行良好。我特别赞扬这个版本的Ubuntu团队。

我只注意到存储库更新的大小现在约为13MB。通常情况下,第一次在干净安装后运行apt-get update时大约是这个大小,然后是〜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的新功能吗?或者,如果它是无意的,有没有办法解决这个问题?谢谢。

最佳解决方法

我认为这里有一些值得注意的事情。

查看相同的us.archive.ubuntu.com或archive.ubuntu.com存档,您可以看到Main和Universe分发Package.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

这些命令通过更新存档文件的时间告诉系统这些文件是up-to-date。不要在其他存储库上运行这些命令,也不要在修复错误之后运行这些命令。

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

  1. 更频繁地运行更新可能是有意义的,或者等效地选择较少更新主存储库的存储库。

  2. 许多包括”source”存储库在其软件源列表中。这对于执行apt-get源包名称很有用,但可能是old-fashioned。除非您每天都获得源代码,否则您可以考虑删除源设置,并再次启用它并仅在您想要下载某些源时进行更新。各种包的来源总是在变化,因此要下载的索引也总是在变化。您还可以考虑使用Uzantu Distributed Development来使用bazaar来处理较小的包。换句话说:bzr branch lp:ubuntu /sourcename以压缩形式下载包源及其历史记录。较大包的历史记录可能有很多兆字节,因此您可能希望将此策略限制为小包。如果您可以使用此代替“apt-get源包名称”,则可以将源存储库完全保留在您的存储库列表之外。

次佳解决方法

我尝试切换到镜像而不是使用us.archive.ubuntu.com,它解决了问题!使用通常的Ubuntu服务器,我发现仅仅检查了半小时后,我将从apt-get update获取另外~13MB的数据;然而,随着镜像,它已经下降到< 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镜像是否有什么特别之处,但您可以使用locate a mirror near you,看看是否有帮助。第一次获取很大(~16MB)但随后的那些是<1MB。 1MB。

第三种解决方法

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

大多数时候,我们更新包列表以添加PPA。所以这是一个解决方法

  1. 创建一个文件/etc/apt/apt.conf.d/99mysettings并将此行放在该文件中。 Apt::Get::List-Cleanup 'false';。怎么样 ? :在终端sudo gedit /etc/apt/apt.conf.d/99mysettings中键入这些。说明:它导致apt-get不删除已下载的索引文件。

  2. 禁用您不想立即更新的存储库。您可以通过go here查看how you can disable repositories

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

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

希望这会有所帮助。

参考资料

本文由Ubuntu问答整理, 博文地址: https://ubuntuqa.com/article/7112.html,未经允许,请勿转载。