Steps:
- Reboot. You should see the menu with CentOS 7 and have a few split seconds to press
efor edit. - Scroll down, you’ll have to probably resize the VM console view. Sometimes going to the end and scrolling back is easier.
- Look for
roand change torw init=/sysroot/bin/sh - Press
control-Xand wait a short while to see the prompt about Emergency Mode chroot /sysroot- 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.