# Occasional apt-get update problems with EC2 using Ansible

**URL:** <https://forum.ansible.com/t/occasional-apt-get-update-problems-with-ec2-using-ansible/13605>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [October 3, 2013, 4:25pm UTC](https://forum.ansible.com/t/occasional-apt-get-update-problems-with-ec2-using-ansible/13605 "2013-10-03T16:25:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cyrus\_Durgin](https://avatars.discourse-cdn.com/v4/letter/c/e95f7d/32.png) [@Cyrus\_Durgin](https://forum.ansible.com/u/Cyrus_Durgin)\
**Post date:** [October 3, 2013, 4:25pm UTC](https://forum.ansible.com/t/occasional-apt-get-update-problems-with-ec2-using-ansible/13605/1 "2013-10-03T16:25:17Z")

</div>

Hi folks,

I’m not certain (in fact I’m entirely uncertain) that this is directly an Ansible issue, but I’ve only come across it with instances launched using the “ec2” module. Occasionally (maybe 1 in 5 or fewer) the first command (apt: update=dist update-cache=yes) run after waiting for ssh to become available results in an error along these lines:

failed: [a.b.c.d] =\> {“changed”: true, “cmd”: [“apt-get”, “update”], “delta”: “0:00:01.103811”, “end”: “2013-10-02 23:50:06.322064”, “item”: “”, “rc”: 100, “start”: “2013-10-02 23:50:05.218253”}  
stderr: E: Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_precise\_Release - open (2: No such file or directory)  
E: Unable to determine the file size - fstat (9: Bad file descriptor)  
stdout: Hit [http://archive.ubuntu.com](http://archive.ubuntu.com) precise Release.gpg  
Get:1 [http://archive.ubuntu.com](http://archive.ubuntu.com) precise-updates Release.gpg [198 B]  
Get:2 [http://security.ubuntu.com](http://security.ubuntu.com) precise-security Release.gpg [198 B]  
Hit [http://archive.ubuntu.com](http://archive.ubuntu.com) precise Release  
Get:3 [http://archive.ubuntu.com](http://archive.ubuntu.com) precise-updates Release [49.6 kB]  
Get:4 [http://security.ubuntu.com](http://security.ubuntu.com) precise-security Release [49.6 kB]

FATAL: all hosts have already failed – aborting

I haven’t been able to determine if this is an occasional EC2 problem, or an issue of how I’m running my plays, but thought I’d toss it out there and see if anyone else has experienced this.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 3, 2013, 7:58pm UTC](https://forum.ansible.com/t/occasional-apt-get-update-problems-with-ec2-using-ansible/13605/2 "2013-10-03T19:58:35Z")

</div>

Haven’t seen this before. Is there something being generated the first time the system starts up related to the apt configuration possibly where you might need to wait longer?

---

<div class="post-metadata">

**Author:** ![Cyrus\_Durgin](https://avatars.discourse-cdn.com/v4/letter/c/e95f7d/32.png) [@Cyrus\_Durgin](https://forum.ansible.com/u/Cyrus_Durgin)\
**Post date:** [October 4, 2013, 1:38pm UTC](https://forum.ansible.com/t/occasional-apt-get-update-problems-with-ec2-using-ansible/13605/3 "2013-10-04T13:38:50Z")

</div>

Yep, it’s executed immediately after a wait for ssh to become available after a new instance launches - I had the same suspicion, that it’s related to the host not being fully ready - I’ll throw in an additional wait and see if the problem continues to surface periodically. Thanks!
