Live data from Hacker News

Takeover.sh – Wipe and reinstall a running Linux system via SSH without reboot

github.com

31–40 of 80 posts

Re: Takeover.sh – Wipe and reinstall a running Linux system via SSH without reboot

#31
post #5
post #4

Pretty cool, although I'm pretty sure I would never use something like this. What has saved my skin on a number of occasions is the ability to boot remote servers into rescue mode and chroot into the broken system. That way you can use package managers, all your diagnostic tools, and everything else the boot image doesn't provide. Basically you just mount the different partitions and then chroot just swaps /proc /sys…

I like the term rocket surgery, I will steal it from you for sure.

But it's not exactly brain science, now is it?

Re: Takeover.sh – Wipe and reinstall a running Linux system via SSH without reboot

#32
For anyone interested in adding this to their toolkit, I would suggest reading this StackOverflow answer: http://unix.stackexchange.com/a/227318/189858

In short, the answer details how to switch your running system to use an in-memory only root filesystem, without restarting. This allows installing a new OS, resizing the OS disks, etc.

It's a risky operation, but the linked answer covers many pitfalls that you might run into - I recently used it to shrink the root partition on a remote server, very much appreciated the detail.

Re: Takeover.sh – Wipe and reinstall a running Linux system via SSH without reboot

#33

This is conceptually similar to the chroot installation method, which has been a documented, if not entirely standard, method on Debian for quite some time. https://www.debian.org/releases/stable/amd64/apds03.html.en https://wiki.debian.org/chroot

It's also a common installation method for the more "advanced" distros. The "SAG Trifecta" (Slackware/Arch/Gentoo) uses a lot of chrooting in its installation procedures.

What's interesting about takeover.sh, though, is that it goes a step further and causes the chrooted system to actually replace an existing OS without a reboot and (theoretically) without involving additional boot media.

Re: Takeover.sh – Wipe and reinstall a running Linux system via SSH without reboot

#35
post #29

Earlier quoted context omitted.

Something like this has been my default way of installing Linux for years - and I've installed Debian, Ubuntu (with debootstrap), Gentoo and Arch this way. Typically I just create another partition to my LVM volume group, chroot and install over there and then reboot without removing the old OS install and I run the install procedure from the old OS (instead of booting from a Live CD / usb stick). I do this because I…

You really only need two (kernel and initrd/initramfs), at least to get into a basic running state. This requires building your own initrd, of course, but it's pretty common in non-graphical Linux installers (Slackware's install media still does this, IIRC). I think it's even possible to embed the initrd in the kernel binary itself, but I've never really investigated that.

You can ditch the initrd if you compile in the kernel the drivers you need to boot the system, as a minimal example SATA/SCSI, EXT4/JFS, that usually are compiled as kernel modules.

Re: Takeover.sh – Wipe and reinstall a running Linux system via SSH without reboot

#38
post #4

Pretty cool, although I'm pretty sure I would never use something like this. What has saved my skin on a number of occasions is the ability to boot remote servers into rescue mode and chroot into the broken system. That way you can use package managers, all your diagnostic tools, and everything else the boot image doesn't provide. Basically you just mount the different partitions and then chroot just swaps /proc /sys…

This is one of those things you want to have practiced before it's critical.

Re: Takeover.sh – Wipe and reinstall a running Linux system via SSH without reboot

#39

Earlier quoted context omitted.

You really only need two (kernel and initrd/initramfs), at least to get into a basic running state. This requires building your own initrd, of course, but it's pretty common in non-graphical Linux installers (Slackware's install media still does this, IIRC). I think it's even possible to embed the initrd in the kernel binary itself, but I've never really investigated that.

You can ditch the initrd if you compile in the kernel the drivers you need to boot the system, as a minimal example SATA/SCSI, EXT4/JFS, that usually are compiled as kernel modules.

How most sane distros do it.

Build a kernel with the most common hardware built into it, and use that to bootstrap. No need for messy things like balled up temporary rootfs in a ram drive.

Initrd/initramfs have become an excuse for piling on complexities that frankly should be added by the sysadmin after initial install.

Re: Takeover.sh – Wipe and reinstall a running Linux system via SSH without reboot

#40
post #22

removed. No delete on HN comments? interesting

You can delete comments but only up until a certain amount of time has passed, I think. I've been able to do it.

I believe once someone replies you can no longer delete it. And you can edit for up to 2 hours after you've made the comment.
Post reply on HN