SUSE-Linux-Enterprise 启动提示“Failed to switch root”

环境

  • OS: SUSE Linux Enterprise 12 SP3
  • Kernel:4.4.180-94.97

起因

一台Azure的云主机,重启系统,便无法启动,卡在以下画面。

排查

查看报告文件:

cat /run/initramfs/rdsosreport.txt
...<省略>...
[    6.519443] linux systemd[1]: Stopped Create list of required static device nodes for the current kernel.
[    6.519759] linux systemd[1]: Closed udev Kernel Socket.
[    6.520033] linux systemd[1]: Closed udev Control Socket.
[    6.520329] linux systemd[1]: Starting Cleanup udevd DB...
[    6.520986] linux systemd[1]: Started Cleaning Up and Shutting Down Daemons.
[    6.523234] linux systemd[1]: Started Cleanup udevd DB.
[    6.523418] linux systemd[1]: Reached target Switch Root.
[    6.524015] linux systemd[1]: Starting Switch Root...
[    6.528234] linux systemctl[393]: Failed to switch root: Specified switch root path /sysroot does not seem to be an OS tree. os-release file is missing.
[    6.528881] linux systemd[1]: initrd-switch-root.service: Main process exited, code=exited, status=1/FAILURE
[    6.529239] linux systemd[1]: Failed to start Switch Root.
[    6.546105] linux systemd[1]: Startup finished in 5.805s (kernel) + 0 (initrd) + 740ms (userspace) = 6.545s.
[    6.546309] linux systemd[1]: initrd-switch-root.service: Unit entered failed state.
[    6.546517] linux systemd[1]: initrd-switch-root.service: Triggering OnFailure= dependencies.
[    6.546730] linux systemd[1]: initrd-switch-root.service: Failed with result 'exit-code'.
[    6.546958] linux systemd[1]: Starting Setup Virtual Console...
[    6.549826] linux systemd[1]: Started Setup Virtual Console.
[    6.550428] linux systemd[1]: Starting Emergency Shell...

经过一系列的排查(分区、重建initramfs)皆无果,再回望系统错误提示信息"os-release file is missing",查看/etc/目录下,果然不存在该文件。
于是从其它系统复制该文件。重新启动系统,正常加载。

原因

经过沟通原来是安全同事通过HDIS报告要求要将**/etc/os-release** 这个文件进行删除或者移走--美其名曰这个文件会暴露系统的版本。WTF,幼稚,愚蠢,沙雕。

最后可以确定的是 SUSE Linux Enterprise 12 SP3 启动时会检测/etc/os-release这个文件。