Rescue a Broken Linux Boot: Single‑User Mode, GRUB Fixes & Recovery Steps
This guide walks through Linux boot failure troubleshooting, covering single‑user mode, common GRUB misconfigurations, disk‑sector errors, and step‑by‑step recovery using rescue mode, with concrete commands and examples for each scenario.
Single‑User Mode
Linux single‑user mode (runlevel 1) boots directly to a root shell with networking disabled and only essential processes running. It is useful for repairing filesystems, restoring configuration files, or performing other low‑level maintenance.
Resetting a forgotten root password
When the boot screen appears, press any key to show the GRUB menu.
Highlight the desired entry and press e to edit it.
Move to the kernel line, append a space and the word single, then press Enter.
Press b to boot. The system starts in single‑user mode and presents a root shell.
Run passwd root to set a new password.
Type exit to reboot.
Repairing filesystem errors
If the boot loader prompts “Press root password or ctrl+D”, enter the root password to drop into single‑user mode and run: fsck -y /dev/hda6 The -y option automatically accepts all fixes. After the check completes, reboot with reboot.
Fixing GRUB configuration typos
A common boot failure is a typo in the kernel filename (e.g., vmlinux instead of vmlinuz), which produces “Error 15”. At the GRUB prompt press any key to return to the edit screen, correct the typo, press Enter to save, then b to boot. Remember to edit /boot/grub/grub.conf (or the symlink /etc/grub.conf) after the system starts.
GRUB Boot Troubleshooting
When the system drops to a grub> prompt, the cause is usually either an incorrect grub.conf or a missing configuration file.
Typical causes: Incorrect options in grub.conf . Missing or corrupted grub.conf (or missing kernel/image files).
Key entries in /boot/grub/grub.conf (symlinked as /etc/grub.conf) look like:
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.imgTo recover a missing or broken entry from the GRUB console:
Locate the partition containing grub.conf: find /boot/grub/grub.conf (hd0,0) Display the file (or a backup) to identify the error:
cat (hd0,0)/boot/grub/grub.conf
cat (hd0,0)/boot/grub/grub.conf.bakBoot the system using the correct root, kernel, and initrd lines, then edit grub.conf from within the running system and reinstall GRUB if necessary.
Linux Rescue Mode
If single‑user mode and GRUB editing do not resolve the problem, boot from a Linux installation CD/DVD and select “linux rescue”. The rescue workflow is:
At the boot: prompt type linux rescue and press Enter.
Accept the default language (English) and keyboard layout ( us). Decline network configuration unless required.
The installer mounts the root partition under /mnt/sysimage. Choose the default “continue” to mount it read‑write.
Run chroot /mnt/sysimage to work inside the installed system.
Rescue Example 1: Restoring a dual‑boot GRUB
After reinstalling Windows, its bootloader overwrites the MBR. From rescue mode execute:
chroot /mnt/sysimage
grub-install /dev/hda # replace hda with the appropriate disk
exit
exitReboot; GRUB will again manage both Linux and Windows.
Rescue Example 2: Recovering a missing /etc/inittab
If /etc/inittab is absent, the system cannot determine its default runlevel.
If a backup exists (e.g., /etc/inittab.bak): cp /etc/inittab.bak /etc/inittab Without a backup, identify the RPM that provides the file: rpm -qf /etc/inittab Then reinstall the package, for example:
mount /dev/hdc /mnt/source
rpm -ivh --replacepkgs --root /mnt/sysimage /mnt/source/Fedora/RPMS/initscripts-8.45.3-1.i386.rpmAlternatively extract only the missing file from the RPM:
rpm2cpio /mnt/source/Fedora/RPMS/initscripts-8.45.3-1.i386.rpm | cpio -idv ./etc/inittab
cp etc/inittab /mnt/sysimage/etcAfter restoring the file, exit the chroot environment and reboot.
Understanding the Linux boot process and mastering these single‑user, GRUB, and rescue techniques enables effective troubleshooting of startup failures.
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.
ITPUB
Official ITPUB account sharing technical insights, community news, and exciting events.
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.
