Skip to content

Instantly share code, notes, and snippets.

@fbriere
Created September 23, 2014 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fbriere/db827896e3fa2e1b42d4 to your computer and use it in GitHub Desktop.
Save fbriere/db827896e3fa2e1b42d4 to your computer and use it in GitHub Desktop.
Simple init process to start basic services and get a root shell with job control
#!/bin/sh
#
# Simple /sbin/init replacement that runs all runlevel S scripts, then drops
# into a root shell, in an infinite loop.
#
# Using this script as "init=" is similar to using the "single" boot parameter,
# but doesn't require a password, and logging out won't resume booting. And
# unlike "init=/bin/sh", this provides job control and runs the basic scripts.
/etc/init.d/rc S
while true; do
setsid sh -c 'exec login -f root </dev/tty1 >/dev/tty1 2>&1'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment