Locked out of root

Is there a way to reset a root password?

I was changing the password of my root account. After a minute, I decided to revert it back. Then I went away from the computer. When I returned, the lock screen wouldn’t accept the new, nor the old password. I’ve tried every iteration of the password but it still won’t accept it.

I specifically changed it back to not have this problem, and yet here we are.

Boot to rescue.target and use passwd to set the root password.

To get to rescue.target:
Interrupt the boot at the part where you can choose your kernel.
Select the kernel you want to use and press ‘e’ to edit the kernel parameters at the bottom.
Remove the string “console=ttyS0.115200n8” and add in it’s place “systemd.unit=rescue.target”.
Press ‘Enter’.