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」。