Skip to content

Click on each book below to review & buy on Amazon.

As an Amazon Associate, I earn from qualifying purchases.

RHCSA - Operate Running Systems: Interrupt the Boot Process in Order to Gain Access to a System

Interrupting the boot process to gain access to a system may be required for many situations. For this objective we will focus on the scenario where the root password has been lost or forgotten, and we need to interrupt the boot process to reset it.

Interrupt the Boot Process

The below image shows what a typical Grub menu will look like. It shows the different kernels that you can boot into, and in my case I also have access to UEFI Firmware Settings.

This boot menu by default will display for 5 seconds before automatically booting the first option. To interrupt the countdown you can just use the Up or Down arrows which will allow you to take your time in choosing your next step.


Gain Access to a System

With the boot process interrupted you can now attempt to gain access to the system. Ensure the kernel you wish to boot into is highlighted and press the E key to edit its configuration.

Your screen should look similar to:


To boot into a minimal environment where we will be able to change the root password we need to make two changes to the line starting with linux:

  • Change ro to rw: This makes the root filesystem mount as read-write, allowing you to make changes to the system.
  • Append init=/bin/bash: This tells the system to start a bash shell as the first process, pid 1, instead of the default systemd process.

    Use the End key to go to the end of the linux line quickly.

Following the changes your screen should look like:


You can now press Ctrl+X or the F10 key to boot into the modified environment.

Within the bash shell you can now:

  • Reset the root password using the passwd command.
  • Ensure SELinux relabeling occurs by creating the /.autorelabel file.
  • Boot into your system normally using exec /sbin/init.

    /sbin/init is a symlink to /usr/lib/systemd/systemd which is the actual command to exec. However /sbin/init is easier to remember.

Reset the root password to gain access to the system again:

touch /.autorelabel

exec /sbin/init

After a running the exec command it may take a few minutes for SELinux relabeling to complete. Afterwards the system will boot and you will see your normal login prompt.

Support DTV Linux

Click on each book below to review & buy on Amazon. As an Amazon Associate, I earn from qualifying purchases.

NordVPN ®: Elevate your online privacy and security. Grab our Special Offer to safeguard your data on public Wi-Fi and secure your devices. I may earn a commission on purchases made through this link.