On Thursday 20 March 2008 20:43, Martinb_ARM_NOMMU_KISSDVD wrote:
> #!/bin/hush
> # stage2 update script
> URL1=http://stage2d.googlepages.com
> STAGE2BASE=/hdd/stage2
> DOWNOUT=st508_rc2b
> wget http://stage2d.googlepages.com/st508_rc2b -O /hdd/stage2/st508_rc2b
> chmod 777 /hdd/stage2/st508_rc2b
> ls /hdd/stage2/st508_rc2b
> exec /hdd/stage2/st508_rc2b
>
> if I use this on a new build firmware it "just don't work"
>
> the output I get if I execute this from telnet prompt I get:
>
> /hdd/newscript # ./setup.tst
> Connecting to stage2d.googlepages.com[74.125.47.118]:80
> st508_rc2b 100% |*****************************| 868 --:--
> ETA
> /hdd/stage2/st508_rc2b
> hush: cannot exec '/hdd/stage2/st508_rc2b': No such file or directory
Ok, this is how that message is reached:
/* built-in 'exec' handler */
static int builtin_exec(char **argv)
{
if (argv[1] == NULL)
return EXIT_SUCCESS; /* Really? */
pseudo_exec_argv(argv + 1);
/* never returns */
}
static void pseudo_exec_argv(char **argv)
{
....
debug_printf_exec("execing '%s'\n", argv[0]);
execvp(argv[0], argv);
bb_perror_msg("cannot exec '%s'", argv[0]); <====== MESSAGE
_exit(1);
}
> so somehow the exec cant find the file but the file does exist for 100% sure
>
> if I remove the exec I have the same behaviour (and the exact same output)
> its NOT related to wget because if I remove the wget and chmod (and the file
> does exist) I have the same problem
>
> so to make the script as small as possible I have paste the following output
> to make it clear:
>
> (this is a paste from a telnet session on my environment)
>
> /hdd/newscript # cat setup.tst
> #!/bin/hush
> # stage2 initscript first setup
> ls -l /hdd/stage2/st508_rc2b
> /hdd/stage2/st508_rc2b
> /hdd/newscript # ./setup.tst
> -rwxrwxrwx 1 root root 868 Mar 20 19:28 /hdd/stage2/st508_rc2b
> hush: cannot exec '/hdd/stage2/st508_rc2b': No such file or directory
> /hdd/newscript #
Trying to reproduce:
/.local/tmp # cat z
#!/bin/hush
# stage2 initscript first setup
ls -l /tmp/pwd
/tmp/pwd
/.local/tmp # ./z
-rwxr-xr-x 1 root root 771336 Mar 20 21:31 /tmp/pwd
/.local/tmp
/.local/tmp #
For me, it works on x86: /tmp/pwd is just a renamed busybox binary
and it does what "pwd" is supposed to do.
> so I'm sure there is something wrong because this output is not normal
> behaviour
Yes
> Please tell me what to do to debug this problem
> its (for now) the last (fatal) error I have on my NOMMU system
Some ideas which come to mind:
1. ENOENT on exec may be cause by file not having all required
libraries present. What "ldd /hdd/stage2/st508_rc2b" says?
Is /hdd/stage2/st508_rc2b a shared binary?
(For answer, try "file /hdd/stage2/st508_rc2b")
2. Replace /hdd/stage2/st508_rc2b with /hdd/stage2/pwd,
to match my test. Does it still fail?
3. Send me your .config
4. Build busybox with the same .config on x86 desktop and test -
does it still fails? (This is a good step in debugging in general,
because way more people will be able to build busybox
with your .config, try it on their systems, etc...).
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox