Skip to content

Rescue Chroot

You'll break your own boot three different ways on purpose and fix each one from a live USB, so a machine that won't start stops being an emergency.

About

The difference between someone who uses Linux and someone who can fix it is whether a black screen with a blinking cursor makes them reach for a reinstall or a live USB. The chroot is the trick: boot from the stick, mount the broken system, step inside it, and repair it with its own tools. You'll practice on a machine or a VM you've set up for the purpose, breaking one thing at a time, so that when a real update eats your bootloader you've already done this. Keep a known-good live stick in a drawer from here on.

At a glance

Per requirement
35 XP
Completion bonus
300 XP
Requirements
7
Takes
A few evenings over two weeks
Skill level
Intermediate (months of practice)
Cost
Cheap (under $10)
Supplies
You need some
Where
At home
Other people
On your own
Locked for now
Earn two more Uncommon badges in Linux to open this one. Log in to see how far along you are.

Requirements

  1. 1
    Build a practice system and write down its disk layout. A VM is fine for this one, and so is the old laptop. Note the partitions, which one is root, which one is EFI or boot, and whether it's encrypted. Take a photo of lsblk -f with the layout labelled by hand. Photo
  2. 2
    Boot a live USB, mount the broken system, and chroot into it. Mount root to /mnt, then the EFI partition to /mnt/boot/efi (or /mnt/boot), then bind-mount /dev, /proc, /sys and /run, then chroot. arch-chroot does the bind mounts for you if you're on an Arch stick. Run a command inside that shows you're in the right system, like cat /etc/hostname. Film the sequence, or take a photo of the prompt inside the chroot. Photo or video
  3. 3
    Break and repair the bootloader. From inside the working system, delete the bootloader's EFI entry or wipe the GRUB config, reboot to see it fail, then chroot and reinstall GRUB (or systemd-boot) and regenerate its config. Film the failed boot and the fix, or take a photo of the repaired boot menu with a line on what the failure looked like. Photo or video
  4. 4
    Break and repair fstab. Add a line to /etc/fstab for a disk that doesn't exist, reboot into the emergency shell, and fix it there or from the chroot. While you're in there, read what the nofail option does, because it's the difference between a missing USB drive and a machine that won't boot. Take a photo of the emergency prompt, or of the corrected line with the error message you got. Photo
  5. 5
    Break and rebuild the initramfs. Delete or corrupt the initramfs image for your current kernel, watch the boot fail to find root, then regenerate it from the chroot with mkinitcpio, dracut or update-initramfs. Film the failed boot and the rebuild, or take a photo of the regenerated file in /boot with the panic message written out. Photo or video
  6. 6
    Reset a forgotten root password without knowing it. From the chroot, run passwd for root or for your user, or boot with init=/bin/bash on the kernel line and remount root read-write. Do this only on a machine you own. It's also why full disk encryption matters, because anyone with your laptop and a USB stick can do the same to an unencrypted machine. Take a photo of the new login working. Photo
  7. 7
    Write a one-page rescue card and keep it with the stick. The mount commands, the chroot steps and the three fix commands for your bootloader, initramfs and fstab, on paper, because the broken machine can't show you a wiki. Take a photo of the card and the live USB together. Photo