This is a cache of https://support.nagios.com/kb/article/nagios-xi-uploaded-plugin-returns-bin-bash%5Em-bad-interpreter-no-such-file-or-directory-474.html. It is a snapshot of the page at 2025-05-14T00:08:51.480+0000.
Nagios <strong>xi</strong> - Uploaded plugin returns "/bin/bash^M: bad interpreter: No such file or directory"
Home » Categories » Multiple Categories

Nagios xi - Uploaded plugin returns "/bin/bash^M: bad interpreter: No such file or directory"

Problem Description

After uploading a plugin (check_apc_pdu_load.sh for example), the following error is produced:

The following error message is produced:

-bash: ./check_apc_pdu_load.sh: /bin/bash^M: bad interpreter: No such file or directory

This is caused by the file being in a "Windows" format instead of a "Unix" format. It has to do with the line endings / carriage returns.

 

Resolving The Problem

To resolve the problem you will convert the file to a Unix format. Execute the following steps from an SSH session as a user with root privileges.

The first step is to install the required package:

RHEL | CentOS | Oracle Linux

yum install -y dos2unix

 

Debian | Ubuntu

apt-get install -y dos2unix

 

The next step is to convert the file to a Unix format:

dos2unix /usr/local/nagios/libexec/check_apc_pdu_load.sh


This will output:

dos2unix: converting file /usr/local/nagios/libexec/check_apc_pdu_load.sh to UNIX format ...

 

After completing these steps the plugin should execute as intended.

 

 

Final Thoughts

For any support related questions please visit the Nagios Support Forums at:

http://support.nagios.com/forum/



Special Offer For Knowledgebase Visitors! Get a huge discount on Nagios Log Server by clicking below.

Get 60% Off Nagios Log Server!

Did you know? Nagios provides complete monitoring of: Windows, Linux, UNIX, Servers, Websites, SNMP, DHCP, DNS, Email, Storage, Files, Apache, IIS, EC2, and more!

0 (0)
Article Rating (No Votes)
Rate this article
  • Icon PDFExport to PDF
  • Icon MS-WordExport to MS Word
Attachments Attachments
There are no attachments for this article.
Related Articles RSS Feed
Upgrading to NDO 3 after having been downgraded in newer versions of Nagios xi
Viewed 4322 times since Fri, Jan 15, 2021
Disabling Port 113 IDENT Requests
Viewed 6029 times since Tue, Mar 12, 2019
Nagios xi - Common Upgrade Failures And Solutions
Viewed 14561 times since Thu, Jun 29, 2017
Nagios xi - Running Out Of Disk Space On The Nagios xi VM
Viewed 23973 times since Tue, Jan 27, 2015
Nagios xi - CentOS 6 Installation Problems xi 2011R1.7 2011R1.8
Viewed 5213 times since Tue, Feb 2, 2016
Nagios xi - Best Practices - NWC15
Viewed 8826 times since Thu, Feb 4, 2016
SSL Certificate does not validate properly
Viewed 5363 times since Wed, Jan 20, 2021
CCM says unapplied changes exist, but none listed
Viewed 6303 times since Mon, Feb 27, 2017
Nagios xi - ICMP and Ping Checks Stopped Graphing
Viewed 13862 times since Mon, Jan 25, 2016
Nagios xi - Event Data Is Stale
Viewed 5983 times since Wed, Jan 27, 2016