During booting, when the Linux kernel loads an initramfs file, which command from the initramfs will be executed first, if present?

A. /init
B. /initrd
C. /linuxrc
D. /rc.local
E. /sbin/init

題解

當 Linux 核心載入 initramfs 之後,會先檢查裡面有沒有「/init」這個檔案,有的話就會直接執行它,把它當作第一個使用者行程。如果沒有「/init」的話,核心才會去掛載真正的根檔案系統,並用以下的優先順序來尋找並執行使用者行程。

  • /sbin/init
  • /etc/init
  • /bin/init
  • /bin/sh

所以答案是選項「A」。