# Receiving non zero return code error while running raw module

**URL:** <https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251>\
**Category:** Get Help\
**Tags:** collections, ansible-core\
**Created:** [November 9, 2023, 6:04am UTC](https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251 "2023-11-09T06:04:42Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![johntxjw](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/johntxjw/32/3520_2.png) [@johntxjw](https://forum.ansible.com/u/johntxjw)\
**Post date:** [November 9, 2023, 6:04am UTC](https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251/1 "2023-11-09T06:04:42Z")

</div>

Hello, I’m new to ansible and I need some help.  
I have been trying to test running raw module to cisco devices but I keep receiving a failed error and get the following message:  
FAILED! =\> {“changed”: true, “msg”: “non-zero return code”, “rc”: 127, “stderr”: “/bin/sh: 1: show: not found\n”, “stderr\_lines”: [“/bin/sh: 1: show: not found”], “stdout”: “”, “stdout\_lines”: }  
How can I correct this issue? It just started today.

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [November 9, 2023, 6:24am UTC](https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251/2 "2023-11-09T06:24:49Z")

</div>

Hi,

Here is your issue:

> “stderr\_lines”: [“/bin/sh: 1: show: not found”]

It seems you are trying to run `show` command, which isn’t interpreted by shell in use (sh).

Raw module doc page states that:

> - Arguments given to `raw` are run directly through the configured remote shell.

I’m not sure about Cisco devices, but I think they use their own shell, be it IOS or Catalyst.

Could you share your playbook as well ?

Edit: Also note you can [specify which shell to use](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/raw_module.html#parameter-executable) if you know its path.

---

<div class="post-metadata">

**Author:** ![johntxjw](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/johntxjw/32/3520_2.png) [@johntxjw](https://forum.ansible.com/u/johntxjw)\
**Post date:** [November 9, 2023, 6:51am UTC](https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251/3 "2023-11-09T06:51:11Z")

</div>

* * *

- name: ARP  
hosts: all  
gather\_facts: false

---

<div class="post-metadata">

**Author:** ![johntxjw](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/johntxjw/32/3520_2.png) [@johntxjw](https://forum.ansible.com/u/johntxjw)\
**Post date:** [November 9, 2023, 6:53am UTC](https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251/4 "2023-11-09T06:53:04Z")

</div>

Its really strange it has worked as is until today when ansible tried to update and I received a error

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [November 9, 2023, 8:10am UTC](https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251/5 "2023-11-09T08:10:57Z")

</div>

> when ansible tried to update and I received a error

I don’t know about that; you could post your update error in another thread if you’d like assistance on this matter.

About the present issue, did you get the same error on all devices you ran your playbook on ?

I’m also wondering if some config changed on your devices; an OS upgrade perhaps ?

Anyways, as said before, you could look for your devices shell path, then specify it on `executable` raw module’s parameter.

---

<div class="post-metadata">

**Author:** ![johntxjw](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/johntxjw/32/3520_2.png) [@johntxjw](https://forum.ansible.com/u/johntxjw)\
**Post date:** [November 9, 2023, 6:38pm UTC](https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251/6 "2023-11-09T18:38:02Z")

</div>

I only get the error when i try to run a playbook using raw module.

My config on devices hasn’t been changed or upgraded, its a test enviroment.

I’m new to linux and ansible, not really sure what you mean in your last sentence, Sorry LOL

---

<div class="post-metadata">

**Author:** ![ptn](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ptn/32/481_2.png) [@ptn](https://forum.ansible.com/u/ptn)\
**Post date:** [November 13, 2023, 7:18pm UTC](https://forum.ansible.com/t/receiving-non-zero-return-code-error-while-running-raw-module/2251/7 "2023-11-13T19:18:28Z")

</div>

> I’m new to linux and ansible, not really sure what you mean in your last sentence, Sorry LOL

`raw` module allows you to specify which shell to use to run your commands, so if you know which one is used on your remote device, you could use it to run raw commands. By defaults, raw module uses `/bin/sh`. I’m not familiar with Cisco devices, so I don’t know for sure how you could get this information, and I feel an `echo $SHELL` won’t cut it.

Anyways, you should probably use [cisco.ios.ios\_command module](https://docs.ansible.com/ansible/latest/collections/cisco/ios/ios_command_module.html#ansible-collections-cisco-ios-ios-command-module) or [ansible.netcommon.network\_cli connection](https://docs.ansible.com/ansible/latest/collections/ansible/netcommon/network_cli_connection.html) instead.
