Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple replacement of init to just start console

Tags:

linux

init

ubuntu

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

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.

like image 848
gregoiregentil Avatar asked Mar 07 '13 17:03

gregoiregentil


People also ask

Are there any alternatives of init?

The init daemon is going to be replaced with daemon systemd on some of the Linux Distributions, while a lot of them have already implemented it. This is/will be creating a huge gap between traditional Unix/Linux Guard and New Linux Guard – programmers and System Admins.

Is systemd same as init?

Init and Systemd are both init daemons but it is better to use the latter since it is commonly used in recent Linux Distros. Init uses service whereas Systemd uses systemctl to manage Linux services.

What is sysvinit in Linux?

sysvinit is a collection of System V-style init programs originally written by Miquel van Smoorenburg. They include init, which is run by the kernel as process 1, and is the parent of all other processes.

What is init daemon in Linux?

Init is a daemon process that continues running until the system is shut down. It is the direct or indirect ancestor of all other processes and automatically adopts all orphaned processes. Init is started by the kernel during the booting process; a kernel panic will occur if the kernel is unable to start it.


1 Answers

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

like image 131
gregoiregentil Avatar answered Oct 02 '22 18:10

gregoiregentil