Skip to content

Instantly share code, notes, and snippets.

@gordonhart
gordonhart / recovery.md
Last active March 4, 2019 18:57
Broken system recovery: chroot

Using a recovery medium + chroot to fix a broken Linux system

System-breaking changes happen when mucking around as root on a linux system.

Fixing a system that won't boot into a serviceable state is often a simple operation. Provided you have an idea of the operation you performed before rebooting that broke the installation, all it takes is an alternative bootable drive, say a USB with an OS installer. Many default installation .isos don't come with a full-enough featured enough shell to perform fixes but many others do ("live" installers). This guide details how to use a distro's installer shell to fix a broken installation of an arbitrary distribution, for example using a NixOS installation image to fix a broken Debian installation.

Show block devices to find the identifiers (e.g. /dev/sda1) of the broken system's partitions:

# lsblk