# apt update failing on ubuntu-14.04 in ec2

**URL:** <https://forum.ansible.com/t/apt-update-failing-on-ubuntu-14-04-in-ec2/19591>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [October 23, 2015, 1:28am UTC](https://forum.ansible.com/t/apt-update-failing-on-ubuntu-14-04-in-ec2/19591 "2015-10-23T01:28:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![igorc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/igorc/32/5491_2.png) [@igorc](https://forum.ansible.com/u/igorc)\
**Post date:** [October 23, 2015, 1:28am UTC](https://forum.ansible.com/t/apt-update-failing-on-ubuntu-14-04-in-ec2/19591/1 "2015-10-23T01:28:54Z")

</div>

Hi all,

The following task:

- name: Update apt  
apt: update\_cache=yes cache\_valid\_time=3600  
when: ansible\_os\_family == “Debian”

suddenly failed today on the newly created ec2 host after running successfully for a long long time.

The trace is given below:

Traceback (most recent call last):  
File “”, line 2258, in   
File “”, line 554, in main  
File “/usr/lib/python2.7/dist-packages/apt/cache.py”, line 107, in **init**  
self.open(progress)  
File “/usr/lib/python2.7/dist-packages/apt/cache.py”, line 153, in open  
self.\_records = apt\_pkg.PackageRecords(self.\_cache)  
SystemError: E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_universe\_i18n\_Translation-en - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_restricted\_i18n\_Translation-en - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_multiverse\_i18n\_Translation-en - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_main\_i18n\_Translation-en - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_multiverse\_binary-amd64\_Packages - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_universe\_binary-amd64\_Packages - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_restricted\_binary-amd64\_Packages - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_main\_binary-amd64\_Packages - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty\_universe\_i18n\_Translation-en - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty\_restricted\_i18n\_Translation-en - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty\_multiverse\_i18n\_Translation-en - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty\_main\_i18n\_Translation-en - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty\_multiverse\_binary-amd64\_Packages - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty\_universe\_binary-amd64\_Packages - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty\_restricted\_binary-amd64\_Packages - open (2: No such file or directory), E:Could not open file /var/lib/apt/lists/archive.ubuntu.com\_ubuntu\_dists\_trusty\_main\_binary-amd64\_Packages - open (2: No such file or directory)

FATAL: all hosts have already failed – aborting

- name: Update apt  
apt: update\_cache=yes cache\_valid\_time=3600  
when: ansible\_os\_family == “Debian”

Of course the named archive files do not exist since this is a Amazon mirror:

$ ls -l /var/lib/apt/lists/  
total 111780  
-rw-r–r-- 1 root root 8234934 May 8 2014 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty\_main\_binary-amd64\_Packages  
-rw-r–r-- 1 root root 4149211 Apr 15 2014 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty\_main\_i18n\_Translation-en  
-rw-r–r-- 1 root root 5000095 May 8 2014 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty\_main\_source\_Sources  
-rw-r–r-- 1 root root 58512 May 8 2014 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty\_Release  
-rw-r–r-- 1 root root 933 May 8 2014 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty\_Release.gpg  
-rw-r–r-- 1 root root 31726252 May 8 2014 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty\_universe\_binary-amd64\_Packages  
-rw-r–r-- 1 root root 18635427 May 8 2014 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty\_universe\_i18n\_Translation-en  
-rw-r–r-- 1 root root 27857155 May 8 2014 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty\_universe\_source\_Sources  
-rw-r–r-- 1 root root 64439 Oct 22 23:50 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_InRelease  
-rw-r–r-- 1 root root 4195440 Oct 22 23:50 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_main\_binary-amd64\_Packages  
-rw-r–r-- 1 root root 3256427 Oct 22 18:40 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_main\_i18n\_Translation-en  
-rw-r–r-- 1 root root 1243126 Oct 22 23:50 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_main\_source\_Sources  
-rw-r–r-- 1 root root 1913553 Oct 22 23:50 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_universe\_binary-amd64\_Packages  
-rw-r–r-- 1 root root 870209 Oct 22 18:40 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_universe\_i18n\_Translation-en  
-rw-r–r-- 1 root root 666802 Oct 22 23:50 ap-southeast-2.ec2.archive.ubuntu.com\_ubuntu\_dists\_trusty-updates\_universe\_source\_Sources  
-rw-r----- 1 root root 0 Jun 7 2014 lock  
drwxr-xr-x 2 root root 4096 Oct 23 01:09 partial  
-rw-r–r-- 1 root root 64441 Oct 23 01:03 security.ubuntu.com\_ubuntu\_dists\_trusty-security\_InRelease  
-rw-r–r-- 1 root root 2394096 Oct 23 01:03 security.ubuntu.com\_ubuntu\_dists\_trusty-security\_main\_binary-amd64\_Packages  
-rw-r–r-- 1 root root 2422009 Oct 21 07:18 security.ubuntu.com\_ubuntu\_dists\_trusty-security\_main\_i18n\_Translation-en  
-rw-r–r-- 1 root root 484300 Oct 23 01:03 security.ubuntu.com\_ubuntu\_dists\_trusty-security\_main\_source\_Sources  
-rw-r–r-- 1 root root 701202 Oct 23 01:03 security.ubuntu.com\_ubuntu\_dists\_trusty-security\_universe\_binary-amd64\_Packages  
-rw-r–r-- 1 root root 345076 Oct 21 07:18 security.ubuntu.com\_ubuntu\_dists\_trusty-security\_universe\_i18n\_Translation-en  
-rw-r–r-- 1 root root 125499 Oct 23 01:03 security.ubuntu.com\_ubuntu\_dists\_trusty-security\_universe\_source\_Sources

$ ansible --version  
ansible 1.9.4  
configured module search path = /usr/share/ansible

Any ideas?

Thanks,  
Igor

---

<div class="post-metadata">

**Author:** ![Mark\_McWilliams](https://avatars.discourse-cdn.com/v4/letter/m/97f17d/32.png) [@Mark\_McWilliams](https://forum.ansible.com/u/Mark_McWilliams)\
**Post date:** [October 23, 2015, 8:16pm UTC](https://forum.ansible.com/t/apt-update-failing-on-ubuntu-14-04-in-ec2/19591/2 "2015-10-23T20:16:48Z")

</div>

I am noticing exactly the same thing. Like you, it just started happening in the last few days. I believe its related to Canonical’s Ubuntu AMI that was updated on October, 19th. This issue only started for me after switching to this updated AMI. I’ve been able to mostly workaround it by having an explicit apt cache update task with a retry:

`

- name: Update apt cache  
apt: update\_cache=yes  
register: result  
until: result|success  
retries: 10

`

The cache update often fails on the first attempt, and then succeeds on the next. This happens frequently, but inconsistently any time I launch a new instance with this AMI.

---

<div class="post-metadata">

**Author:** ![igorc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/igorc/32/5491_2.png) [@igorc](https://forum.ansible.com/u/igorc)\
**Post date:** [October 26, 2015, 2:19am UTC](https://forum.ansible.com/t/apt-update-failing-on-ubuntu-14-04-in-ec2/19591/3 "2015-10-26T02:19:19Z")

</div>

Thanks Mark for confirming this. Now off to update all of my playbooks ☹
