Operations 13 min read

Linux Boot Troubleshooting: Single‑User Mode, GRUB Issues, and Rescue Mode Cases

This article presents practical Linux boot troubleshooting techniques, including using single‑user mode, correcting GRUB configuration errors, and employing rescue mode, illustrated with step‑by‑step case studies for root password recovery, disk sector errors, and dual‑boot restoration.

Qunar Tech Salon
Qunar Tech Salon
Qunar Tech Salon
Linux Boot Troubleshooting: Single‑User Mode, GRUB Issues, and Rescue Mode Cases

Linux boot failures can prevent a system from starting normally; this guide demonstrates several recovery methods—single‑user mode, GRUB command operations, and Linux rescue mode—through concrete case studies.

1. Single‑User Mode

Single‑user mode (runlevel 1) boots Linux into a minimal environment with only a root shell, no network, and a few essential processes, similar to Windows safe mode. It is useful for fixing filesystem corruption, restoring configuration files, or moving user data.

Case 1: Forgotten root password

In many distributions (e.g., Fedora Core 6), the root password is not required to enter single‑user mode. To reset the password:

1. During boot, press any key to access the GRUB menu. 2. Press e to edit the selected entry, move to the kernel line and press e again. 3. Append single to the end of the line, press Enter , then b to boot. 4. At the sh-3.1# prompt, run passwd root to set a new password, then exit to reboot.

Additional single‑user tasks include disabling problematic services (e.g., chkconfig smb off ) and changing the default runlevel by editing /etc/inittab (e.g., id:3:initdefault: ).

2. GRUB Boot Troubleshooting

When GRUB fails, the system may drop to a grub> prompt. Common causes are incorrect options in /boot/grub/grub.conf or a missing/corrupted GRUB configuration file.

Case 2: Disk sector errors

If the boot process stops with “Press root password or ctrl+D”, enter the root password to reach single‑user mode, then run:

fsck -y /dev/hda6

After the filesystem check completes, reboot with reboot .

Case 3: GRUB configuration typo (Error 15)

A typo such as using vmlinux instead of vmlinuz prevents the kernel from loading. Edit the entry at the GRUB prompt, correct the typo, press b to boot, and later fix the typo permanently in grub.conf .

Typical GRUB configuration lines (example for Fedora Core):

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

The title defines the menu entry, root points to the boot partition, kernel specifies the kernel image and parameters, and initrd points to the initial RAM disk.

3. Linux Rescue Mode

If neither single‑user nor GRUB recovery works, boot from a Linux installation CD and select “linux rescue”. The rescue environment mounts the system’s root partition under /mnt/sysimage and allows chrooting into it.

Case 1: Dual‑boot restoration

After reinstalling Windows, the GRUB MBR may be overwritten. From rescue mode:

sh-3.1# chroot /mnt/sysimage
sh-3.1# grub-install /dev/hda   # replace hda with the appropriate disk
sh-3.1# exit
sh-3.1# exit   # leave chroot and rescue mode, then reboot

Case 2: Missing /etc/inittab

If /etc/inittab is lost, locate the RPM that provides it:

sh-3.1# rpm -qf /etc/inittab

Then reinstall the package in the rescued system:

sh-3.1# rpm -ivh --replacepkgs --root /mnt/sysimage /mnt/source/Fedora/RPMS/initscripts-8.45.3-1.i386.rpm

Alternatively, extract the file directly:

sh-3.1# rpm2cpio /mnt/source/Fedora/RPMS/initscripts-8.45.3-1.i386.rpm | cpio -idv ./etc/inittab
sh-3.1# cp etc/inittab /mnt/sysimage/etc

After restoring the necessary files, exit the chroot and reboot.

Understanding Linux’s boot process and mastering these recovery techniques are essential for effective system administration and fault resolution.

linuxTroubleshootingSystem AdministrationbootGRUBRescue ModeSingle User Mode
Qunar Tech Salon
Written by

Qunar Tech Salon

Qunar Tech Salon is a learning and exchange platform for Qunar engineers and industry peers. We share cutting-edge technology trends and topics, providing a free platform for mid-to-senior technical professionals to exchange and learn.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.