resetting root password using GRUB
TL;DR
reboot machine, enter GRUB, ‘e’, add ‘init=/bin/bash’, ‘F10’, ‘mount -rw -o remount /’, passwd
Long story
If you find yourself in a situation where you forgot even a login name to your old linux machine, you can reset the root password if you have acceess to the GRUB when the machine boots up:
- when the GRUB menu shows up, use keyboard arrows to stop the timeout that will boot the machine in few seconds
- press ‘e’ on a keyboard to enter edit mode and find the line specyfing a kernel ‘linux /vmlinuz-…’
- at the end of this line add (with a leading space) ‘init=/bin/bash’
- press F10 key to boot with using just edited configuration
- when in terminal remount root partition with write access using this command ‘mount -rw -o remount /’
- now reset your password with a command ‘passwd’
- reboot the machine, preferably with ‘reboot’ command but it may show the error so.. just kick it manually if there is no other way