init.c problem

Pavel Samek psamek at redash.cz
Wed Mar 12 16:43:31 UTC 2008


Hi!

I have the following problem.
Situation:
- etherboot loads kernel
- kernel has IP auto configuration enabled (ip=dhcp),
   no initrd
- rootfs is on nfs, succesfuly mounted
- now busybox's init should start, but it writes:

init: can't open /dev/null: no such file or directory

- start-udev is started from init script (but this is not called due to 
that error) so there cannot be /dev/null before

I have found that the busybox 1.6.1 was the last version where 
everything  went ok. Then after the following patch [1]

--- busybox-1.6.1/init/init.c	Sat Jun 30 16:06:46 2007
+++ busybox-1.6.1-init/init/init.c	Thu Jul  5 01:16:26 2007
@@ -277,6 +277,9 @@
  			while (fd > 2) close(fd--);
  		}
  		messageD(L_LOG, "console='%s'", s);
+	} else {
+		/* Make sure fd 0,1,2 are not closed */
+		bb_sanitize_stdio();
  	}

  	s = getenv("TERM");

the version 1.7.0 does not work for me.

If I apply the following patch to the latest version 1.9.1, it works again:

--- busybox-1.9.1.orig/init/init.c	2008-02-12 17:03:12.000000000 +0100
+++ busybox-1.9.1/init/init.c	2008-03-12 12:19:24.000000000 +0100
@@ -224,9 +224,6 @@
  			while (fd > 2) close(fd--);
  		}
  		messageD(L_LOG, "console='%s'", s);
-	} else {
-		/* Make sure fd 0,1,2 are not closed */
-		bb_sanitize_stdio();
  	}

  	s = getenv("TERM");


[1]  http://busybox.net/downloads/fixes-1.6.1/busybox-1.6.1-init.patch




More information about the busybox mailing list