# Failed to lock apt for exclusive operation

**URL:** <https://forum.ansible.com/t/failed-to-lock-apt-for-exclusive-operation/18213>\
**Category:** Ansible Project\
**Created:** [May 12, 2015, 6:28pm UTC](https://forum.ansible.com/t/failed-to-lock-apt-for-exclusive-operation/18213 "2015-05-12T18:28:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![trupti\_mali](https://avatars.discourse-cdn.com/v4/letter/t/73ab20/32.png) [@trupti\_mali](https://forum.ansible.com/u/trupti_mali)\
**Post date:** [May 12, 2015, 6:28pm UTC](https://forum.ansible.com/t/failed-to-lock-apt-for-exclusive-operation/18213/1 "2015-05-12T18:28:14Z")

</div>

I am using ansible 2.0 - the development version. I have read many threads on the above issue and essentially all suggested to make sure we are doing sudo = True. I tried with Sudo true at playbook level , include level and now inside ansible.cfg as well. But I am still getting the same error.  
When I ran the playbook in -vvvv mode here is what I see -

\<212.71.255.79\> EXEC ssh -C -tt -vvv -F ssh.config -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 212.71.255.79 /bin/sh -c ‘sudo -k && sudo -H -S -p “[sudo via ansible, key=fvzlrgtvogqmaybuqufnxzunpgmwmajo] password: " -u root /bin/sh -c '”’“‘echo BECOME-SUCCESS-fvzlrgtvogqmaybuqufnxzunpgmwmajo; LANG=en\_US.UTF-8 LC\_CTYPE=en\_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1431423533.2-123716523690549/apt; rm -rf /root/.ansible/tmp/ansible-tmp-1431423533.2-123716523690549/ \>/dev/null 2\>&1’”‘"’’  
failed: [swift-package-cache-01] =\> (item=swift,python-swiftclient,openssh-server,rsync) =\> {“failed”: true, “item”: “swift,python-swiftclient,openssh-server,rsync”}  
msg: Failed to lock apt for exclusive operation

I was expecting message as SUDO\_SUCCESS instead of BECOME\_SUCCESS. But I think that shud be fine. Can some one please guide me? I have also t
