Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
31
rated 0 times [  31] [ 0]  / answers: 1 / hits: 4217  / 2 Years ago, fri, august 19, 2022, 12:40:16

Just a theoretical question...



But what would happen if init (in /sbin/init) would be removed?


More From » kernel

 Answers
3

The boot loader will load the kernel, the kernel would attempt to run init, not find it and panic.



The way out of it is to reboot, edit the boot parameters, add init=/bin/bash and boot that way. The kernel will use bash as init. This will give you a chance to run commands and fix the system.



Correction

Apparently the kernel (file init/main.c) does:



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;

panic("No working init found. Try passing init= option to kernel. "
"See Linux Documentation/init.txt for guidance.");


So it would find /bin/sh (which is a link to dash) and that will give you a shell and a chance to fix it without using the init=/bin/bash boot parameter.


[#24858] Friday, August 19, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ingssex

Total Points: 21
Total Questions: 122
Total Answers: 98

Location: Sweden
Member since Fri, Mar 26, 2021
3 Years ago
ingssex questions
;