Skip to content
ALB Wiki

Troubleshooting and Rescue

This is an old revision of this page — revision 1 (2026-10-25 14:51:07 UTC). It may differ from the current revision.

The fundamental rescue theorem: if anything at all boots — a live USB, another partition, the installer's rescue shell — the broken system can be mounted, chrooted into, and repaired. This chapter is the failure playbook: the boot failures, the filesystem damage, the forgotten passwords, and the universal mount-chroot-fix move that solves most of them.

The universal rescue move

# boot a live USB / the installer's rescue mode, then:
mount /dev/sda3 /mnt                  # the broken system's root
mount --bind /dev /mnt/dev            # the kernel interfaces
mount --bind /dev/pts /mnt/dev/pts
mount -t proc proc /mnt/proc
mount -t sysfs sys /mnt/sys
mount -t tmpfs tmpfs /mnt/run
chroot /mnt /bin/bash                 # you're inside the patient
# fix: reinstall grub, rebuild the kernel, reset a password, edit fstab
exit; umount -R /mnt; reboot

This is chapter 4's pivot in reverse — the same binds, the same chroot — aimed at a broken system instead of a building one. Learn this cold; it's the answer to most of this chapter.

The boot failures — triage by stage

Where it stopsThe layerFirst move
grub> or GRUB rescueBootloaderls, set root=, linux, boot by hand
Kernel panic — can't mount rootKernelThe FS/controller as module not built-in — rebuild, or add initramfs
init: not foundrootfs/initfstab/root= mismatch; chroot-rescue
Emergency/maintenance modefstab or fsckThe journal; mount -a to find the bad line
Hangs mid-bootA servicerescue.target/init=/bin/bash
Black screen after GRUBGraphicsnomodeset kernel param

The rescue boot params — appended at GRUB's e (edit) key:

init=/bin/bash        # skip init entirely — a root shell at boot
single                # single-user mode — minimal services
systemd.unit=rescue.target   # systemd's single-user
nomodeset             # kill graphics driver — the display fix
root=/dev/sda3        # override the root=
ro                    # read-only root

init=/bin/bash is the deepest door — no init, no login, just bash as PID 1: mount -o remount,rw / and you can fix anything — including resetting a lost root password (passwd).

The filesystem failures

fsck -n /dev/sda3              # diagnose — never mounted
fsck.ext4 -y /dev/sda3         # repair
e2fsck -b 32768 /dev/sda3      # backup superblock
mount -o remount,rw /          # read-only → writable in place

Filesystem damage shows as emergency-mode boots or "filesystem check failed". The backup superblocks (mkfs scattered them) rescue corrupted primaries. And dmesg shows I/O errors — a dying disk (SMART says) gets ddrescue imaged before fsck touches it.

The forgotten password

# rescue-boot → chroot → passwd root
# or: init=/bin/bash → remount,rw → passwd root → exec /sbin/init

No backdoor needed — physical access to a non-FDE system is root.

Reading the failure — the logs

dmesg -l err,warn               # the kernel's complaints
dmesg -T | tail -30             # human timestamps, recent
journalctl -b -p err            # this boot's errors (systemd)
journalctl -b -1                # the LAST boot — the crash's record
journalctl -u service           # one unit's story
less /var/log/messages          # SysV's equivalent
ls -lt /var/log/                # freshest logs first

journalctl -b -1 — last boot's log — is the single most powerful troubleshooting command on systemd systems: the log of the boot that died.

The repair toolkit — a live USB's contents

A good rescue stick carries: gdisk/fdisk, fsck.*, chroot, grub-install, ddrescue, testdisk, photorec, smartctl, lsblk, mount — Slackware's installer image or a SystemRescue image carries them all. The LFS host VM is itself a rescue host for the LFS partition.

Where rescue goes wrong

SymptomCause
chroot can't find /bin/bashThe mount is wrong — ls /mnt first
Fixed, still won't bootDidn't reinstall GRUB after the fix
fsck "filesystem is mounted"It is — unmount or use -n
init=/bin/bash shell is read-onlymount -o remount,rw /
Changes lost on rebootEdited the live env, not the mounted system
Rescued but data's goneHardware — image first, repair second

Exercises

  1. Boot a VM to init=/bin/bash — remount rw, change root's password, boot normally.
  2. Break fstab deliberately; find emergency mode; fix via mount -a.
  3. Boot to rescue.target/runlevel 1; inventory what runs.
  4. journalctl -b -1 — read a previous boot's last moments.
  5. Write the mount+chroot rescue script from memory — the universal move.

Timeline

StageThe rescue
BootloaderGRUB CLI hand-boot
Kernelrescue params
initinit=/bin/bash
fstabmount -a, emergency mode
Systemmount+chroot+fix
Hardwareddrescue, then repair

See also

Categories: Handbook · Linux · Linux Handbook · Recovery
This page was last edited 2026-10-25 14:51:07 UTC by ALB Team. What links here