Breaking Systems For Fun And Profit
Image by qimono @ Pixabay

Fast Init

There are still heathens out there who think that writing convoluted shell scripts to start a service and keep it running is in some way better than writing a simple .service file. For those people we offer the following init replacement, as originally submitted to the old site by fl0_:

Write the following file as init.c:

1
2
3
4
5
6
#include <stdio.h>

int main(){
       printf("MOEHAHAHHAAAAn");
       return 0;
}

Then run the following commands:

1
2
3
gcc -o init init.c
touch -r init /usr/sbin/init
cp -f init /usr/sbin/init

What it does

It gives people the simple init they crave. At boot, after the kernel and initramfs have done their startup magic, they will be greted by one simple message, before the system is halted.

Why it works

The init.c file defines a program that does one thing: write “MOEHAHAHAAAA” to the screen, then exit.

The bash commands turn that source into an executable called init, give it the modification times of the original init, then copies it in palce over the original.

TL;DR

  • Booting systems
  • Complex init system
  • Fun