0

I am new to Linux, and trying to get a definitive understanding of the Linux boot processs, before attending a Linux Server Admin class starting in June.

Setting up the Question: During Linux boot, after the kernel and initramfs are loaded into memory... Then, the kernel decompresses in memory to /boot/, a RAM-based virtual file system via cpio, loads necessary modules among other things, and then....

The Kernel executes the /sbin/init program.

Question: Is the Kernel executing the "init" program from /sbin/init from the RAM-based virtual file system, OR... from the physical disk, since the / partition has already been mounted by the Kernel?

.... When does the Kernel stop using the RAM-based file system, and start using the physical / partition?

Thank you, Ingemar

2

The kernel relinquishes control from the moment it first executes an init process, be it from an initramfs or a “real” partition. It does not load modules by itself, and it most certainly doesn’t do “other things”. These are all userspace procedures.

An initramfs is typically used when mounting the root filesystem requires more than simply mounting a basic partition. After the initramfs’ init process/script is finished, it starts the init program from the root partition using exec(). This replaces the current init process. It is imperative the init program never terminate—this results in a kernel panic.

To put it simply: If an initramfs is used, its init program/script is always used.

  • Thank you so much! That makes perfect since. Your answer made me take a step back, and see it from another perspective "The init process itself", which remains the parent process to all other processes while the system is running. -Thanks again, that made it definitive! – iawikman May 4 '14 at 19:10
0

On my Kubuntu, init is being run from /sbin/init, which is the block device /dev/sda5 mounted at /

The command mount will tell you how your file systems are mounted. It is entirely possible that your init is being run from a ram-disk.

Also, ps -aux | grep init tells me:

root         1  0.0  0.0  27228  1644 ?        Ss   16:44   0:03 /sbin/init

where init is PID 1, being run at /sbin/init

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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