Operations 13 min read

How to Fix Linux Boot Failures: Single‑User Mode, GRUB & Rescue Techniques

This guide explains how to troubleshoot Linux boot problems by using single‑user mode to reset forgotten root passwords, repairing disk errors with fsck, correcting GRUB configuration mistakes, and employing Linux rescue mode to restore missing system files or rebuild the bootloader for dual‑boot systems.

Efficient Ops
Efficient Ops
Efficient Ops
How to Fix Linux Boot Failures: Single‑User Mode, GRUB & Rescue Techniques

1. Single‑User Mode

Linux provides a single‑user mode (runlevel 1), similar to Windows safe mode, where the system boots into 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

In single‑user mode most Linux distributions do not require the root password (Fedora Core 6 example). To reset the password:

During boot, press any key to access the GRUB menu.

Press

e

to edit the selected entry and move to the

kernel

line.

Append

single

to the end of the line, press

Enter

, then

b

to boot.

When the root shell appears, run

passwd root

, then

exit

to reboot.

Other common fixes in single‑user mode include disabling problematic services (e.g.,

chkconfig smb off

) and changing the default runlevel by editing

/etc/inittab

(e.g., set

id:3:initdefault:

).

Case 2: Disk sector errors

Bad sectors or corrupted partitions often appear after an improper shutdown. The system may stop at a prompt like “Press root password or ctrl+D”. After entering the root password, run:

<code>fsck -y /dev/hda6</code>

Replace

/dev/hda6

with the appropriate partition, then reboot with

reboot

.

Case 3: Incorrect GRUB configuration

An “Error 15” indicates that GRUB cannot find the kernel specified in

grub.conf

, often due to a typo such as “vmlinux” instead of “vmlinuz”. Edit the entry in GRUB, correct the typo, save, and boot.

2. GRUB Boot Troubleshooting

When the system drops to a

grub&gt;

prompt, the most common causes are:

Incorrect options in

grub.conf

.

Missing or corrupted

grub.conf

(or other boot files).

If the configuration file is wrong, you can boot manually from the GRUB prompt, then fix

grub.conf

from within the running system. The typical

grub.conf

layout is:

<code>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</code>

The boot sequence loads the

/boot

partition, then the kernel, and finally the initrd image.

Example: Missing title line

If the

title

line is missing, the system stops at the

grub&gt;

prompt. Use the following commands to locate and inspect

grub.conf

:

<code>GRUB&gt; find /boot/grub/grub.conf (hd0,0)
GRUB&gt; cat (hd0,0)/boot/grub/grub.conf
GRUB&gt; cat (hd0,0)/boot/grub/grub.conf.bak   # if a backup exists</code>

After correcting the file, reboot.

3. Linux Rescue Mode

If neither single‑user mode nor GRUB commands can restore the system, boot from a Linux installation CD into rescue mode:

Boot from the CD, at the

boot:

prompt type

linux rescue

.

Follow the prompts to select language, keyboard, and optionally network settings.

The installer mounts the root partition under

/mnt/sysimage

. Choose “continue” for read‑write access.

Run

chroot /mnt/sysimage

to work inside the installed system.

Case A: Restoring a dual‑boot GRUB

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

<code>chroot /mnt/sysimage
grub-install /dev/hda   # adjust device name as needed
exit
exit</code>

The system will boot both Linux and Windows again.

Case B: Recovering a lost /etc/inittab

If

/etc/inittab

is missing, restore it from a backup or reinstall the package that provides it. Example using RPM:

<code>chroot /mnt/sysimage
rpm -ivh --replacepkgs --root /mnt/sysimage /mnt/source/Fedora/RPMS/initscripts-8.45.3-1.i386.rpm</code>

Or extract the file directly:

<code>rpm2cpio /mnt/source/Fedora/RPMS/initscripts-8.45.3-1.i386.rpm | cpio -idv ./etc/inittab
cp etc/inittab /mnt/sysimage/etc</code>

After restoring the file, exit the chroot and reboot.

Source: csghjnbj, blog.chinaunix.net/uid-26567710-id-3050269.html
linuxSystem AdministrationbootGRUBRescue ModeSingle User Mode
Efficient Ops
Written by

Efficient Ops

This public account is maintained by Xiaotianguo and friends, regularly publishing widely-read original technical articles. We focus on operations transformation and accompany you throughout your operations career, growing together happily.

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.