`apt-get install` 尝试获取错误的文件

`apt-get install` 尝试获取错误的文件

我正在尝试使用安装 curl

apt-get install curl

但它产生了错误:

Err:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 curl amd64 7.47.0-1ubuntu2.12
  404  Not Found
Err:1 http://security.ubuntu.com/ubuntu xenial-security/main amd64 curl amd64 7.47.0-1ubuntu2.12
  404  Not Found
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/c/curl/curl_7.47.0-1ubuntu2.12_amd64.deb  404  Not Found

我的想法:

我提到本文,然后我意识到自从我的版本 16.04 LTS 以来,它仍然受支持,并且这不是问题。

我也读过这个问题,但这两个答案都不适用于我的情况(apt-get update失败并且xenial-security存在于http://security.ubuntu.com/ubuntu/dists/)。

接下来我访问了 URLhttp://security.ubuntu.com/ubuntu/pool/main/c/curl,我发现curl_7.47.0-1ubuntu2.13_amd64.deb而不是curl_7.47.0-1ubuntu2.12_amd64.deb,这是 所请求的apt-get。因此,我推断apt-get应该请求2.13而不是2.12,因此得名。

但是,我有点被困在这里。我不确定下一步该怎么做才能解决这个问题,我很感激任何建议。

输出cat /etc/apt/sources.list

#deb cdrom:[Ubuntu 16.04.2 LTS _Xenial Xerus_ - Release amd64 (20170215.2)]/ xenial main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://tw.archive.ubuntu.com/ubuntu/ xenial main restricted
# deb-src http://tw.archive.ubuntu.com/ubuntu/ xenial main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://tw.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
# deb-src http://tw.archive.ubuntu.com/ubuntu/ xenial-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://tw.archive.ubuntu.com/ubuntu/ xenial universe
# deb-src http://tw.archive.ubuntu.com/ubuntu/ xenial universe
deb http://tw.archive.ubuntu.com/ubuntu/ xenial-updates universe
# deb-src http://tw.archive.ubuntu.com/ubuntu/ xenial-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://tw.archive.ubuntu.com/ubuntu/ xenial multiverse
# deb-src http://tw.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://tw.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
# deb-src http://tw.archive.ubuntu.com/ubuntu/ xenial-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://tw.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe multiverse
# deb-src http://tw.archive.ubuntu.com/ubuntu/ xenial-backports main restricted universe 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 xenial partner
# deb-src http://archive.canonical.com/ubuntu xenial partner

deb http://security.ubuntu.com/ubuntu xenial-security main restricted
# deb-src http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
# deb-src http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse
# deb-src http://security.ubuntu.com/ubuntu xenial-security multiverse

输出apt-get update

Hit:1 http://tw.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://tw.archive.ubuntu.com/ubuntu xenial-updates InRelease [109 kB]                  
Get:3 http://tw.archive.ubuntu.com/ubuntu xenial-backports InRelease [107 kB]                                                               
Hit:4 http://packages.microsoft.com/repos/vscode stable InRelease                                                      
Get:5 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 Packages [957 kB]                                
Get:6 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main i386 Packages [824 kB]                          
Get:7 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main Translation-en [381 kB]                   
Ign:8 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata                            
Ign:9 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons                                                
Get:10 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 Packages [748 kB]                                      
Get:11 http://security.ubuntu.com/ubuntu xenial-security InRelease [109 kB]                                                     
Get:12 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe i386 Packages [685 kB]                          
Get:13 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe Translation-en [311 kB]                         
Ign:14 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata                                    
Ign:15 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons
Get:16 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages [16.7 kB]                                               
Get:17 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse i386 Packages [15.8 kB]                   
Ign:18 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata                     
Ign:8 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata                                                         
Ign:9 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons     
Ign:14 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata
Ign:15 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe DEP-11 64x64 Icons                                 
Ign:18 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata                            
Ign:19 http://tw.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata
Ign:20 http://tw.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 Metadata                            
Ign:8 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main amd64 DEP-11 Metadata                                   
Get:9 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons [309 kB]
Err:9 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main DEP-11 64x64 Icons                  
  Hash Sum mismatch
Ign:14 http://tw.archive.ubuntu.com/ubuntu xenial-updates/universe amd64 DEP-11 Metadata          
Ign:18 http://tw.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 DEP-11 Metadata                            
Ign:19 http://tw.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata                                
Ign:20 http://tw.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 Metadata                            
Ign:19 http://tw.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata                                
Ign:20 http://tw.archive.ubuntu.com/ubuntu xenial-backports/universe amd64 DEP-11 Metadata
Get:19 http://tw.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata [7280 B]
Err:19 http://tw.archive.ubuntu.com/ubuntu xenial-backports/main amd64 DEP-11 Metadata
  Hash Sum mismatch
Get:21 http://security.ubuntu.com/ubuntu xenial-security/main amd64 Packages [648 kB]
Get:22 http://security.ubuntu.com/ubuntu xenial-security/main i386 Packages [535 kB]
Get:23 http://security.ubuntu.com/ubuntu xenial-security/main Translation-en [264 kB]
Ign:24 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata
Ign:25 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons    
Get:26 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 Packages [435 kB]
Get:27 http://security.ubuntu.com/ubuntu xenial-security/universe i386 Packages [378 kB]                                                    
Get:28 http://security.ubuntu.com/ubuntu xenial-security/universe Translation-en [176 kB]                                                   
Ign:29 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata                                                     
Ign:30 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons                                                        
Ign:31 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 DEP-11 Metadata                                                   
Ign:24 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata                                                         
Ign:25 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons                                                            
Ign:29 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata                                                     
Ign:30 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons                                                        
Ign:31 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 DEP-11 Metadata                                                   
Ign:24 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata                                                         
Err:25 http://security.ubuntu.com/ubuntu xenial-security/main DEP-11 64x64 Icons                                                            
  Could not open file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_main_dep11_icons-64x64.tar.gz - open (13: Permission denied) [IP: 91.189.91.23 80]
Ign:29 http://security.ubuntu.com/ubuntu xenial-security/universe amd64 DEP-11 Metadata                                                     
Ign:30 http://security.ubuntu.com/ubuntu xenial-security/universe DEP-11 64x64 Icons                                                        
Ign:31 http://security.ubuntu.com/ubuntu xenial-security/multiverse amd64 DEP-11 Metadata                                                   
Ign:24 http://security.ubuntu.com/ubuntu xenial-security/main amd64 DEP-11 Metadata                                                         
Fetched 5766 kB in 14s (394 kB/s)                                                                                                           
Reading package lists... Done
E: Failed to fetch http://tw.archive.ubuntu.com/ubuntu/dists/xenial-updates/main/dep11/Components-amd64.yml  Could not open file /var/lib/apt/lists/partial/tw.archive.ubuntu.com_ubuntu_dists_xenial-updates_main_dep11_Components-amd64.yml.xz - open (13: Permission denied)
E: Failed to fetch http://tw.archive.ubuntu.com/ubuntu/dists/xenial-updates/main/dep11/icons-64x64.tar  Hash Sum mismatch
E: Failed to fetch http://tw.archive.ubuntu.com/ubuntu/dists/xenial-updates/universe/dep11/icons-64x64.tar  Could not open file /var/lib/apt/lists/partial/tw.archive.ubuntu.com_ubuntu_dists_xenial-updates_universe_dep11_icons-64x64.tar.gz - open (13: Permission denied)
E: Failed to fetch http://tw.archive.ubuntu.com/ubuntu/dists/xenial-backports/main/dep11/Components-amd64.yml  Hash Sum mismatch
E: Failed to fetch http://tw.archive.ubuntu.com/ubuntu/dists/xenial-backports/universe/dep11/Components-amd64.yml  Could not open file /var/lib/apt/lists/partial/tw.archive.ubuntu.com_ubuntu_dists_xenial-backports_universe_dep11_Components-amd64.yml.xz - open (13: Permission denied)
E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/xenial-security/main/dep11/icons-64x64.tar  Could not open file /var/lib/apt/lists/partial/security.ubuntu.com_ubuntu_dists_xenial-security_main_dep11_icons-64x64.tar.gz - open (13: Permission denied) [IP: 91.189.91.23 80]
E: Some index files failed to download. They have been ignored, or old ones used instead.

答案1

sudo apt-get update解决了 Charles 评论中指出的这个问题。在我的具体案例中,通过引用这个问题,运行sudo rm /var/lib/apt/lists/partial/*使得sudo apt-get update执行成功。

相关内容