# Ansible hangs when using the apt module

**URL:** <https://forum.ansible.com/t/ansible-hangs-when-using-the-apt-module/17947>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 9, 2015, 10:39pm UTC](https://forum.ansible.com/t/ansible-hangs-when-using-the-apt-module/17947 "2015-04-09T22:39:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marcelo\_de\_Moraes\_Se](https://avatars.discourse-cdn.com/v4/letter/m/b5e925/32.png) [@Marcelo\_de\_Moraes\_Se](https://forum.ansible.com/u/Marcelo_de_Moraes_Se)\
**Post date:** [April 9, 2015, 10:39pm UTC](https://forum.ansible.com/t/ansible-hangs-when-using-the-apt-module/17947/1 "2015-04-09T22:39:14Z")

</div>

Hi list,

I’m trying to install a couple of apt packages on Ubuntu 14.04, but Ansible just seems to hang indefinitely when it gets to this task:

- name: Install needed packages for building BTRFS driver  
apt: name={{ item }}  
with\_items:
- uuid-dev
- libattr1-dev
- zlib1g-dev
- libacl1-dev
- e2fslibs-dev
- libblkid-dev
- liblzo2-dev
- asciidoc
- xmlto

I have a couple of questions regarding this:

1. Is there a way to output the current command being executed by Ansible (in this case, the apt-get call)?

2. What’s the difference between the “pkg” argument and name for the “apt” module?

3. Does anyone have any idea why this hangs? Any possible solutions?

I’m using the -vvvv flag, but it doesn’t show any useful information to debug this problem.

Thanks in advance,

– Marcelo

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 9, 2015, 10:55pm UTC](https://forum.ansible.com/t/ansible-hangs-when-using-the-apt-module/17947/2 "2015-04-09T22:55:51Z")

</div>

1) you can use -vvvv to see the actual commands ansible runs (not the  
apt get but the apt.py module), you can use the env var  
ANSIBLE\_KEEP\_REMOTE\_FILES=1 to keep the remote script and debug it  
yourself.

2) none, one is an alias to the other

3) several possibilities, solutions depends on the problem  
- its not hanging, just taking a long time (possible if the system is  
having a hard time downloading the packages)  
- its hanging, which can be caused by a bad package  
- a package that requires input even though its in batch mode (use  
debconf in this case, normally happens with licenses (oracle-java)  
- your apt-cache is out of date and it keeps trying to download from  
the wrong place

most of these you can figure out by running apt manually.
