Contact for queries :

Login

  UpComing Live WebEx Workshop Series

Booting Linux System into Rescue and Recovery Runlevels

Sometimes things go wrong with the system to the point where it refuses to boot.
For those users who are just starting out with Linux, this is a major red flag that throws them off their balance because they aren’t quite sure how to handle such a system crash. At this point, you can use the lower runlevels for system rescue or recovery.
If your system boots into runlevel 3, you can bring yourself into a recovery runlevel with
# init 1
If the system doesn’t even get that far,

  • -> you can boot up
  • -> enter a at the GRUB boot menu
  • -> and append the word single to the kernel that you want to boot into.

This approach has the same effect as booting you into a recovery runlevel. After you get into the recovery runlevel, you can perform maintenance or repairs on your system (such as figuring out what is preventing the system from booting).
at recovery/rescue runlevel:

  • ■ You can reset or change the root user’s password.
  • ■ You can adjust system files or partitions that are normally locked when the system is in use.
  • ■ You can repair system files by replacing them with working copies from a backup or the Red Hat installation CD.

After you finish making any changes or repairs, you can reboot the system and see whether it returns to its normal working state. If it doesn’t, you can re-enter the recovery runlevel to try again.
You can also access this rescue environment by booting the first Red Hat installation CD.
Now that you have an understanding of runlevels and how to move between them, we can shift focus to service management, which deals with different system services starting and stopping at the different runlevels
 

Troubleshooting – Recovering Root Password in Linux

If you forget your root user password or you are taking over a system where the root password isn’t documented, you can still get into the system. You need to perform the following actions at the physical console of the system.
Step 1: Highlight you operating system line on the first GRUB screen
Step 2: Press “e” , so that grub will show the configuration lines for root hard disk, kernel and initrd image.
Step 3. Move your cursor to end of the the kerne line and append the following keyword at the end of the line

single

Step 4: Press “b” , to boot the linux system using modified kernel option, so that system will enter into single user mode of maintenance mode.
Step 5. Now you can reset the root password using the passwd command as mentionedi n Step 5a.
Just incase if the passwd command doesn’t able to set the password because of missing shadow file, then follow the procedure mentioned in the Step5B

Step 5a. When you are presented with a command prompt, change the root user password:

# passwd root
Changing password for user root.
New password:
Retype new password:
Passwd: all authentication tokens updated successfully.

Step 5b. Verify the existence of the /etc/shadow file:

# ls /etc | grep shadow
If the /etc/shadow file doesn’t exist (which would be the cause of the error in this case), use the pwconv command to re-create the /etc/shadow file:
# pwconv
Now execute the passwd command to reset or change the root user’s  password:
# passwd root
Changing password for user root.
New password:
Retype new password:
Passwd: all authentication tokens updated successfully.

 
Step 6. Reboot the system and validate that the new root password works correctly:

# reboot

 
 

Troubleshooting – Recovering Linux System from Corrupted MBR issue

If you are having trouble booting the system and you have determined that the master boot record (MBR) is corrupt, you need to boot into rescue mode.  Use the Red Hat DVD, boot from it, and choose the option to enter rescue mode.
Step 1. After you boot, enter the GRUB shell:

# grub

Probing devices to guess BIOS drives. This may take a long time. GNU GRUB version 0.97 (640K lower / 3072K upper memory)
[ Minimal BASH-like line editing is supported.
For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a  device/filename.]

grub>

Step 2. Locate the root drive:

grub> root
(hd0,0): Filesystem type is unknown, partition type 0x8e

Step 3. Reinstall the MBR from the GRUB shell:

grub> setup (hd0)
Checking if “/boot/grub/stage1” exists… no
Checking if “/grub/stage1” exists… yes
Checking if “/grub/stage2” exists… yes
Checking if “/grub/e2fs_stage1_5” exists… yes
Running “embed /grub/e2fs_stage1_5 (hd0)”… 26 sectors are embedded.
Running “install /grub/stage1 (hd0) (hd0)1+26 p (hd0,0)/grub/stage2
/grub/grub.conf”… succeeded
Done.

Step 4. Reboot the system to validate that the system boots properly:

# reboot

 

November 14, 2015

0 responses on "Booting Linux System into Rescue and Recovery Runlevels"

Leave a Message

Your email address will not be published. Required fields are marked *

About iGURKUL

IGURKUL I.T. Training Hub offering various Career Certification courses in Computer Networking, Unix, Linux, Cloud Computing and DevOps Technologies. With its rich experience in IT training service sector, iGURKUL has been able to set Industry best practices in IT Training for the past five years.

In Past five years, more than 5000 professionals have been trained by iGURKUL for System administration, Cloud Computing and DevOps Skill set through our Online Training portal www.unixadminschool.com. And , each day , more than 10000 working professionals from all over the globe visiting our knowledge base www.unixadminschool.com/blog for the best practices and Knowledge learning.

top
copyright protected - 2011 © igurkul I.T. solutions. All rights reserved.