Solved: Boot into rescue mode without password (RHEL/CentOS)


Linux, How To

Getting started with the recovery

Ideally you can boot into rescue mode only after providing root user password. But what if you have forgotten the password and you have a requirement to boot into rescue mode?

Let's further explore this topic and I will share you step by step instructions to achieve this requirement.

The Anaconda installation program's rescue mode is a minimal Linux environment that can be booted from the Red Hat Enterprise Linux 7 (RHEL/CentOS) DVD or other boot media. It contains command-line utilities for repairing a wide variety of issues. This rescue mode can be accessed from the Troubleshooting submenu of the boot menu. In this mode, you can mount file systems as read-only or even to not mount them at all, blacklist or add a driver provided on a driver disc, install or upgrade system packages, or manage partitions.

 

NOTE:
Anaconda rescue mode is different from rescue mode (an equivalent to single-user mode) and emergency mode, which are provided as parts of the systemd, system and service manager

To boot into Anaconda rescue mode, you must be able to boot the system using one Red Hat Enterprise Linux (RHEL) boot media, such as a minimal boot disc or USB drive, or a full installation DVD.

 

What is the difference between Anaconda rescue mode and other rescue modes

I am sure you may have heard about rescue mode, emergency mode words during your tenure and you must have been wondering how are these different? Let me help you with some bullet points comparing different types of rescue mode we have

Anaconda Rescue Mode GRUB2 Rescue Mode GRUB2 Emergency Mode
Requires ISO to boot into rescue mode No ISO Required. Just some config changes in GRUB2 No ISO Required. Just some config changes in GRUB2
Supports mounting file system as both RW and RO mode Mounts file system as RW Mounts file system as RO
Does not require root or any password to get a shell Requires root user password to get a shell Requires root user password to get a shell
There is a probability to fix root file system related issues as the file system by default is mounted on /mnt/sysimage If root file system is corrupted then it cannot be fixed as it will still be in use. If root file system is corrupted then it cannot be fixed as it will still be in use.
Can be used to change root password If existing root password is not known then you will not get a shell to execute any commands If existing root password is not known then you will not get a shell to execute any commands
Boot into Anaconda Rescue Mode using ISO Boot into single user mode Boot into emergency mode (emergency.target)

 

Booting into Anaconda Rescue Mode  in RHEL/CentOS 7

Step-1: Boot up using ISO

Boot the system from either minimal boot media, or a full installation DVD or USB drive, and wait for the boot menu to appear.

How to boot a system into rescue mode using ISO DVD (RHEL / CentOS 7)

 

Step-2: Enter Rescue Mode

In the boot menu for the installation media, select the Rescue an installed system option, or edit the kernel command line to include the word rescue.

How to boot a system into rescue mode using ISO DVD (RHEL / CentOS 7)

 

Step-3: Mount root file system

When prompted about mounting the disks for the target system to be rescued, select option 1 (Continue). This will mount the system under /mnt/sysimage.

How to boot a system into rescue mode using ISO DVD (RHEL / CentOS 7)

 

Press Enter to obtain a shell when prompted. This shell will live inside the installation/rescue environment, with the target system mounted under /mnt/sysimage.
This shell has a number of tools available for rescuing a system, such as all common file system, disk, LVM, and networking tools. The various bin directories of the target
system are added to the default executable search path (${PATH}) as well.

How to boot a system into rescue mode using ISO DVD (RHEL / CentOS 7)

 

Even if your file system is mounted, the default root partition while in Anaconda rescue mode is a temporary root partition, not the root partition of the file system used during normal user mode (multi-user.target or graphical.target). If you selected to mount your file system and it mounted successfully, you can change the root partition of the Anaconda rescue mode environment to the root partition of your file system by executing the following command:

How to boot a system into rescue mode using ISO DVD (RHEL / CentOS 7)

 

This is useful if you need to run commands, such as rpm, that require your root partition to be mounted as /. To exit the chroot environment, type exit to return to the prompt.

 

Lastly I hope the steps from the article to boot into rescue mode or emergency mode using DVD ISO image in RHEL or CentOS 7 Linux was helpful. So, let me know your suggestions and feedback using the comment section.

 

References:
Anaconda boot into rescue mode

 

Related Keywords: how to boot in rescue mode in redhat linux 7, rescue mode in linux, grub rescue mode, difference between rescue mode and emergency mode in linux, boot into rescue mode centos 7, grub rescue mode commands, boot into rescue mode rhel 8

Deepak Prasad

Deepak Prasad

Deepak Prasad is the founder of GoLinuxCloud, bringing over a decade of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, Networking, and Security. His extensive experience spans development, DevOps, networking, and security, ensuring robust and efficient solutions for diverse projects.

Certifications and Credentials:

  • Certified Kubernetes Application Developer (CKAD)
  • Go Developer Certification
  • Linux Foundation Certified System Administrator (LFCS)
  • Certified Ethical Hacker (CEH)
  • Python Institute PCAP (Certified Associate in Python Programming)
You can connect with him on his LinkedIn profile and join his Facebook and LinkedIn page.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to admin@golinuxcloud.com

Thank You for your support!!

Leave a Comment