使用“sudo apt-get update”时未找到错误 404

使用“sudo apt-get update”时未找到错误 404

我是 Ubuntu 新手。我在 VMware 中使用 Ubuntu 14.04.02 LTS。由于我位于网络防火墙后面,因此我编辑了 apt.conf 文件,以便 apt-get 可以在代理服务器后面工作,这很好。但是,当我这样做时

sudo apt-get 更新

我得到以下信息:

Ign http://security.ubuntu.com trusty-security InRelease
Ign http://us.archive.ubuntu.com trusty InRelease                              
Ign http://extras.ubuntu.com trusty InRelease                                  
Ign http://files.ettus.com trusty InRelease                                    
Ign http://security.ubuntu.com trusty-security Release.gpg                     
Ign http://us.archive.ubuntu.com trusty-updates InRelease                      
Ign http://archive.ubuntu.com trusty InRelease                                 
Ign http://extras.ubuntu.com trusty Release.gpg                                
Ign http://files.ettus.com trusty Release.gpg                                  
Ign http://us.archive.ubuntu.com trusty-backports InRelease                    
Ign http://security.ubuntu.com trusty-security Release                         
Ign http://us.archive.ubuntu.com trusty Release.gpg                            
Ign http://extras.ubuntu.com trusty Release                                    
Ign http://files.ettus.com trusty Release                                      
Ign http://us.archive.ubuntu.com trusty-updates Release.gpg                    
Ign http://us.archive.ubuntu.com trusty-backports Release.gpg                  
Ign http://archive.ubuntu.com trusty Release.gpg                               
Ign http://us.archive.ubuntu.com trusty Release                                
Ign http://us.archive.ubuntu.com trusty-updates Release                        
Ign http://archive.ubuntu.com trusty Release                                   
Ign http://us.archive.ubuntu.com trusty-backports Release                      
Err http://archive.ubuntu.com trusty/main Sources                              
  404  Not Found
Err http://archive.ubuntu.com trusty/restricted Sources                        
  404  Not Found
Err http://archive.ubuntu.com trusty/multiverse Sources                        
  404  Not Found
Err http://files.ettus.com trusty/main amd64 Packages                          
  404  Not Found
Err http://files.ettus.com trusty/main i386 Packages                           
  404  Not Found
Err http://extras.ubuntu.com trusty/main Sources                               
  404  Not Found
Ign http://files.ettus.com trusty/main Translation-en_US                       
Ign http://files.ettus.com trusty/main Translation-en                          
Err http://extras.ubuntu.com trusty/main amd64 Packages                        
  404  Not Found
Err http://extras.ubuntu.com trusty/main i386 Packages               
  404  Not Found

... 这里还有更多...

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/universe/source/Sources  404  Not Found

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/source/Sources  404  Not Found

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/source/Sources  404  Not Found

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/multiverse/source/Sources  404  Not Found

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/main/binary-amd64/Packages  404  Not Found

W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/trusty-security/restricted/binary-amd64/Packages  404  Not Found

...还有更多...

我在网上搜索了一下,发现有些路径末尾缺少文件扩展名。这是问题的一部分吗?就像我说的,我对 Ubuntu 完全陌生,仍在摸索。我该如何解决这个问题?

我执行了 etc/apt/sources.list 并得到以下内容:

# deb cdrom:[Ubuntu 14.04.2 LTS _Trusty Tahr_ - Release amd64 (20150218.1)]/ trusty main restricted
deb-src http://archive.ubuntu.com/ubuntu trusty main restricted multiverse #Added by software-properties

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty main restricted multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty universe main restricted #Added by software-properties

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ trusty-updates main restricted multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-updates universe main restricted multiverse #Added by software-properties

## 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://us.archive.ubuntu.com/ubuntu/ trusty universe
deb http://us.archive.ubuntu.com/ubuntu/ trusty-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.

## 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://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse #Added by software-properties

deb http://security.ubuntu.com/ubuntu trusty-security main restricted multiverse
deb-src http://security.ubuntu.com/ubuntu trusty-security universe main restricted multiverse #Added by software-properties
deb http://security.ubuntu.com/ubuntu trusty-security universe

## 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 trusty partner
# deb-src http://archive.canonical.com/ubuntu trusty partner

## 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 trusty main
deb-src http://extras.ubuntu.com/ubuntu trusty main

我发现答案,但我的 sources.list 文件甚至不包含需要删除的行,所以这没有帮助。我也看了这里但这并没有解决我的问题。我被这个问题难住了。有什么建议吗?这是我没有找到的重复问题吗?谢谢你的帮助。

问候,马歇尔

答案1

好吧,在同事的帮助下,我成功了。我们主要做了两件事:

(1) 我们在环境文件中设置代理设置,而不是在 apt.conf 中(因此代理设置将针对每个应用程序进行设置)。此外,我们确实发现我的代理设置有误(感谢 steeldriver 要求我仔细检查)。

http_proxy=<correct proxy setting>
https_proxy=<correct proxy setting>
no_proxy=<internal work website url>

no_proxy 设置适用于我自己的工作内部网站,因为我们不使用代理来访问它,所以如果没有 no_proxy 环境变量,我就无法访问该网站。

(2) 我进入了 /etc/sudoers 文件,并在 Defaults env_reset 之后为每个环境变量添加了 Defaults(因此我添加了 3 行)。结果发现这有问题;相反,我们只是在 Defaults env_reset 和 env_keep 的同一行上添加了 3 个环境变量,如下所示:

Defaults env_reset, env_keep+=no_proxy, env_keep+=http_proxy, env_keep+=https_proxy

这样,每次使用 sudo 时这些环境变量就不会消失。现在我可以正常运行了。

相关内容