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

Whenever I enter into initrd prompt, I know that not every command is executed in that prompt. Can somebody tell me how I can add more commands support in that initrd prompt. It would be nice if you can provide with me some reference materials.

share|improve this question

closed as not a real question by Gilles, Renan, Ulrich Dangel, jasonwryan, Stéphane Gimenez Sep 15 '12 at 16:11

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

What do you mean by initrd prompt? When I think initrd I think the initial compressed ramdisk used during boot. Are you talking about the prompt from the bootloader? The thing that lets you pick which kernel? Or are you talking about something to build initrd images? Or something else? – pileofrogs Jul 17 '12 at 19:36
sometimes the control gets struck into initrd when it is unable to load the kernel..at that time some commands still work but not all. – pradeepchhetri Jul 17 '12 at 19:48
This depends heavily on your distribution and the framework used to generate your initramfs. And your kernel was loaded otherwise you wouldn't get an prompt within the initramfs. The problem is your initramfs couldn't load/find/open your root device. – Ulrich Dangel Jul 17 '12 at 19:59
How to add commands to run in the initrd/initramfs depends on your distribution (or on how you've set up your boot process, if you customized that part). Tell us what distribution you're running. What to add depends on what the error is: copy the error messages carefully. – Gilles Jul 18 '12 at 0:01
I am running Ubuntu 12.04 64 bit Desktop edition. – pradeepchhetri Jul 18 '12 at 10:00

This is a little bit related to my question here. In the process of finding the source of the problem I tried to understand what is being done within the initrd. My guess is that you are talking about nash - but I was not able to find much about it.

share|improve this answer

On Ubuntu all initramfs scripts are stored in /usr/share/initramfs-tools/. You might just add a hook or modify the init script in ramdisk, which is /usr/share/initramfs-tools/init, and add your command.

Notice that your root fs might not get mounted then. Make sure you understand all this before modify it.

After that, re-generate ramdisk with update-initramfs -u

share|improve this answer

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