I was once locked out of my machine because I didn't install the config file for my lone window manager (i was being silly), so I decided to fix things up :)
While in the process, I thought about sharing how to boot as root and have root permissions.
Turn on your machine, and after being greeted by GRUB bootloader, press E to modify how your machine will boot ( with command )
Locate the kernel loader, it should be under the name linux
Add init=/bin/bash to the end of the kernel loader line If the line doesn't contain rw, make sure to add it. After that, press F10 or whatever key it's being binded to to proceed booting
It's totally normal for a kernel panic to occur, your progress should be saved.