# apt: update\_cache=yes failing in ansible 1.3

**URL:** <https://forum.ansible.com/t/apt-update-cache-yes-failing-in-ansible-1-3/13496>\
**Category:** Ansible Project\
**Created:** [September 17, 2013, 6:44pm UTC](https://forum.ansible.com/t/apt-update-cache-yes-failing-in-ansible-1-3/13496 "2013-09-17T18:44:35Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dan\_CaJacob](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@Dan\_CaJacob](https://forum.ansible.com/u/Dan_CaJacob)\
**Post date:** [September 17, 2013, 6:44pm UTC](https://forum.ansible.com/t/apt-update-cache-yes-failing-in-ansible-1-3/13496/1 "2013-09-17T18:44:35Z")

</div>

I am getting a new error in 1.3 when running apt: update\_cache=yes:

> yields msg: Failed to lock apt for exclusive operation

But, I can run sudo apt-get update on the node just fine and this worked before the upgrade to 1.3 The failure occurred on more than one node.

I reverted to ansible 1.2.3 and the problem went away.

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [September 17, 2013, 6:48pm UTC](https://forum.ansible.com/t/apt-update-cache-yes-failing-in-ansible-1-3/13496/2 "2013-09-17T18:48:01Z")

</div>

Are you running the apt module in ansible using sudo?

---

<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:** [September 17, 2013, 6:48pm UTC](https://forum.ansible.com/t/apt-update-cache-yes-failing-in-ansible-1-3/13496/3 "2013-09-17T18:48:24Z")

</div>

Can you please report this on [github.com/ansible/ansible](http://github.com/ansible/ansible) ?

Please include your OS version.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca1](https://avatars.discourse-cdn.com/v4/letter/b/278dde/32.png) [@Brian\_Coca1](https://forum.ansible.com/u/Brian_Coca1)\
**Post date:** [September 17, 2013, 7:07pm UTC](https://forum.ansible.com/t/apt-update-cache-yes-failing-in-ansible-1-3/13496/4 "2013-09-17T19:07:48Z")

</div>

FYI, I just used this on ubuntu 12 & 13 w/o any issues (using sudo) and ansible 1.3

---

<div class="post-metadata">

**Author:** ![Serge\_van\_Ginderacht](https://avatars.discourse-cdn.com/v4/letter/s/b782af/32.png) [@Serge\_van\_Ginderacht](https://forum.ansible.com/u/Serge_van_Ginderacht)\
**Post date:** [September 17, 2013, 8:21pm UTC](https://forum.ansible.com/t/apt-update-cache-yes-failing-in-ansible-1-3/13496/5 "2013-09-17T20:21:04Z")

</div>

it gave no issues.  
Can this be a coincidence, where another process was using apt?​​  
Are you sure ansible had (sudo) root permissions on the box?

Serge

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [September 17, 2013, 8:34pm UTC](https://forum.ansible.com/t/apt-update-cache-yes-failing-in-ansible-1-3/13496/6 "2013-09-17T20:34:17Z")

</div>

After discussion on the github issue, it appears this may be related to sudo: not being explicitly declared for the play (since -K no longer implicitly causes sudo to be used).
