5

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.

2
  • 4
    Don't have a fedora, su untested, but the general approach should be editing the command line of the menu entry, probably placing rw init=/bin/bash in the command line. That way you boot directly to a shell, where you can do passwd. If this does not work, boot from a live cd (of any distro), mount the system, chroot into it and passwd there. If any of this works, let me know and I'll write a proper answer. If not, be more specific about why it fails.
    – MvG
    Aug 5, 2013 at 12:37
  • I just encountered an issue with FC19 root password reset. As OP mentions, single-user mode asks for the root password. Further issue - using the 'init=/bin/sh', 'mount -o remount,rw /', 'passwd' method - It not only failed to update the root password properly, but also broke something (I think in policykit) which kept the windowmanager from fully loading on subsequent reboots. Totally baffled about how to fix it now without a reinstall.
    – rhoyerboat
    Nov 5, 2013 at 19:59

7 Answers 7

12

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

2
  • this does't work for me. I get bash: remount: command not found for the second instruction
    – ekkis
    May 25, 2014 at 5:34
  • ah... thanks to Joseph R below. [mount -o remount,rw /] works
    – ekkis
    May 25, 2014 at 5:46
7
  • Type sudo -i in command line terminal.
  • Give your user account password by which you logged in to the system.
  • Now type "passwd".
  • It will ask you for new root password.
  • Type new root password and then retype it.
  • Now type exit.

You're done with it. Your root password is now changed. Enjoy!!!

3
  • 3
    This isn't what he's asking how to do. He wants to change the password from the GRUB prompt.
    – slm
    Aug 7, 2013 at 5:31
  • I believe the OP only mentions grub because he feels that's the right approach. Ultimately, this is a way to reset a forgotten root password. In any case, it helped me.
    – Octopus
    Aug 10, 2013 at 4:19
  • 2
    This assumes the OP has configured their regular user account with sudo access.
    – Joseph R.
    Sep 4, 2013 at 21:03
1

Try getting a Fedora 15 CD (not any other Fedora CD) and using it's rescue mode.

Then follow these instructions:

  1. Boot from the install or rescue CD/DVD.
  2. Select "Rescue installed system."
  3. Answer the prompts for language and keyboard. Starting the network is optional and not needed.
  4. Let the rescue mode mount your file systems in the read/write mode.
  5. Hit Enter to get the shell prompt.
  6. At the prompt, enter the following commands. Do not enter any # mark or the text following it. These comments are shown for explanatory purposes only.
chroot /mnt/sysimage    # Change to your disk file system  
passwd                  # Change the root password  
exit                    # Exit the chroot environment  
exit                    # Exit the rescue mode

Thats what worked for me after my 6 hour search for answers.

0

I've typically just added a 1 at the end of the boot options to gain access to the system in single user mode. From there I can change the root password using passwd or edit the /etc/shadow file so that root has no password and set it afterwards.

Directions for getting into the Grub menu using Fedora 19 are available here in the official documentation for Fedora:

Details on the boot options are here:

1
  • 1
    I tried this but when I acces to the system terminal using that method, asks me the root's password to use it.
    – user44533
    Aug 6, 2013 at 18:23
0

Instead of entering 1 at your boot prompt (to enter single user mode), you can enter init=/bin/sh. This will replace your system's usual init with a root shell.

In this scenario, your root filesystem may be mounted read-only, so the first thing you want is to remount it read/write:

# mount -o remount,rw /
# passwd root

...and you're home free.

0

Go to boot prompt by pressing arrow key,Press 'a' key and when you see rhbquiet press space and type 1 and return to boot. It will land you to a # prompt change the pwd there.

0

Just boot with a liveCD, mount your Fedora's drive (mount --bind /dev /sys /proc /pro/sys to your mounted Fedora's) chroot to your fedora's drive and passwd to change the password.

You must log in to answer this question.