Author Topic: Why does it refuse to execute some programs?  (Read 2476 times)

Stephanie

  • Guest
Why does it refuse to execute some programs?
« on: May 05, 2010, 09:52:51 pm »
I've run into this problem a couple times, and can't figure out what the problem is.

Connected to the dingoo via usb networking, or even via a serial cable, I'm in a shell session, and I try and execute a program, and it tells me the program is not found -- yet if I list it, the program is right there:
Code: [Select]
# ./some-script
-sh: ./some-script: not found
# ls -al some-script
-rwxr-xr-x    1    root      root      58    May   5 16:14 some-script

I can't figure out what makes it do this, but if it says it once, it will never execute the program. In the case of a shell script, I have to just delete it and rewrite it, or write it again with a new file name.

In the case of a compiled program, I don't know what to do - I have a bunch of programs compiled for Dingux that work under a different zImage but don't work under the normal one. I've checked the md5sum to ensure they didn't get corrupted when I moved them. Everything seems legit, but Dingux just refuses to run them...

Is there something I'm missing?

Thanks!



darfgarf

  • Guest
Re: Why does it refuse to execute some programs?
« Reply #1 on: May 05, 2010, 09:57:21 pm »
have you run checkdisk/fsck on the sd card recently? might be corrupted or something?

if there's nothing wrong with the file you're trying to run it shouldn't do it

(i had a very similar problem with a clash between 32-bit and 64-bit linux, but that's more probably completely irellevant)

Stephanie

  • Guest
Re: Why does it refuse to execute some programs?
« Reply #2 on: May 05, 2010, 10:11:24 pm »
Thanks for the suggestion!

I just checked it and it passed, no errors on the sd card...  :-\

It's very wierd and frustrating.

darfgarf

  • Guest
Re: Why does it refuse to execute some programs?
« Reply #3 on: May 05, 2010, 10:25:05 pm »
is it only programs you write yourself?
does it have problems if you don't launch over telnet?
are you running some strange version of linux/other os?
how are you transferring the files to the dingoo? (if ftp-ing, check it's in binary transfer mode, some seem to have problems)

all wild stabs in the dark XD

zear

  • * Moderator
  • Posts: 2381
Re: Why does it refuse to execute some programs?
« Reply #4 on: May 05, 2010, 10:41:06 pm »
I remember I once faced a very similar problem on another platform. If I remember correctly it was due to the binary being compiled with an ancient version of glibc.
No idea if that's the reason here, as after all you're trying to run a bash script, not an ELF binary.

Stephanie

  • Guest
Re: Why does it refuse to execute some programs?
« Reply #5 on: May 06, 2010, 02:21:16 am »
With scripts, it seems to be if I write them on a windows computer (in notepad, eg) and then drag and drop the files to the micro SD card - the microsd mounted in a usb adaptor. If I delete the script then rewrite it directly on the dingoo via telnet then it works fine, though it's the same exact script. The only difference I can think of are the line endings.

The binaries, in this case the ones I want are the nand & flash tools that are in the dual-boot installer zimage. I used an initrd extracter to get the initrd out of that zimage then unpacked the initrd to get the files. I've tried ftp-ing them onto the dingoo, and I've tried mounting the micro-sd and drag-and-dropping the files over. They don't run either way.

I've booted the dingoo with the dual-boot installer, used the serial port to get in and check the md5sum of the binaries in their original 'environment', and verified that against the files I extracted from the initrd. Everything matches. Except the binaries run when booted in the dual-boot zimage, and are 'not found' when I try to run them in the normal kernel.

As for the os, I'm using the 'rtc poweroff' kernel, I downloaded the sources from googlecode and recompiled it to include mtd / nand and i2c support.

Thanks again for the help!

darfgarf

  • Guest
Re: Why does it refuse to execute some programs?
« Reply #6 on: May 06, 2010, 08:02:11 am »
The only difference I can think of are the line endings.

As for the os, I'm using the 'rtc poweroff' kernel, I downloaded the sources from googlecode and recompiled it to include mtd / nand and i2c support.

Thanks again for the help!


the line endings would give you a problem like 'unknown symbol on line 1' or similar, shouldn't cause it to ignore the fact the file is actually there

could be something you missed when compiling the kernel then? no idea :D

Stephanie

  • Guest
Re: Why does it refuse to execute some programs?
« Reply #7 on: May 06, 2010, 03:18:23 pm »
I'm wondering now if the error message is just a generic one, i.e. I've read that the shell in busybox isn't that clever, so maybe the not found warning is in lieu of some other more detailed message.

And if that's the case, then I can imagine the script not running if it sees "#!/bin/sh^M" as invalid.

As for the binaries, I had a thought late last night that maybe there's a library or something that they need, that's not in my filesystem. I'll look into that this afternoon and see if I come up with anything.

Thanks again for the tips!