# running apt: update\_cache=yes is failing the entire play

**URL:** <https://forum.ansible.com/t/running-apt-update-cache-yes-is-failing-the-entire-play/15714>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [July 19, 2014, 7:33am UTC](https://forum.ansible.com/t/running-apt-update-cache-yes-is-failing-the-entire-play/15714 "2014-07-19T07:33:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lokesh\_Dokara](https://avatars.discourse-cdn.com/v4/letter/l/d78d45/32.png) [@Lokesh\_Dokara](https://forum.ansible.com/u/Lokesh_Dokara)\
**Post date:** [July 19, 2014, 7:33am UTC](https://forum.ansible.com/t/running-apt-update-cache-yes-is-failing-the-entire-play/15714/1 "2014-07-19T07:33:04Z")

</div>

invalid output was: SUDO-SUCCESS-siogahtpvfcksvvxfxqslqrszpkxisfp  
bzip2: (stdin) is not a bzip2 file.  
bzip2: (stdin) is not a bzip2 file.  
bzip2: (stdin) is not a bzip2 file.  
bzip2: (stdin) is not a bzip2 file.  
Traceback (most recent call last):  
File “/home/vagrant/.ansible/tmp/ansible-tmp-1405754512.83-262599342047331/apt”, line 1762, in   
main()  
File “/home/vagrant/.ansible/tmp/ansible-tmp-1405754512.83-262599342047331/apt”, line 492, in main  
cache.update()  
File “/usr/lib/python2.7/dist-packages/apt/deprecation.py”, line 98, in deprecated\_function  
return func(\*args, \*\*kwds)  
File “/usr/lib/python2.7/dist-packages/apt/cache.py”, line 418, in update  
raise FetchFailedException(e)  
apt.cache.FetchFailedException: W:Failed to fetch bzip2:/var/lib/apt/lists/partial/us.archive.ubuntu.com\_ubuntu\_dists\_precise\_main\_binary-amd64\_Packages Hash Sum mismatch  
, W:Failed to fetch bzip2:/var/lib/apt/lists/partial/us.archive.ubuntu.com\_ubuntu\_dists\_precise\_restricted\_binary-i386\_Packages Hash Sum mismatch  
, E:Some index files failed to download. They have been ignored, or old ones used instead.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 19, 2014, 11:54am UTC](https://forum.ansible.com/t/running-apt-update-cache-yes-is-failing-the-entire-play/15714/2 "2014-07-19T11:54:53Z")

</div>

So this is a traceback that looks like it needs to be caught to raise a proper error.

Please let us know what version of Ansible you are using, though in this case it seems like we need to catch an exception in the apt module.

Once you have pinned down the Ansible version, please file a ticket at [github.com/ansible/ansible](http://github.com/ansible/ansible) per CONTRIBUTING.md and include the line from your playbook that you used to trigger the task, as well as the output above.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 19, 2014, 12:50pm UTC](https://forum.ansible.com/t/running-apt-update-cache-yes-is-failing-the-entire-play/15714/3 "2014-07-19T12:50:27Z")

</div>

Just wanted to clarify some behavior – that this does not fail the entire play in a way that is abnormal.

It takes the host out of rotation for the rest of the playbook - the host has failed.

If there are other hosts under configuration, those hosts will still be configured, unless they have this same problem.

If it actually failed to download, and the exception _was_ caught, and it returned failed=True, the same thing happens.

Think of this as “the message out of this error condition is not good”, basically, but the error condition would still be there.

The question of why may deal with the upstream repo or your network or apt configuration, I’m not sure.
