7 ms·
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 serv
by gizmo 10y ago
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.
For details see threads like:
http://superuser.com/questions/111152/whats-the-proper-way-to-prepare-chroot-to-recover-a-broken-linux-installation 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.
- rijoja 10y agoI like the term rocket surgery, I will steal it from you for sure.
- gizmo 10y agoIf I'm not mistaken, credit goes to Chris Rock (who is not me).
- jonathonf 10y agoPretty sure the conflation has been around ever since rocket science and brain surgery have been used as a comparison. :)
- AnkhMorporkian 10y agoI don't tend to link youtube videos on HN, particularly of the comedic type, but I'm just going to leave this here for anyone who wants a good laugh for their morning. https://www.youtube.com/watch?v=THNPmhBl-8I https://www.youtube.com/watch?v=THNPmhBl-8I
- yellowapple 10y agoBut it's not exactly brain science, now is it?
- shocks 10y agoHaha yes, this is the default install procedure for Gentoo! :D
- hashhar 10y agoArch also does it. The first time I encountered this was when I accidentally deleted my EFI partition and was unable to boot. Boot into live media, chroot, run grub-install and rejoice.
- Accacin 10y agoYeah as an Arch user I've used it a few times where an pacman -Syu has caused something to break and it's pretty easy to chroot into your system and fix the broken package.
- exDM69 10y agoSomething 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 know it works and there's no guesswork involved in what the OS installer does. They aren't really intended for installing beside another system and the default partitioning options aren't always that great (RAID, LVM, crypto, etc). Basically you only need 3 things to run Linux: kernel, initramfs and rootfs.
- yellowapple 10y agoYou 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.
- lisivka 10y agoI 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. https://wiki.archlinux.org/index.php/Multiboot_USB_drive https://wiki.archlinux.org/index.php/Multiboot_USB_drive
- gizmo 10y agoThat usually doesn't work for remote servers because you can't access the grub menu over SSH and you want something that works even in those cases that grub or your boot record are trashed. So you just want to do a netboot from a generic rescue iso. Zero dependencies. Works even when your hard drives are severely damaged and you just need to /bin/dd some raw sectors.
- nitrogen 10y agoWorks even when your hard drives are severely damaged and you just need to /bin/dd some raw sectors. That reminds me of the time when some partitioning utility overwrote the first block of my filesystem and then set the filesystem start to the wrong block. I thought I was hosed, but I managed to use hexdump to find a backup superblock, calculate the correct filesystem offset from that, and dd the backup superblock into the primary location. I may be misremembering some details.
- JoshTriplett 10y ago> That usually doesn't work for remote servers because you can't access the grub menu over SSH Depends on your environment. My hosting company offers a remote console you can enable that gives access to a virtual serial console via SSH; with that, you can access your bootloader.
- smudgymcscmudge 10y agoThis is one of those things you want to have practiced before it's critical.
- tr1ck5t3r 10y ago>Pretty cool, although I'm pretty sure I would never use something like this. I'm pretty sure hackers do. Lets face it how many people audit their systems IF they feel its secured?
- HeadlessChild 10y agoI 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.