# bad PATH when running "apt" module

**URL:** <https://forum.ansible.com/t/bad-path-when-running-apt-module/18152>\
**Category:** Ansible Project\
**Created:** [May 4, 2015, 1:37am UTC](https://forum.ansible.com/t/bad-path-when-running-apt-module/18152 "2015-05-04T01:37:07Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![Moritz\_Schepp](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@Moritz\_Schepp](https://forum.ansible.com/u/Moritz_Schepp)\
**Post date:** [March 5, 2018, 12:17am UTC](https://forum.ansible.com/t/bad-path-when-running-apt-module/18152/21 "2018-03-05T00:17:48Z")

</div>

… I just had the same problem and it turned out I had a path set in /etc/environment on that host that didn’t include /sbin. Once I added the path there, the apt module worked fine again.

---

<div class="post-metadata">

**Author:** ![Karol\_Szczecinski](https://avatars.discourse-cdn.com/v4/letter/k/d26b3c/32.png) [@Karol\_Szczecinski](https://forum.ansible.com/u/Karol_Szczecinski)\
**Post date:** [May 21, 2020, 10:32am UTC](https://forum.ansible.com/t/bad-path-when-running-apt-module/18152/22 "2020-05-21T10:32:19Z")

</div>

Try using:

`ssh user@host -t "sudo bash -l -c 'echo \$PATH'"`

As per:  
[https://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell](https://superuser.com/questions/306530/run-remote-ssh-command-with-full-login-shell)

[Previous page](https://forum.ansible.com/t/bad-path-when-running-apt-module/18152.md?page=1)
