Simple init replacement to start the console

On a very simple PC, I want to replace Ubuntu 12.04 / sbin / init with the simplest bash script in order to have the minimum number of running processes. Obviously there is no X, no USB, no new hardware detection, no update, no apt, "nothing", I just need a working console with a Wi-Fi IP address based on DHCP (ssid, passphrase are already stored in / etc / network / interfaces). All this. Currently, I tried this instead 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 

It works when I get the IP address, and I can enter it, but:

  • A) When starting shutdown, I get "shutdown: Unable to shutdown system:"
  • B) control-c does not work in console
  • C) After logging in, I get: "bash: cannot set the terminal process group (-1): inappropriate ioctl for the device"
  • D) After logging in, I get: "bash: no job control in this shell"

In addition, I noticed that all user space processes have a "?" in the tty column when running ps avx. How can I fix these problems? I do not want to use the upstart to really control what is running on the PC and have a minimum minimum.

+4
source share
2 answers

I ended up using Busybox init. Great tiny init ...

0
source

You can use runlevels and based on your question runlevel 3 is what you want to use.

If you have some services that you do not want to run, you can also disable them for this run level.

To boot into runlevel 3 simply add the boot argument to the kernel in the bootloader:

 <EXISTING_BOOT_CMD> 3 

If your distribution uses systemd instead of sysvinit , they are called targets instead. The runlevel 3 equivalent in systemd usually called multi-user.target

The kernel boot argument that you need to pass in this case is systemd.unit=multi-user.target

 <EXISTING_BOOT_CMD> systemd.unit=multi-user.target 

Alternative if you do not want to touch the bootloader:

 systemctl enable multi-user.target 
0
source

All Articles