How to reset CentOS 7 based VM’s root password on a KVM system

Steps:

  1. Reboot. You should see the menu with CentOS 7 and have a few split seconds to press e for edit.
  2. Scroll down, you’ll have to probably resize the VM console view. Sometimes going to the end and scrolling back is easier.
  3. Look for ro and change to rw init=/sysroot/bin/sh
  4. Press control-X and wait a short while to see the prompt about Emergency Mode
  5. chroot /sysroot
  6. passwd root

If you get passwd command not found, you have an issue.

Otherwise,

exit

Then

reboot

Screenshots:

#1

#2

#3

#4

Fin.

Running Ubuntu? Try this instead:

Change ro to rw and add init=/bin/bash to the end of the line.

Share this article

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to Top