Fedora – How to Reset Forgotten Root Password in Fedora 19 from GRUB

fedoragrubpassword

YES, FEDORA 19.

I saw a lot of information about how to do it but doesn't work with this version. All the tutorials explain the method for older versions of Fedora, i didn't found anything about doing it on the v19 or the v18.

The GRUB menu is different (and i installed the GRUB's version from fedora installation, I only have this system ). I can enter to the recovery console but asks me the root password, so this doesn't solves anything.

If anyone knows a way to do it; or if it's impossible, please tell me why.

Best Answer

For your information, I opened a bug report on the Fedora bugzilla. The solution is:

  • boot with init=/bin/bash (editing the kernel line in grub)
  • after booting: mount -o remount,rw /
  • passwd root
  • enter the new password twice
  • touch /.autorelabel
  • reboot with /sbin/reboot -f

The last line (creating the .autorelabel file at the root) force a selinux relabelling of the whole filesystem, which is corrupted since we modified /etc/shadow without any selinux context (because of booting with init=/bin/bash).

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1084400

Updated Fedora wiki with the selinux fix: https://fedoraproject.org/w/index.php?title=How_to_reset_a_root_password#Changing_root_password

Related Question