RackNerd Billboard Banner

How To Reset Root Password In Fedora Linux 42 And Older Versions

Forgetting the root password on Fedora Linux can be stressful, especially if you’re locked out of essential system tasks. Luckily, Fedora provides a way to reset the root password, even if you don’t remember the old one. In this guide, we’ll walk you through the steps to reset the root password in Fedora Linux 42 and earlier versions. This method works whether you’re using a desktop or server edition.

Why Reset the Root Password?

The root password is required for administrative tasks in Fedora, such as installing software or changing critical system settings. If you forget it, you won’t be able to perform these actions. Resetting the password restores access without needing to reinstall Fedora or lose your data.


Step 1: Access the GRUB Boot Menu

  1. Restart your Fedora system.
  2. As your computer boots, press the Esc key (or sometimes Shift for older versions) repeatedly to bring up the GRUB menu.

Step 2: Edit the Kernel Boot Parameters

  1. In the GRUB menu, use the arrow keys to highlight the Fedora entry you normally boot.
  2. Press e on your keyboard to edit the boot parameters.
  3. Find the line that starts with linux or linux16. It will look similar to:
    linux /vmlinuz-... root=UUID=... ro quiet
  4. At the end of this line, append the following:
    rw init=/bin/bash
    So the whole line should look like:
    linux /vmlinuz-... root=UUID=... ro quiet rw init=/bin/bash

Step 3: Boot into Single User Mode

  1. Press Ctrl + X or F10 to boot with these parameters.
  2. Your system will boot to a root shell prompt without asking for a password.

Step 4: Remount the Filesystem (If Necessary)

Sometimes the filesystem might be read-only. Remount it as read-write with:

mount -o remount,rw /

Step 5: Reset the Root Password

Type the following command to set a new root password:

passwd
  • Enter your new root password twice when prompted.

Step 6: Relabel SELinux Context (For SELinux Users)

If SELinux is enabled (default in Fedora), create a file to relabel all files on the next reboot:

touch /.autorelabel

This step prevents SELinux login issues after changing the password.


Step 7: Reboot the System

Restart your computer by typing:

exec /sbin/init

or simply:

reboot -f

Step 8: Login with Your New Root Password

After rebooting (and possibly waiting for SELinux relabeling), you can log in with your new root password!


Troubleshooting Tips

  • If you can’t see the GRUB menu, try pressing Esc or Shift earlier during boot.
  • For some cloud or virtual environments, you might need to attach the disk to another machine and edit /etc/shadow manually.
  • If you see permission errors, double-check that you added rw to the kernel line.

Conclusion

Resetting the root password in Fedora Linux is straightforward with access to the GRUB boot menu. These steps work for Fedora 42 and older versions. Always remember to use your root access responsibly and keep your passwords secure. If you have questions or encounter issues, let us know in the comments below!

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
RackNerd Billboard Banner
© 2025 Computer Everywhere
Your Everyday Guide to the Digital World.
Terms of Service | Privacy Policy
Copy link