CD stops after 'Starting init...'

Some One lumen at
Thu Jan 19 18:57:17 PST 2006


When I try to run the LFS LiveCD 6.1.1-3, the CD stops running after
"Starting init...".  I can type in the console, but nothing else is
executed by the system.  My computer is an IBM Aptiva E Series 175
with 88 MB RAM and an AMD K6-2 processor.

I think this is due to an improper call to the execve() function in
the main() function of init.c.  The second argument is an array, and
the first element of the array should be a string that refers to the
program being called.  I think the code needs to be changed as follows:

This line should be added near the top of the main() function where
all the other variable declarations are:
        char **cmd = malloc( sizeof(char *) * (argc+1) );

I think these lines should replace the current call to the execve()
function, which is at the end of the main() function:

        cmd[0] = malloc( sizeof(char) * 11);
        cmd[0] = strncpy(cmd[0], "/sbin/init", 11);

        for (i=1; i <= argc; i++) {
                cmd[i] = argv[i];
        i = execve(cmd[0], cmd, envp);

Also, ensure that the file init.h has a line that says:
        #include <stdlib.h>

I couldn't get to the files from the svn repository at the time of this e-mail.
The rest of this will be an explanation of how I came to those conclusions.
Luckily, Knoppix 3.9 worked on the system, so I did some testing.
I made a unit test to test the execve call, which returned unsuccessfully when
the array wasn't properly set.  Then, I tried to solve the problem by altering
the argv array, but there was an error/warning about argv being read-only, so I
decided that copying the latter parts of the array was probably the way to go.
Also, could you take out the code that checks the return value of the execve()
call?  The execve on this system returned 255 on failure, so no error was reported.
Just keep the printf line that is inside the if statement, so that if there is
some reason this fix doesn't work, at least I would be able to see an error


This email was brought to you by Kaxy Mail

More information about the livecd mailing list