每当我用Ubuntu 14.04(使用ami-a182b391 ,从这里find)创build一个新的AWS EC2实例,然后立即运行sudo apt-get -y update ,它会给我一个错误。
这里的操作系统信息:
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 14.04.2 LTS Release: 14.04 Codename: trusty
以下是失败的apt命令:
$ sudo apt-get -y update Ign http://us-west-2.ec2.archive.ubuntu.com trusty InRelease Ign http://us-west-2.ec2.archive.ubuntu.com trusty-updates InRelease Hit http://us-west-2.ec2.archive.ubuntu.com trusty Release.gpg Hit http://us-west-2.ec2.archive.ubuntu.com trusty-updates Release.gpg Hit http://us-west-2.ec2.archive.ubuntu.com trusty Release Hit http://us-west-2.ec2.archive.ubuntu.com trusty-updates Release Get:1 http://us-west-2.ec2.archive.ubuntu.com trusty/main Sources [1,064 kB] Get:2 http://us-west-2.ec2.archive.ubuntu.com trusty/universe Sources [6,399 kB] Ign http://security.ubuntu.com trusty-security InRelease Get:3 http://security.ubuntu.com trusty-security Release.gpg [933 B] Get:4 http://security.ubuntu.com trusty-security Release [63.5 kB] Hit http://us-west-2.ec2.archive.ubuntu.com trusty/main amd64 Packages Hit http://us-west-2.ec2.archive.ubuntu.com trusty/universe amd64 Packages Hit http://us-west-2.ec2.archive.ubuntu.com trusty/main Translation-en Hit http://us-west-2.ec2.archive.ubuntu.com trusty/universe Translation-en Get:5 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/main Sources [196 kB] Get:6 http://us-west-2.ec2.archive.ubuntu.com trusty-updates/universe Sources [114 kB] Hit http://us-west-2.ec2.archive.ubuntu.com trusty-updates/main amd64 Packages Hit http://us-west-2.ec2.archive.ubuntu.com trusty-updates/universe amd64 Packages Hit http://us-west-2.ec2.archive.ubuntu.com trusty-updates/main Translation-en Hit http://us-west-2.ec2.archive.ubuntu.com trusty-updates/universe Translation-en Ign http://us-west-2.ec2.archive.ubuntu.com trusty/main Translation-en_US Ign http://us-west-2.ec2.archive.ubuntu.com trusty/universe Translation-en_US Get:7 http://security.ubuntu.com trusty-security/main Sources [80.3 kB] Get:8 http://security.ubuntu.com trusty-security/universe Sources [21.9 kB] Get:9 http://security.ubuntu.com trusty-security/main amd64 Packages [267 kB] Get:10 http://security.ubuntu.com trusty-security/universe amd64 Packages [101 kB] Hit http://security.ubuntu.com trusty-security/main Translation-en Hit http://security.ubuntu.com trusty-security/universe Translation-en Fetched 8,308 kB in 4s (1,678 kB/s) W: Failed to fetch http://us-west-2.ec2.archive.ubuntu.com/ubuntu/dists/trusty-updates/main/source/Sources Hash Sum mismatch W: Failed to fetch http://us-west-2.ec2.archive.ubuntu.com/ubuntu/dists/trusty-updates/universe/source/Sources Hash Sum mismatch E: Some index files failed to download. They have been ignored, or old ones used instead.
除了启动它并运行这个命令,我从字面上没有别的东西在盒子上,我尝试了多个实例,它总是发生。
我find了一个解决方法:
$ sudo rm -rf /var/lib/apt/lists/ $ sudo apt-get -y update Ign http://us-west-2.ec2.archive.ubuntu.com trusty InRelease Ign http://us-west-2.ec2.archive.ubuntu.com trusty-updates InRelease Get:1 http://us-west-2.ec2.archive.ubuntu.com trusty Release.gpg [933 B] Get:2 http://us-west-2.ec2.archive.ubuntu.com trusty-updates Release.gpg [933 B] ... Get:23 http://security.ubuntu.com trusty-security/main Translation-en [136 kB] Get:24 http://security.ubuntu.com trusty-security/universe Translation-en [56.8 kB] Fetched 21.9 MB in 5s (3,724 kB/s) Reading package lists... Done
但1)为什么这个错误发生,2)是这个解决方法“OK”呢?
相关的post,一些答案和相关的错误报告。
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/972077
TLDR; 1)这是一个亚马逊镜子的问题,2)这是一个普遍的解决方法,通常被认为是“好”,但烦人。
我向AWS提交了支持凭单,问题不再发生。 我相信他们刷新/修复了一些软件包。
安全组 – >出站
* ALL Traffic ALL ALL 0.0.0.0/0 Allow
如果您想连接到外部服务器,如google.com,甚至想要更新,请允许出站,sudo apt-get update
您可以使用AWS前端启用“出站安全组” – >“出站”
确保为AWS实例select了正确的组