Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am working on a light version of linux for no particular reason other than to see how small I could make it. I was wondering if INIT was necessary, or if I could perform all of the INIT-related tasks (fsck, unmounting, etc) by hand/bash scripts?

I do not need multi-user functionality (Or much of anything for that matter). I started off with a Gentoo base 2.0.2 Install with kernel 2.6.38.

share|improve this question

2 Answers 2

up vote 4 down vote accepted

No, not really. You can start the kernel with the parameters init=/bin/bash for a very minimal system.

share|improve this answer
    
Very useful functionality, especially when running a UserMode kernel. –  new123456 Jul 30 '11 at 15:00
    
That worked great. I am not sure why I didn't think of it before. Thanks a lot! –  berk98 Jul 30 '11 at 19:54

First of all, you should distinguish two things: the program called init and an init process that linux runs after loading and doing basic startup - which is also called init by the kernel.

The first one is a program, just as any other, who's task is to initiate system startup by running various other programs and control their closing. The most popular program like that is sysvinit. This is the most popular implementation of a "parent of all processes", found on a majority of standard linux distributions and typically exists as /sbin/init.

The second is just a command that linux kernel knows and runs automatically at boot. So you can tell the kernel to run any other program in place of init. For example, a popular approach for doing system recovery is to tell linux to run /bin/bash or an applet of /sbin/busybox (see comments below). That can be done by supplying the name of the program as boot parameter (like init=/bin/bash).

Note that when the init process exits, the system is halted becomes practically unusable.

Apart from bash and busybox, there are several init replacements out there that can do more or less what init does. You might want to have a look at minit, runit, cinit, jinit, upstart or initng. But if you aim an absolutely minimal solution with no startup parallelism or advanced features, busybox can be the best choice.

share|improve this answer
    
You can use init=/bin/bash directly, but you'll need something like init=/sbin/busybox ash to get a shell. Or from bash you can run /sbin/busybox <applet>. While I can see the benefit of having busybox available, I don't know if booting directly to it has any benefit over bash, Anyways, I mainly wanted to point out that you need to add ash to get a busybox shell. Without it, busybox just outputs it's applet list and causes a kernel panic... at least on CentOS 5.6, where I tested it. –  Joe Internet Jul 31 '11 at 4:08
    
@Joe Ah, yes - definitely right. You should either run busybox with an applet name or have symlinks to those (some installs provide them by dafault, from what I recall). –  jankes Aug 2 '11 at 7:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.