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 /dev of the rescue image with the real ones, and BAM you're back in business.
I know that for many of you this isn't rocket surgery, but for those who don't know you have to google for "chroot" when you boot into a rescue image and discover you can't do anything, you might just remember this post.
I work at an IT Helpdesk and we build a custom GRML image which we write to our pen drives. We use it, for example, to quickly live boot Debian/Ubuntu PC's and run a script that mounts all necessary file systems (including pseudo file systems). This makes it really easy to quickly chroot into a broken system right at a users desk.
On our Linux installations we have separated most of the directories into different LVM partitions. Such as '/home', '/usr', '/var' and of course '/' (the root).
Just last week I helped a user live boot his system and ran a fsck on his '/home' partition. We had "frozen" the system and hard reset his computer which led to a couple of corrupt blocks and inodes.
I recommend to copy a rescue disk iso image or/and network installation image to boot partition and add it to GRUB menu. This way it is possible to boot into working environment without risk to damage root partition.
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.
I've been using this procedure to remotely replace operating systems for years. The most common scenario is a VPS provider that doesn't give you the choice of OS you want.
Infact, I will be using it later today, to replace a Debian system with Gentoo, no less. The README in OPs link is spot-on here (the last few paragraphs).
Another nice trick of this family (with reboots, or without with using systemd-nspawn) lies with clever btrfs usage. Long story short:
* use btrfs, and create your main root filesystem as a btrfs partition subvolume and another btrfs subvolume for snapshots (also a sub of master btrfs partition)
* to start any experiment (e.g. installing whole gnome and 500 different packages you MIGHT WANT TO REVERT in the future) create before the risky operation snapshot (btrfs subvolume snapshot / /.snapshots/yournameofsnap) of current filesystem
* experiment in any way :)
* switch between old root (snapshot you created) or the new one with (btrfs subvoulme set-default)
* delete any of them (btrfs subvolume delete)
btrfs copy-on-write allows all of these commands to happen instantly without (almost) any actual copying. Also booting from both volumes is possible without any additional steps as long as master btrfs partition is the one to be booted from UEFI.
This sounds similar to the more cleverly named FreeBSD Depenguinator project which could be written over top of a remote Linux server replacing it with FreeBSD, without console.
If you have remote console access, a similar thing can be done for OpenBSD by dd(1)'ing a miniroot ramdisk install image.
Seeing if I understand what this is doing: this keeps running the same Linux kernel and kernel modules, but swaps out absolutely everything else up to and including the init system - is that right?
More precisely, what it does is start a new init system on a pseudofilesystem, starts an sshd chrooted to that new system, and lets you then login there, where you can then, if you want, umount the original root fs, wipe it, install a new os, then reboot the system.
Another trick to do that is to use the VPS's rescue mode, download qemu, and start it with the remote desktop / VNC console. Then, do the install from there. Poor man's IPMI.
Somebody correct if I am wrong, but this script somehow allows the session to live in the RAM. Once the OS is running directly from the RAM, the hard drive can be wiped and a new OS can be installed. The system is then booted to run off of the hard drive.
I feel like this is, on one hand, an amazing thing to be able to do because it removes the necessity to have IPMI to remotely re-install a system.
On the other hand, this seems like it would be an incredibly easy thing to screw up and potentially leave yourself with a corrupted or unbootable system.
Which is fundamentally how an installer works already.
Look up the chroot-install method for Debian/Ubuntu, as an example of this in a user-accessible manner. The process uses debootstrap, but as I understand was originally developed via a chroot shell on a running system and either partition or ramdisk-based bootstrapping of a new system.
This scripts creates another root, then substitutes /sbin/init using `mount --bind`, then reloads /sbin/init, which pivots into new root with fakeinit.
IMHO, systemd in container mode can be used instead of fakeinit.
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.
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.
[+] [-] gizmo|9 years ago|reply
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 /dev of the rescue image with the real ones, and BAM you're back in business.
For details see threads like: http://superuser.com/questions/111152/whats-the-proper-way-t...
I know that for many of you this isn't rocket surgery, but for those who don't know you have to google for "chroot" when you boot into a rescue image and discover you can't do anything, you might just remember this post.
[+] [-] shocks|9 years ago|reply
[+] [-] smudgymcscmudge|9 years ago|reply
[+] [-] rijoja|9 years ago|reply
[+] [-] HeadlessChild|9 years ago|reply
On our Linux installations we have separated most of the directories into different LVM partitions. Such as '/home', '/usr', '/var' and of course '/' (the root). Just last week I helped a user live boot his system and ran a fsck on his '/home' partition. We had "frozen" the system and hard reset his computer which led to a couple of corrupt blocks and inodes.
[+] [-] lisivka|9 years ago|reply
https://wiki.archlinux.org/index.php/Multiboot_USB_drive
[+] [-] tr1ck5t3r|9 years ago|reply
[deleted]
[+] [-] predakanga|9 years ago|reply
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.
[+] [-] aaronmdjones|9 years ago|reply
Infact, I will be using it later today, to replace a Debian system with Gentoo, no less. The README in OPs link is spot-on here (the last few paragraphs).
[+] [-] drvdevd|9 years ago|reply
[+] [-] rdslw|9 years ago|reply
* use btrfs, and create your main root filesystem as a btrfs partition subvolume and another btrfs subvolume for snapshots (also a sub of master btrfs partition)
* to start any experiment (e.g. installing whole gnome and 500 different packages you MIGHT WANT TO REVERT in the future) create before the risky operation snapshot (btrfs subvolume snapshot / /.snapshots/yournameofsnap) of current filesystem
* experiment in any way :)
* switch between old root (snapshot you created) or the new one with (btrfs subvoulme set-default)
* delete any of them (btrfs subvolume delete)
btrfs copy-on-write allows all of these commands to happen instantly without (almost) any actual copying. Also booting from both volumes is possible without any additional steps as long as master btrfs partition is the one to be booted from UEFI.
https://wiki.archlinux.org/index.php/Btrfs
[+] [-] floatboth|9 years ago|reply
[+] [-] notaplumber|9 years ago|reply
If you have remote console access, a similar thing can be done for OpenBSD by dd(1)'ing a miniroot ramdisk install image.
[+] [-] camtarn|9 years ago|reply
[+] [-] efficax|9 years ago|reply
[+] [-] simon1573|9 years ago|reply
[+] [-] tyingq|9 years ago|reply
[+] [-] tomsmeding|9 years ago|reply
[+] [-] ce4|9 years ago|reply
https://wiki.debian.org/DebianTakeover
[+] [-] zimbatm|9 years ago|reply
[+] [-] Aissen|9 years ago|reply
Edit: it doesn't really do the same thing. vps2arch could be implemented on top of takeover.sh for better reliability.
[+] [-] nashashmi|9 years ago|reply
[+] [-] VoidWhisperer|9 years ago|reply
On the other hand, this seems like it would be an incredibly easy thing to screw up and potentially leave yourself with a corrupted or unbootable system.
[+] [-] dredmorbius|9 years ago|reply
Look up the chroot-install method for Debian/Ubuntu, as an example of this in a user-accessible manner. The process uses debootstrap, but as I understand was originally developed via a chroot shell on a running system and either partition or ramdisk-based bootstrapping of a new system.
[+] [-] lisivka|9 years ago|reply
IMHO, systemd in container mode can be used instead of fakeinit.
[+] [-] dredmorbius|9 years ago|reply
https://www.debian.org/releases/stable/amd64/apds03.html.en
https://wiki.debian.org/chroot
[+] [-] yellowapple|9 years ago|reply
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.
[+] [-] geoffmcc|9 years ago|reply
[+] [-] pipo098|9 years ago|reply
[+] [-] NGTmeaty|9 years ago|reply
[+] [-] technologyvault|9 years ago|reply
[+] [-] unknown|9 years ago|reply
[deleted]
[+] [-] unknown|9 years ago|reply
[deleted]
[+] [-] Odiee|9 years ago|reply
[deleted]
[+] [-] dpweb|9 years ago|reply
[+] [-] bjacobel|9 years ago|reply
[+] [-] rocky1138|9 years ago|reply
[+] [-] andruby|9 years ago|reply