explaingit

marcan/takeover.sh

7,327ShellAudience · ops devopsComplexity · 5/5Setup · hard

TLDR

A shell script that completely replaces a running Linux server's operating system over SSH, with no reboot and no physical access, by loading a rescue environment into RAM and freeing the disk for reformatting.

Mindmap

mindmap
  root((repo))
    What it does
      Replace Linux OS
      Over SSH only
      No reboot
    How it works
      RAM rescue env
      Disk unmounted
      Reinstall OS
    Requirements
      BusyBox static
      fakeinit binary
      RAM space
    Risk
      Danger warning
      Test first
      No undo step
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Replace a remote server's operating system with a different Linux distribution without visiting the data center, rebooting, or inserting a USB drive

USE CASE 2

Reformat and repartition a server's disk entirely while keeping it reachable over SSH via an in-memory rescue environment

Tech stack

ShellLinuxBusyBox

Getting it running

Difficulty · hard Time to first run · 1day+

Requires a statically linked BusyBox binary, a compiled fakeinit helper, and a rescue image small enough to fit in the server's available RAM, failure risks crashing the server permanently.

In plain English

takeover.sh is a shell script that lets a Linux administrator completely replace a running server's operating system over a remote SSH connection, without rebooting or touching a physical keyboard. It targets situations where you have remote access to a machine but no way to insert a USB drive or visit the data center. The process works by loading a rescue environment (a minimal Linux system) entirely into the server's memory. The script then transfers the running system's core process over to the in-memory version, freeing up the original disk. Once the original disk is unmounted, you can repartition it, reformat it, and install a completely different Linux distribution, all while the server stays reachable over SSH. The README is direct about the danger: if anything goes wrong during the takeover, the server will very likely crash and require physical access to recover. The author explicitly says not to use the script on any machine you care about and strongly recommends testing in a virtual machine first. There is no undo step, no safe exit back to the original system, and the README deliberately withholds copy-paste instructions because it is written only for people who already understand exactly what each step does. The script supports Linux systems using sysvinit or systemd as their process manager. Running it requires a statically linked copy of busybox (a compact set of Unix utilities), a compiled helper program called fakeinit, and a rescue environment small enough to fit in the server's available RAM.

Copy-paste prompts

Prompt 1
I need to reinstall a remote Linux server from scratch over SSH using takeover.sh. Walk me through the prerequisites I need, statically linked busybox, fakeinit, and a rescue image, and what each step of the script does before I run it.
Prompt 2
I want to test takeover.sh safely before using it on a real server. Show me how to set up a virtual machine and simulate the full OS replacement process so I understand what happens if something goes wrong.
Prompt 3
After running takeover.sh and booting into the in-memory rescue environment, what are the exact commands to unmount the original disk, reformat it, and begin a fresh Linux installation?
Open on GitHub → Explain another repo

← marcan on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.