# 1.5.4: apt dist-upgrade fails with "No such file or directory"

**URL:** <https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [April 8, 2014, 8:53am UTC](https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967 "2014-04-08T08:53:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jens-Christian\_Fisch](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@Jens-Christian\_Fisch](https://forum.ansible.com/u/Jens-Christian_Fisch)\
**Post date:** [April 8, 2014, 8:53am UTC](https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967/1 "2014-04-08T08:53:26Z")

</div>

I am trying to upgrade all our (ubuntu) servers with the following playbook:

- hosts: all  
serial: 2

tasks:

- name: apt-get update  
apt: update\_cache=yes

- name: apt-get dist-upgrade  
apt: upgrade=dist dpkg\_options=‘force-confold,force-confdef’

- name: reboot  
command: ‘/sbin/reboot’

This fails like so:

TASK: [apt-get dist-upgrade] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
\<10.0.20.4\> REMOTE\_MODULE apt upgrade=dist dpkg\_options=‘force-confold,force-confdef’  
\<10.0.20.67\> REMOTE\_MODULE apt upgrade=dist dpkg\_options=‘force-confold,force-confdef’  
failed: [10.0.20.4] =\> {“cmd”: [“DEBIAN\_FRONTEND=noninteractive”, “DEBIAN\_PRIORITY=critical”, “/usr/bin/apt-get”, “-y”, “-o”, “Dpkg::Options::=–force-confold”, “-o”, “Dpkg::Options::=–force-confdef”, “dist-upgrade”], “failed”: true, “rc”: 2}  
msg: [Errno 2] No such file or directory

The command runs fine if I run it as root on the machine itself:

‘DEBIAN\_FRONTEND=noninteractive DEBIAN\_PRIORITY=critical /usr/bin/apt-get -y -o Dpkg::Options::=–force-confold -o Dpkg::Options::=–force-confdef dist-upgrade’

Using that command line in a ansible ‘command’ or ‘shell’ statement instead of the apt command produces exactly the same error.

Any ideas?

cheers  
Jens-Christian

---

<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:** [April 9, 2014, 1:53pm UTC](https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967/2 "2014-04-09T13:53:17Z")

</div>

For starters, what version of Ansible is this?

Thanks!

---

<div class="post-metadata">

**Author:** ![Jens-Christian\_Fisch](https://avatars.discourse-cdn.com/v4/letter/j/a9adbd/32.png) [@Jens-Christian\_Fisch](https://forum.ansible.com/u/Jens-Christian_Fisch)\
**Post date:** [April 10, 2014, 7:22am UTC](https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967/3 "2014-04-10T07:22:36Z")

</div>

as stated in the subject: It is ansible 1.5.4

cheers  
jc

---

<div class="post-metadata">

**Author:** ![Adam\_Morris](https://avatars.discourse-cdn.com/v4/letter/a/ecae2f/32.png) [@Adam\_Morris](https://forum.ansible.com/u/Adam_Morris)\
**Post date:** [April 14, 2014, 8:20pm UTC](https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967/4 "2014-04-14T20:20:13Z")

</div>

Are you using any of the appropriate flags for sudo?

I’m wondering because it almost sounds like a permissions issue and you say it runs when you run it as root…

What command line are you using to run the actual playbook?

Adam

---

<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:** [April 15, 2014, 9:26pm UTC](https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967/5 "2014-04-15T21:26:45Z")

</div>

Found it.

This command wasn’t being run through the shell, on line 277 is the main problem.

We could pass “use\_unsafe\_shell=True” here, but that’s not ideal. Better would be to set the various environment options directly and then call the command not using the shell.

Please make sure there is a github ticket on this one, the fix is pretty straightforward and I’d like to get this included in our upcoming 1.6, which is due in a couple of weeks.

---

<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:** [April 15, 2014, 9:27pm UTC](https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967/6 "2014-04-15T21:27:03Z")

</div>

note: I’ll file the ticket on this one, don’t want it lost 🙂

---

<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:** [April 16, 2014, 5:44pm UTC](https://forum.ansible.com/t/1-5-4-apt-dist-upgrade-fails-with-no-such-file-or-directory/14967/7 "2014-04-16T17:44:56Z")

</div>

Could you do an md5sum on the module? It should be located at /usr/share/ansible/packaging/apt and should match the following:

$ md5sum /usr/share/ansible/packaging/apt  
7b3796da213ba4a5affab8413e7579d2 /usr/share/ansible/packaging/apt

You might also want to grab the module for that release from [https://github.com/ansible/ansible/blob/release1.5.4/library/packaging/apt](https://github.com/ansible/ansible/blob/release1.5.4/library/packaging/apt) and diff them if the MD5’s don’t match.

The reason I ask is because the command shown in your output has leading environment variables set (ie. DEBIAN\_FRONTEND=noninteractive), but as far as I can tell from the code in 1.5.4 that had been removed by that point.

Thanks!
