WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: sh: file not found error for script in usb persistent opt directory  (Read 5121 times)

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
I've created a persistent opt directory in sda1 using the boot option opt=sda1. All that worked fine. I then copied over to the opt directory my web server lampp directory. I then tried to run the lamp apache startup script but get sh: lampp file not found error message. I've checked the simple things like permissions and ownership as well as the file structure (ext2). All seems ok. I've looked in the fstab file and sda1 is loaded correctly. I've run stat on the lampp file script and it seems fine. Any ideas?
big pc man

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10060
Re: sh: file not found error for script in usb persistent opt directory
« Reply #1 on: January 04, 2009, 11:29:56 AM »
Is the directory in PATH? Where are you trying to run it from, and are you trying to run it with full path or just the name?
The only barriers that can stop you are the ones you create yourself.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: sh: file not found error for script in usb persistent opt directory
« Reply #2 on: January 04, 2009, 11:58:47 AM »
I cd'ed to the directory the command is in and ran the command from there. Actually I tried it several ways, ./name and name. By the way this all works in DSL 4.4. I renamed the opt directory for DSL to Opt_dsl to get it out of the way and then booted into tc and created a new opt. After sudo su in Aterm, I copied the opt directory from tc (cp -af opt mnt/sda1 ) to sda1 and then copied the lampp directory (cp -af mnt/sda1/opt_dsl/lampp mnt/sda1/opt) to the new opt directory. I then rebooted with the opt=sda1 option. Very curious that the lampp command is not found.
« Last Edit: January 04, 2009, 12:11:56 PM by bigpcman »
big pc man

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: sh: file not found error for script in usb persistent opt directory
« Reply #3 on: January 04, 2009, 12:08:49 PM »
sh not found is usually the result of a script calling bash via  she-bang
TC does not use bash but the ash shell
Change the she-bang to #!/bin/sh
or load the extension that will provide the necessary shell.
10+ Years Contributing to Linux Open Source Projects.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: sh: file not found error for script in usb persistent opt directory
« Reply #4 on: January 04, 2009, 12:23:44 PM »
Thanks for the reply Robert. The script uses #!/bin/bash so I assume I need to load the bash shell. Since I only need one shell how would I remove the ash shell and make this persistent. Is remastering required?
big pc man

Offline ^thehatsrule^

  • Administrator
  • Hero Member
  • *****
  • Posts: 1726
Re: sh: file not found error for script in usb persistent opt directory
« Reply #5 on: January 04, 2009, 12:56:07 PM »
The ash shell is part of busybox.  So unless you want to rebuild that without it, there's no need to bother.  If you want to do that though, it would require remastering.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: sh: file not found error for script in usb persistent opt directory
« Reply #6 on: January 04, 2009, 02:54:43 PM »
Just  say no remastering. That is not what TC is about!

We are talking about a bash script.
Most bash scripts will run fine in ash.
Edit the first line to #!/bin/sh and try it.

If you need to load the bash extension then edit the she-bang line to reflect its location if needed or make a link from /bin/bash to its location. I have not checked, but if the bash extension does not load bash to /bin/bash then you can make a link.
10+ Years Contributing to Linux Open Source Projects.

Offline roberts

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
  • Founder Emeritus
Re: sh: file not found error for script in usb persistent opt directory
« Reply #7 on: January 04, 2009, 03:03:21 PM »
I just checked and the bash.tce extension loads bash to /bin/bash
So add bash.tce to your collection and you should be good to go.
10+ Years Contributing to Linux Open Source Projects.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: sh: file not found error for script in usb persistent opt directory
« Reply #8 on: January 05, 2009, 12:02:22 PM »
OK, I tried the sh instead of bash no luck there. I installed bash and that did fix the file not found error. However, now I'm getting the following error:
netstat: /proc/net/tcp6: no such file or directory. There's also similar errors for udp6 and raw6. Any ideas?
big pc man

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10060
Re: sh: file not found error for script in usb persistent opt directory
« Reply #9 on: January 05, 2009, 12:35:47 PM »
I think it wants ipv6 support; see firewall-2.6.26.tcem
The only barriers that can stop you are the ones you create yourself.

Offline bigpcman

  • Hero Member
  • *****
  • Posts: 719
Re: sh: file not found error for script in usb persistent opt directory
« Reply #10 on: January 05, 2009, 12:54:14 PM »
Thanks that helped. I installed the firewall and ipv6 support tce. I used to get four sets of errors for the tcp, udp and raw files (no such file or directory). Now I just get the first set of errors then everything after that goes ahead without error. Is there some kind of trigger to get the ipv6 support to be active?
big pc man

Offline curaga

  • Administrator
  • Hero Member
  • *****
  • Posts: 10060
Re: sh: file not found error for script in usb persistent opt directory
« Reply #11 on: January 05, 2009, 01:11:23 PM »
Loading the modules. I guess your app/the kernel autoloader tries to load them after the first access try.
The only barriers that can stop you are the ones you create yourself.