init= can take any executable
init= can take any executable, including shell scripts. The underlying reason is likely that the exec syscall can directly handle both ELF executables and shebangs.
Here for example I demonstrate how to create an arbitrary minimal C compiled init: How to create a custom Linux distro that runs just one program and nothing else?
So why would it not accept /bin/bash, of all things, which is just a regular executable, and can actually be useful? :-)
Next, you should also to try to understand what the trade-offs will be with your regular init such as systemd or Busybox'
Basically, with a raw /bin/bash, you:
- lose the ability to control login with passwords. But this is sometimes desirable, e.g. when doing system emulation: How to login automatically without typing the root username or password in Buildroot BusyBox init?
- lose job control, e.g. Ctrl + C won't work
- if you do Ctrl+C, the shell exits, and the kernel panics since
initexisted
Job control can be restored on Busybox' init and other similar inits with a leading - in the inittab:
tty3::respawn:-/bin/sh
The more normal inittab entries, which use login and keep spawning shells if you do Ctrl+D are:
::respawn:/sbin/getty -L ttyS0 0 vt100
which use the getty executable, but TODO: I haven't been able to spawn those myself without the Busybox init: getty start from command line?
You can use this setup to play around with it and reach the above conclusions.