There's an init script in the initial ramdisk during the bootint process. At the last operation, it says that:

# Chain to real filesystem
exec run-init ${rootmnt} ${init} "$@" ${recovery:+--startup-event=recovery} <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1
panic "Could not execute run-init."

I search all scripts in ramdisk content, and can't find any file name or function name like that.What is the run-init actually?

  • see this: – Mostafa Ahangarha Mar 11 '16 at 12:40
  • I visit that link already. But it says that script(I guess) is in SELinux, I can't find it in Ubuntu. Where is it? Or it doesn't existed in Ubuntu? – naive231 Mar 13 '16 at 4:39
  • for me it is in /usr/lib/klibc/bin/run-init. use locate run-init to find it in your system. – Mostafa Ahangarha Mar 13 '16 at 7:19
  • OK, I found it,too. But panic is next line after the exec run-init..., is that mean the flow or control right will migrated to ${rootmnt}? If not so, we'll going to crash by next panic? – naive231 Mar 14 '16 at 11:24
up vote 4 down vote accepted

run-init is a binary executable, it lives in /usr/lib/klibc/bin/run-init and in your initramfs and is provided by the klibc-utils package in Ubuntu. It isn't a script, so you cannot take a look inside directly, you can check out its source code via running apt source klibc-utils or browsing the upstream repository at

So the main function is in run-init.c , but it's just a wrapper for run_init function, which lives here in runinitlib.c

run_init does a lot of work:

  1. It jumps into the new root file system
  2. Checks that this is the new root file system
  3. Checks if it on initramfs
  4. Cleans all directory (why waste the RAM?)
  5. Mounts the new root file system
  6. and runs init in the new root file system

I believe, it would be very complicated to do all this work by a script, because of dependencies, but binary executable file can do it very ease.

According to dpkg-query it's part of the klibc-utils package. Some digging in the source code shows a call to execv to start the init process on the real filesystem. If that fails, run-init will return, thus triggering the panic on the last line.

Ubuntu 14.04LTS In empty folder create file []


cp /boot/initrd* initrd.cpio.gz
mkdir initrd
cd initrd
zcat ../initrd.cpio.gz | cpio -di
find | grep run-init
cd ..

and run it: bash

file run-init will be in ./bin/run-init

Also you can get initrd from installation cd

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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