一旦开发版本发布为稳定版本,如何减少其 apt-get 更新列表的大小?

一旦开发版本发布为稳定版本,如何减少其 apt-get 更新列表的大小?

我从三月初开始使用 13.04 的开发版本。在开发版本中,运行该sudo apt-get update命令的一般行为是,如果列表文件已更改,则完全下载列表文件。而如果使用 Ubuntu 的稳定版本,则该命令只会下载列表文件的差异(如果列表文件已更改)(rsync 样式)。

基本上,开发版本sudo apt-get update会下载大约 17-18 MB 的数据;而稳定版本则仅下载大约 1 MB 的数据(初始运行除外)。

现在,由于 13.04 已作为稳定版本发布,我想更改的行为sudo apt-get update以模仿其在稳定版本中的正常行为。我该如何实现这一点?


之前在 Ask Ubuntu 上有人问过一个类似的问题,不过是针对稳定版本的:

然而,这是 12.04 中的一个错误,后来得到了修复。但那里给出的答案对我来说不可行。对于 Ubuntu+1 来说,这不是一个错误,而是开发版本的一般行为。无论如何,我会仔细阅读那里提供的答案:

  • John S Gruber 的回答touch在运行命令之前询问相关文件( sudo apt-get update每次。对我来说这绝对不可行。这个答案对于这个问题来说是可以的,因为它是 12.04 中的一个错误,并且它在这种情况下提供了一个临时修复。

  • Chan-Ho Suh 的回答要求更改更新镜像。这无法解决开发版本中的问题。

  • 安瓦尔的回答也是针对这种情况的临时解决方案。它假设我只会sudo apt-get update在添加 PPA 后运行命令,因此要求禁用其他存储库。这对我来说是不可行的,因为我显然想更新所有存储库。我不一定只在添加 PPA 后运行此命令。我每天都会运行此命令来安装 Canonical 发布的任何更新。我用它来sudo apt-get update代替软件中心。


所以就是这样。我如何恢复sudo apt-get update命令的正常行为以仅下载已更改文件的差异?希望相同的解决方案也适用于软件中心,因为如果我使用它进行更新,软件中心也会消耗类似数量的带宽。

我绝对不想只是为了恢复这种行为而重新安装 13.04。


sudo apt-get update如果有重要影响,则输出:

$ sudo apt-get update
Hit http://dl.google.com stable Release.gpg                                    
Hit http://dl.google.com stable Release                                        
Hit http://ppa.launchpad.net raring Release.gpg                                
Hit http://dl.google.com stable/main i386 Packages                             
Hit http://linux.dropbox.com precise Release.gpg                               
Hit http://ppa.launchpad.net raring Release.gpg                      
Get:1 http://mirror.picosecond.org raring Release.gpg [933 B]        
Hit http://ppa.launchpad.net raring Release                                    
Hit http://linux.dropbox.com precise Release                                   
Get:2 http://mirror.picosecond.org raring-updates Release.gpg [933 B]          
Hit http://ppa.launchpad.net raring Release                                    
Hit http://linux.dropbox.com precise/main i386 Packages                        
Hit http://ppa.launchpad.net raring/main i386 Packages                         
Get:3 http://mirror.picosecond.org raring-backports Release.gpg [933 B]
Ign http://dl.google.com stable/main Translation-en_IN                         
Ign http://dl.google.com stable/main Translation-en                            
Hit http://mirror.picosecond.org raring-security Release.gpg          
Get:4 http://mirror.picosecond.org raring Release [40.8 kB]           
Hit http://ppa.launchpad.net raring/main i386 Packages                       
Get:5 http://mirror.picosecond.org raring-updates Release [40.8 kB]            
Get:6 http://mirror.picosecond.org raring-backports Release [40.8 kB]          
Ign http://linux.dropbox.com precise/main Translation-en_IN                    
Ign http://linux.dropbox.com precise/main Translation-en                       
Hit http://mirror.picosecond.org raring-security Release                       
Get:7 http://mirror.picosecond.org raring/main Sources [963 kB]                
Ign http://ppa.launchpad.net raring/main Translation-en_IN                     
Ign http://ppa.launchpad.net raring/main Translation-en                        
Ign http://ppa.launchpad.net raring/main Translation-en_IN                     
Ign http://ppa.launchpad.net raring/main Translation-en                        
Get:8 http://mirror.picosecond.org raring/restricted Sources [5,987 B]         
Get:9 http://mirror.picosecond.org raring/universe Sources [5,838 kB]          
Get:10 http://mirror.picosecond.org raring/multiverse Sources [171 kB]         
Get:11 http://mirror.picosecond.org raring/main i386 Packages [1,168 kB]       
Get:12 http://mirror.picosecond.org raring/restricted i386 Packages [9,623 B]  
Get:13 http://mirror.picosecond.org raring/universe i386 Packages [5,405 kB]   
Get:14 http://mirror.picosecond.org raring/multiverse i386 Packages [131 kB]   
Hit http://mirror.picosecond.org raring/main Translation-en                    
Hit http://mirror.picosecond.org raring/multiverse Translation-en              
Hit http://mirror.picosecond.org raring/restricted Translation-en              
Get:15 http://mirror.picosecond.org raring/universe Translation-en [3,736 kB]  
Get:16 http://mirror.picosecond.org raring-updates/main Sources [1,616 B]      
Get:17 http://mirror.picosecond.org raring-updates/restricted Sources [14 B]   
Get:18 http://mirror.picosecond.org raring-updates/universe Sources [14 B]     
Get:19 http://mirror.picosecond.org raring-updates/multiverse Sources [14 B]   
Get:20 http://mirror.picosecond.org raring-updates/main i386 Packages [3,331 B]
Get:21 http://mirror.picosecond.org raring-updates/restricted i386 Packages [14 B]
Get:22 http://mirror.picosecond.org raring-updates/universe i386 Packages [1,078 B]
Get:23 http://mirror.picosecond.org raring-updates/multiverse i386 Packages [14 B]
Hit http://mirror.picosecond.org raring-updates/main Translation-en            
Hit http://mirror.picosecond.org raring-updates/multiverse Translation-en      
Hit http://mirror.picosecond.org raring-updates/restricted Translation-en      
Hit http://mirror.picosecond.org raring-updates/universe Translation-en        
Get:24 http://mirror.picosecond.org raring-backports/main Sources [14 B]       
Get:25 http://mirror.picosecond.org raring-backports/restricted Sources [14 B] 
Get:26 http://mirror.picosecond.org raring-backports/universe Sources [738 B]  
Get:27 http://mirror.picosecond.org raring-backports/multiverse Sources [14 B] 
Get:28 http://mirror.picosecond.org raring-backports/main i386 Packages [14 B] 
Get:29 http://mirror.picosecond.org raring-backports/restricted i386 Packages [14 B]
Get:30 http://mirror.picosecond.org raring-backports/universe i386 Packages [508 B]
Get:31 http://mirror.picosecond.org raring-backports/multiverse i386 Packages [14 B]
Hit http://mirror.picosecond.org raring-backports/main Translation-en          
Hit http://mirror.picosecond.org raring-backports/multiverse Translation-en    
Hit http://mirror.picosecond.org raring-backports/restricted Translation-en    
Hit http://mirror.picosecond.org raring-backports/universe Translation-en      
Hit http://mirror.picosecond.org raring-security/main Sources                  
Hit http://mirror.picosecond.org raring-security/restricted Sources            
Hit http://mirror.picosecond.org raring-security/universe Sources              
Hit http://mirror.picosecond.org raring-security/multiverse Sources            
Hit http://mirror.picosecond.org raring-security/main i386 Packages            
Hit http://mirror.picosecond.org raring-security/restricted i386 Packages      
Hit http://mirror.picosecond.org raring-security/universe i386 Packages        
Hit http://mirror.picosecond.org raring-security/multiverse i386 Packages      
Hit http://mirror.picosecond.org raring-security/main Translation-en           
Hit http://mirror.picosecond.org raring-security/multiverse Translation-en     
Hit http://mirror.picosecond.org raring-security/restricted Translation-en
Hit http://mirror.picosecond.org raring-security/universe Translation-en
Ign http://mirror.picosecond.org raring/main Translation-en_IN
Ign http://mirror.picosecond.org raring/multiverse Translation-en_IN
Ign http://mirror.picosecond.org raring/restricted Translation-en_IN
Ign http://mirror.picosecond.org raring/universe Translation-en_IN
Ign http://mirror.picosecond.org raring-updates/main Translation-en_IN
Ign http://mirror.picosecond.org raring-updates/multiverse Translation-en_IN
Ign http://mirror.picosecond.org raring-updates/restricted Translation-en_IN
Ign http://mirror.picosecond.org raring-updates/universe Translation-en_IN
Ign http://mirror.picosecond.org raring-backports/main Translation-en_IN
Ign http://mirror.picosecond.org raring-backports/multiverse Translation-en_IN
Ign http://mirror.picosecond.org raring-backports/restricted Translation-en_IN
Ign http://mirror.picosecond.org raring-backports/universe Translation-en_IN
Ign http://mirror.picosecond.org raring-security/main Translation-en_IN
Ign http://mirror.picosecond.org raring-security/multiverse Translation-en_IN
Ign http://mirror.picosecond.org raring-security/restricted Translation-en_IN
Ign http://mirror.picosecond.org raring-security/universe Translation-en_IN
Fetched 17.6 MB in 3min 46s (77.7 kB/s)
Reading package lists... Done

/etc/apt/sources.list如有疑问,内容如下:

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to

# newer versions of the distribution.
deb http://mirror.picosecond.org/ubuntu/ raring main restricted
deb-src http://mirror.picosecond.org/ubuntu/ raring main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://mirror.picosecond.org/ubuntu/ raring-updates main restricted
deb-src http://mirror.picosecond.org/ubuntu/ raring-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://mirror.picosecond.org/ubuntu/ raring universe
deb-src http://mirror.picosecond.org/ubuntu/ raring universe
deb http://mirror.picosecond.org/ubuntu/ raring-updates universe
deb-src http://mirror.picosecond.org/ubuntu/ raring-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://mirror.picosecond.org/ubuntu/ raring multiverse
deb-src http://mirror.picosecond.org/ubuntu/ raring multiverse
deb http://mirror.picosecond.org/ubuntu/ raring-updates multiverse
deb-src http://mirror.picosecond.org/ubuntu/ raring-updates multiverse

## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
deb http://mirror.picosecond.org/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirror.picosecond.org/ubuntu/ raring-backports main restricted universe multiverse

deb http://mirror.picosecond.org/ubuntu/ raring-security main restricted
deb-src http://mirror.picosecond.org/ubuntu/ raring-security main restricted
deb http://mirror.picosecond.org/ubuntu/ raring-security universe
deb-src http://mirror.picosecond.org/ubuntu/ raring-security universe
deb http://mirror.picosecond.org/ubuntu/ raring-security multiverse
deb-src http://mirror.picosecond.org/ubuntu/ raring-security multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu raring partner
# deb-src http://archive.canonical.com/ubuntu raring partner

## Uncomment the following two lines to add software from Ubuntu's
## 'extras' repository.
## This software is not part of Ubuntu, but is offered by third-party
## developers who want to ship their latest software.
# deb http://extras.ubuntu.com/ubuntu raring main
# deb-src http://extras.ubuntu.com/ubuntu raring main

答案1

apt 实际上在开发版本和稳定版本之间并没有做任何不同的事情。

但是,版本本身停止变化,因此 apt 需要下载的软件包列表的大小变得更小。

我们以 Raring 为例。

在开发过程中,raring-updatesraring-security口袋仍然是空的,但raring口袋会定期(半小时)更新。

发布后,口袋停止变化。更新现在作为新包进入和口袋raring而上传。raring-updatesraring-security

从 apt 的角度来看,在开发过程中raring每次运行时都会完整下载软件包列表apt-get update(除非在上游更新之间的半小时内调用两次或更多次)。这是一个很大的列表,因此需要一些时间。

现在 Raring 已经发布,raring软件包列表不再变化。raring-updatesraring-security软件包列表确实会发生变化,但这些列表要小得多,因为它们只包含自 Raring 发布以来在 Raring 中发生“变化”的软件包。

我可以在你的问题的输出中看到这种行为。它看起来正如预期的那样:口袋raring刚刚无需下载;得到raring-updatesraring-security实际下载量相对应。编辑:再次查看,似乎有些文件被不必要地重新下载;请参阅我的其他答案。

如果这对您来说太慢,请考虑使用更快的镜像,或删除那里相当大的 PPA 列表。如果您不需要可用的源,也可以删除deb-src中的行。sources.listapt-get

如果您直接安装此版本,我相信您不会看到任何不同的行为。

答案2

另一种可能是,您使用的镜像不保留时间戳,或者本地 apt 缓存损坏,导致 apt 每次重新下载镜像中实际上没有更改的文件。请尝试这个答案清除本地缓存,并切换到保留时间戳的镜像。

相关内容