Reset/Unlock Photon OS root account
When upgrading an appliance, you need to login with the root account. From time to time the account get locked out either from entering the incorrect password or using some automation that uses the wrong password which leads both to locked account.
These steps are required to recover the password AND unlock the account
1. Reboot the Photon Appliance
2. At the Photon OS logon screen press e to edit the grub menu
3. At the grub menu append the following to the end of the boot loader line to boot into single user mode
rw init=/bin/bash
4. Press F10 or CTRL+X to continue the boot process
5. At the prompt type the following to mount the root partition
mount -o remount,rw /
6. To reset the root password type passwd and enter the new password
If the root account was locked due to x number of failed logon attempts you need additional steps.
1. Type the following to unlock it
/sbin/pam_tally2 -r -u root
2. Unmount the partition again
umount /
3. And reboot
reboot -f
Now you should be able to log in with your root account.