Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to debug an init script on a Linux system; I'm trying to pass init=/bin/sh to the kernel to make it start sh without starting init so I can run through the init sequence manually.

What I've found is that the kernel is starting init anyway. During bootup, one of the printk messages is the command line, and that is showing that the line is being set properly; in addition, I can affect other things using the kernel command line. I have checked to make sure the path exists; it does.

This is a busybox system, and init is a symlink to busybox; so to make sure busybox doesn't do strange magic when its PID is 1, I also tried running a non-busybox program as init; that didn't work, either. It seems that no matter what I do, init is run.

What could be causing this behavior?

share|improve this question
What is the base distro that is using busybox for init? They may simply be ignoring the command line... you may want to examine the initrd and see what the scripts are actually doing. – Aaron D. Marasco Jan 31 '12 at 2:17
It's not any distro - it's my own build; which is why I'm trying to debug the init scripts. – Shawn J. Goff Jan 31 '12 at 3:17
up vote 1 down vote accepted

Looking at Linux kernel source, I see that if the file /init exists, the kernel will always attempt to run it on the assumption that it's doing a ramdisk boot. Check your system to see if /init exists, if it does, then that's probably your problem.

share|improve this answer
Actually, it checks execute_command first, which comes from the kernel command line init= parameter. If it can't execute it, it prints a warning and tries to run init in various locations. This is in init/main.c in the function init_post(). I looked through the kernel printk messages and found the warning in my kernel's output, so now I have to figure out why it can't start /bin/sh or anything else that I try to start. – Shawn J. Goff Jan 31 '12 at 4:00
The code I looked at (v3.2.2 I think) checked set ramdisk_execute_command if it was unset and then tried to run it, so you must not be that current. Too bad, because I didn't see anything else that would explain it. – Kyle Jones Jan 31 '12 at 5:21
If this is true, man bootparms needs an update :-) – Ciro Santilli 巴拿馬文件 六四事件 法轮功 Oct 25 '15 at 20:47



I found:

When debugging a normal root filesystem, it's nice to be able to boot with "init=/bin/sh". The initramfs equivalent is "rdinit=/bin/sh", and it's just as useful.

So probably try ridinit=/bin/sh

share|improve this answer

Your Answer


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.