| Symptom | Reach for |
|---|---|
| No bootloader | |
| Emergency shell | |
| Lost root password | $ passwd |
| Dirty filesystem | $ fsck |
| Broken packages | $ dpkg |
| Failing disk | $ smartctl |
| Deleted files | $ testdisk |
Before you change anything on a failing disk, image it first. See the Backup & Imaging basics page for `ddrescue` and `dd`.
Match the live system's architecture and, ideally, its toolset to the broken install. An Arch live USB has `mkinitcpio`; a Debian one has `update-initramfs`.
| Command | Shows |
|---|---|
| lsblk -f | Devices, filesystems, labels, mountpoints |
| blkid | UUID and type per partition |
| fdisk -l | Partition tables and sizes |
| findmnt | Current mount tree |
Mount read-only with `mount -o ro` when you only want to rescue data from a questionable disk, so you cannot make things worse.
Without `/dev`, `/proc`, and `/sys` mounted, tools like `grub-install` and `update-initramfs` fail in confusing ways. The bind mounts are not optional.
| Distribution | Rebuild command |
|---|---|
| Debian / Ubuntu | update-initramfs -u -k all |
| Arch | mkinitcpio -P |
| Fedora / RHEL | dracut -f --regenerate-all |
After `init=/bin/bash`, the normal shutdown path is gone. Run `sync` and reboot with the magic SysRq keys or `mount -o remount,ro /` before a hard reset, so you do not corrupt the filesystem.
If accounts use a separate `/etc/shadow` on an encrypted or LVM volume, unlock and mount it first, or `passwd` will silently edit the wrong file.
| Filesystem | Check / repair |
|---|---|
| ext2/3/4 | fsck -f, e2fsck -fy |
| XFS | xfs_repair |
| Btrfs | btrfs check, --repair (last resort) |
| FAT / exFAT | fsck.vfat -a, fsck.exfat |
`fsck` on a mounted, writable filesystem will corrupt it. If you must check the root device, do it from rescue media or before it is remounted read-write.
Match devices by UUID (from `blkid`), not by `/dev/sdX`, which can change between boots and is a common cause of fstab boot failures.
A failing Reallocated_Sector_Ct or Current_Pending_Sector in `smartctl -a` means: stop, image the disk with `ddrescue`, and replace it. Repairs on dying hardware only buy minutes.
The moment you realize files were deleted, unmount the filesystem or power off. Continued writes overwrite the very blocks you are trying to recover.
Every recovery is easier with a current backup and a tested restore. The work you do here is the price of not having one, see the Backup & Imaging page.