On Red Hat I forgot my administrator password and would like to reset it. However, if I boot with GRUB `rd.break`, then I face the attached interfaced where <kbd>enter</kbd> leads to the usual user login prompt.
Apr 29, 1:33am

On Red Hat-based systems (like RHEL, CentOS, or Fedora), using rd.break in GRUB is the correct first step to reset a forgotten root password. However, if pressing <kbd>Enter</kbd> after adding rd.break only brings you back to the normal login prompt, it usually means the system did not actually drop you into the emergency shell as expected.

Here’s how to properly reset the root password using rd.break:


Step-by-Step: Reset Root Password with rd.break

1. Interrupt GRUB at Boot

  • Restart your system.
  • As soon as the GRUB menu appears, press <kbd>e</kbd> to edit the boot entry.

2. Edit the Kernel Line

  • Find the line starting with linux or linux16 or linuxefi.
  • Append rd.break to the end of this line.
  • Remove rhgb and quiet if present (to see the boot process).
  • Example:
    text
    linux16 /vmlinuz-... root=/dev/mapper/rhel-root ro crashkernel=auto resume=/dev/mapper/rhel-swap rd.lvm.lv=rhel/root rd.lvm.lv=rhel/swap rd.break
  • Press <kbd>Ctrl</kbd> + <kbd>x</kbd> or <kbd>F10</kbd> to boot with these changes.

3. Remount /sysroot as Read-Write

  • You should now be at a shell prompt like:
    text
    switch_root:/#
  • Run:
    bash
    mount -o remount,rw /sysroot
  • Then, chroot into /sysroot:
    bash
    chroot /sysroot

4. Reset the Root Password

  • Now, reset the password:
    bash
    passwd root
  • Enter the new password twice.

5. Touch /.autorelabel (for SELinux)

  • To avoid SELinux issues on reboot:
    bash
    touch /.autorelabel

6. Exit and Reboot

  • Type exit twice to leave the chroot and emergency shell.
  • The system will reboot. Log in with the new root password.

Why You Might Not See the Emergency Shell

  • Typo in GRUB command: Double-check you added rd.break (not rdbreak or similar).
  • GRUB not saving changes: Ensure you pressed <kbd>Ctrl</kbd> + <kbd>x</kbd> or <kbd>F10</kbd> to boot with the changes.
  • System uses systemd: Some newer systems may require systemd.unit=emergency.target instead of rd.break.
  • Secure Boot: If Secure Boot is enabled, it may prevent kernel parameter changes.

Alternative: Use init=/bin/bash

If rd.break doesn’t work, try:

  • Edit the kernel line in GRUB and replace ro with:
    text
    rw init=/bin/bash
  • Press <kbd>Ctrl</kbd> + <kbd>x</kbd> to boot.
  • You’ll drop to a root shell. Remount / as read-write:
    bash
    mount -o remount,rw /
  • Reset the password with passwd root, then reboot.

If You Still See the Login Prompt

  • The system may be ignoring the kernel parameter. Try:
    • Using rd.break on a different GRUB entry (e.g., recovery mode).
    • Using a rescue CD/USB (like a live ISO) to chroot and reset the password.

--- Let me know:

  • Which Red Hat version are you using (RHEL 7/8/9, CentOS, Fedora)?
  • Does the system use LVM, Btrfs, or standard partitions?
  • Do you see any error messages when booting with rd.break?

This will help narrow down the issue.

Apr 29, 1:33am

This is a shared conversation and may include unverified content that doesn't reflect Mistral AI's views. Login to resume chatting.

Le Chat can make mistakes. Check answers. Learn more