LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices

Reply
 
Search this Thread
Old 01-06-2012, 05:18 AM   #1
tbaror
Member
 
Registered: Apr 2006
Posts: 33

Rep: Reputation: 0
Question 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:~#
 
Old 01-06-2012, 05:26 AM   #2
Doc CPU
Senior Member
 
Registered: Jun 2011
Location: Stuttgart, Germany
Distribution: Mint, Debian, Gentoo, Win 2k/XP
Posts: 1,042

Rep: Reputation: 312Reputation: 312Reputation: 312Reputation: 312
Hi there,

Quote:
Originally Posted by tbaror View Post
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
 
Old 01-06-2012, 06:10 AM   #3
tbaror
Member
 
Registered: Apr 2006
Posts: 33

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Doc CPU View Post
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
 
Old 01-06-2012, 10:40 AM   #4
tbaror
Member
 
Registered: Apr 2006
Posts: 33

Original Poster
Rep: Reputation: 0
Thanks any way i figure it out with your help eventually :-)
 
Old 03-05-2013, 02:50 PM   #5
Grindlay
LQ Newbie
 
Registered: Mar 2013
Posts: 1

Rep: Reputation: Disabled
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] "/etc/init.d/apache2" start VS "apache2ctl start" with passenger module (ruby/rails) arond Linux - Server 1 12-13-2010 11:56 AM
fail to start xterm: "could not exec /usr/OSE/bash: No such file or directory" freeindy Linux - General 3 11-28-2008 01:22 AM
"No such file or directory" when trying to start up wlan0 with ifconfig Jonasfrax Linux - Wireless Networking 1 08-26-2008 08:12 AM
I got a error flag "init: /dev/initctl: no such file" mst700 Linux - Newbie 4 10-28-2007 09:00 AM
Problem with X consoles - "shell-init: error retrieving current directory" lowpro2k3 Slackware 4 03-26-2007 07:36 PM


All times are GMT -5. The time now is 08:55 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration