Resetting Lost Root Password in XenServer 7.0
// Latest blog entries
XenServer 7.0, Grub2, and a Lost Root Password
In a previous article I detailed how one could reset a lost root password to XenServer 6.2. While the article is not limited to 6.2 (it works just as well for 6.5, 6.1, and 6.0.2), this article is dedicated to XenServer 7.0 as grub2 has been brought in to replace extlinux.
As such, if the local root user's (LRU) password for a XenServer 7.0 is forgotten physical (or "lights out") access to the host and a reboot will be required. The contrast comes with grub2, the methods to boot the XenServer 7.0 host into single user mode, and how to reset the root password to a known token.
The Grub Boot Screen
Once obtaining physical or "lights out" to the XenServer 7.0 host in question, on reboot the following screen will appear:
It is important to note that once this screen appears, you only have four seconds to take action before the host proceeds to boot the kernel.
As should be default, the XenServer kernel is highlighted. One will want to immediately press the e key (for edit).
This will then refresh the grub interface - stopping any count-down-to-boot timers - which will reveal the boot entry. It is within this window (using up, down, left, and right) one will want to navigate to around line 4 or five and isolate "ro nolvm":
Next, one will want to remove (or backspace/delete) the "ro" characters and type in "rw init=/sysroot/bin/sh", or as illustrated:
Don't worry if the directive is not on one line!
With this change made, press both Control and X at the same time as this will boot the XenServer kernel into single user style mode, or better known as Emergency Mode:
How to Change Root's Password
From the Emergency Mode prompt, execute the following command:
Now, once can execute the "passwd" command to change root's credentials:
Now that root's credentials have been changed, utilize Control+Alt+Delete to reboot the XenServer 7.0 host and one will find via SSH, XenCenter, or directly that the root password has been changed: the host is ready to be managed again.
Shared via my feedly newsfeed
Sent from my iPhone