How to Rescue a Failing Linux Boot: Single‑User, GRUB & Rescue Mode Hacks
This article walks through common Linux boot failures and provides step‑by‑step solutions using single‑user mode, GRUB command editing, and the Linux rescue environment, including password recovery, disk sector fixes, GRUB configuration errors, and dual‑boot restoration techniques.
(1) Single‑User Mode
Linux provides a single‑user mode (runlevel 1) similar to Windows safe mode, booting directly to a root shell with networking disabled and only essential processes running. It is useful for repairing file‑system damage, restoring configuration files, or moving user data.
Case 1: Forgotten root password
1. During boot, press any key to enter the GRUB menu. 2. Press e to edit the GRUB entry, move to the kernel line and append single at the end. 3. Press Enter , then b to boot. The system boots into single‑user mode where you can reset the password: passwd root 4. After the password change, type exit to reboot.
Other single‑user tasks include disabling problematic services (e.g., chkconfig smb off) and changing the default runlevel by editing /etc/inittab (e.g., setting id:3:initdefault: to boot into runlevel 3).
(2) GRUB Boot Troubleshooting
Sometimes the system drops to a grub> prompt, often due to mis‑configured or missing GRUB files.
Common causes: Incorrect options in grub.conf Missing or corrupted grub.conf (or the entire /boot/grub directory)
Typical grub.conf structure:
title Fedora Core (2.6.18-1.2798.fc6) root (hd0,0) kernel /boot/vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=/ rhgb quiet initrd /boot/initrd-2.6.18-1.2798.fc6.img
Key points: title identifies the OS entry. root points to the /boot partition. kernel specifies the kernel image and boot parameters. initrd points to the initial RAM disk.
If the title line is missing, the system boots to the GRUB prompt. To fix:
1. Locate grub.conf with find /boot/grub/grub.conf (hd0,0) . 2. View the file: cat (hd0,0)/boot/grub/grub.conf (compare with a backup if available). 3. From the GRUB prompt, manually set the root, kernel, and initrd lines, then boot with b : root (hd0,0) kernel /boot/vmlinuz-2.6.18-1.2798.fc6 ro root=LABEL=/ rhgb quiet initrd /boot/initrd-2.6.18-1.2798.fc6.img 4. After the system boots, edit grub.conf to make the changes permanent.
(3) Linux Rescue Mode
When neither single‑user mode nor GRUB editing can recover the system, the Linux rescue environment can be used.
Steps: Boot from a Linux installation CD/DVD, choose the “linux rescue” option at the boot: prompt. Select language (default English) and keyboard layout (default us ). Allow the installer to mount the root partition under /mnt/sysimage with read‑write access (choose “continue”). Enter the rescued system with chroot /mnt/sysimage .
Typical rescue tasks:
Restoring a missing or corrupted /etc/inittab by copying a backup or reinstalling the owning RPM package.
Reinstalling GRUB for dual‑boot systems: grub-install /dev/hda (adjust device name as needed).
Recovering configuration files from RPM packages using rpm2cpio and cpio.
rpm2cpio /mnt/source/Fedora/RPMS/initscripts-8.45.3-1.i386.rpm | cpio -idv ./etc/inittab
cp etc/inittab /mnt/sysimage/etcAfter repairs, exit the chroot ( exit) and reboot the system.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
MaGe Linux Operations
Founded in 2009, MaGe Education is a top Chinese high‑end IT training brand. Its graduates earn 12K+ RMB salaries, and the school has trained tens of thousands of students. It offers high‑pay courses in Linux cloud operations, Python full‑stack, automation, data analysis, AI, and Go high‑concurrency architecture. Thanks to quality courses and a solid reputation, it has talent partnerships with numerous internet firms.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
