:: Re: [Dng] Boot sequence: was vdev s…
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Laurent Bercot
Datum:  
To: dng
Betreff: Re: [Dng] Boot sequence: was vdev status update
On 19/04/2015 01:06, Isaac Dunham wrote:
> I'm not sure exactly what the priority is, but the kernel searches
> /sbin/init, /init, and /linuxrc at least.


  From the kernel source (init/main.c):
         if (!try_to_run_init_process("/sbin/init") ||
             !try_to_run_init_process("/etc/init") ||
             !try_to_run_init_process("/bin/init") ||
             !try_to_run_init_process("/bin/sh"))
                 return 0;


with /init being executed prior to any of those lines if it exists.


> I've seen a reference to a kernel option that changes the "init" on the
> initramfs recently on this list; I'm not positive what it is, but it may
> be rdinit.


According to the same kernel file: yes, rdinit :)


> As far as I know, if the initramfs init program completes, the kernel
> panics.
> It needs to mount the new / on a mountpoint (traditionally /mnt), move
> /dev to /mnt/dev if using a dynamic /dev, change the root (pivot_root()
> is the typical syscall, usually used via switch_root or pivot_root
> commands), and exec the new init.


It makes absolutely no difference to the kernel whether init is run from
an initramfs or not. The init process that the kernel runs is pid 1 and the
kernel stops caring what happens at that point - except it doesn't like it
if pid 1 dies. From there on, finalizing the initialization is the job of
userspace; most people will indeed want to pivot_root, but some systems are
happy running with the initramfs as the root filesystem for the whole machine
lifetime.

--
Laurent