LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Ubuntu (http://www.linuxquestions.org/questions/ubuntu-63/)
-   -   Error "env: /etc/init.d/snortd No such file or directory:" trying to start service (http://www.linuxquestions.org/questions/ubuntu-63/error-env-etc-init-d-snortd-no-such-file-or-directory-trying-to-start-service-922358/)

tbaror 01-06-2012 04:18 AM

Error "env: /etc/init.d/snortd No such file or directory:" trying to start service
 
Hello
I am trying to register service for snort and barnyard2 under Ubuntu 11.10 ,I have the copied the scripts under /etc/init.d/

I did chkconfig --add for both snortd & barnyard also chmod 777 , rebooted but still get that error showed below.
Please advice

Thanks

Code:

/etc/init.d/snortd start
-bash: /etc/init.d/snortd: /bin/sh^M: bad interpreter: No such file or directory

Quote:

service snortd start
env: /etc/init.d/snortd: No such file or directory
root@gfn-srv-secmnn:~#

Doc CPU 01-06-2012 04:26 AM

Hi there,

Quote:

Originally Posted by tbaror (Post 4567759)
I am trying to register service for snort and barnyard2 ...

whatever that is ... .oO(?)

Code:

/etc/init.d/snortd start
-bash: /etc/init.d/snortd: /bin/sh^M: bad interpreter: No such file or directory

Obviously, you used the wrong line endings. Unix/Linux traditionally uses just a Linefeed (\n, ASCII 10 or 0x0A), while Windows uses Carriage Return plus Linefeed (\r\n, ASCII 10,13 or 0x0D 0x0A). So bash "sees" the unexpected Carriage return character before the Linefeed and takes it as part of the text.

Save your scripts again, this time using LF only as line endings.

[X] Doc CPU

tbaror 01-06-2012 05:10 AM

Quote:

Originally Posted by Doc CPU (Post 4567766)
Hi there,



whatever that is ... .oO(?)

Code:

/etc/init.d/snortd start
-bash: /etc/init.d/snortd: /bin/sh^M: bad interpreter: No such file or directory

Obviously, you used the wrong line endings. Unix/Linux traditionally uses just a Linefeed (\n, ASCII 10 or 0x0A), while Windows uses Carriage Return plus Linefeed (\r\n, ASCII 10,13 or 0x0D 0x0A). So bash "sees" the unexpected Carriage return character before the Linefeed and takes it as part of the text.

Save your scripts again, this time using LF only as line endings.

[X] Doc CPU

First thanks for the post , but i am newbie level with Linux and quit understand , can you instruct me exactly what is the issue and were to modify
Thanks

tbaror 01-06-2012 09:40 AM

Thanks any way i figure it out with your help eventually :-)

Grindlay 03-05-2013 01:50 PM

env: /etc/init.d/ No such file or directory
 
I had the exact same problem trying to create a Tomcat7 startup script and at the root of it was the file format of the shell script.
I'd copied and pasted some code into a new text document and uploaded it to my server (I used Textpad on Windows) but used the PC file format.
After a few hours of attempting to debug the script, I found the post above and re-saved the file in Unix format.
What I can't understand is why it would produce a "No such file" error ? The file is in the path, the "not found" error was a distraction.
I knew something was wrong with the script because cd'ing to the dir and doing ./name_of_script gave the error :
Code:

/bin/bash^M: bad interpreter: No such file or directory
Hope this saves someone else a couple of hours of head-scratching.


All times are GMT -5. The time now is 10:48 PM.