Simple replacement of init to just start console

gre*_*til 5 linux ubuntu init

On a very simple PC, I want to replace Ubuntu 12.04 /sbin/init by the most simple bash script in order to have the very minimum number of running processes. Obviously, no X, no USB, no detection of new hardware, no upgrade, no apt, "nothing", I just need a working console with a DHCP-based Wi-Fi IP address (ssid, passphrase are already stored in /etc/network/interfaces). That's all. Currently, I have tried this in replacement of /sbin/init:

#!/bin/sh
mount -o rw,remount /
mount -t proc none /proc
udevd --daemon
mkdir /run/network
ifup -a &
while [ 1 ]; do
    /sbin/getty -8 115200 tty1 vt100
done
Run Code Online (Sandbox Code Playgroud)

It's working as I'm getting an IP address and I can login but:

  • A) While running shutdown, I get "shutdown: Unable to shutdown system:"
  • B) control-c is not working in the console
  • C) After a login, I get: "bash: cannot set terminal process group (-1): Inappropriate ioctl for device"
  • D) After a login, I get: "bash: no job control in this shell"

Also, I have noticed that all the user-space processes have a "?" in the tty column when running ps avx. How can I fix those problems? I don't want to use upstart in order to really control what is started on the PC and have the very bare minimum.

gre*_*til 1

我最终使用了 Busybox init。伟大的小初始化...