Daily Shaarli

All links of one day in a single page.

June 15, 2022

Reset the Root Password on AlmaLinux - Vultr.com

Reset the Root Password on AlmaLinux
Last Updated: Tue, Feb 22, 2022 FAQ Troubleshooting Guides
Using a Different System?

If you are locked out of your AlmaLinux instance and have lost access to the root account, you need to boot into single-user mode and reset the root password.

As the system boots, press ESC to bring up the GRUB boot prompt. The prompt happens early in the boot process. If you miss the prompt, you need to restart the server from the control panel and try again.
At the GRUB boot prompt, press E to edit the first boot option.
Find the kernel line starting with linux.
Change ro to rw init=/sysroot/bin/sh.
Press CTRL+X or F10 to boot into single user mode.
Access the system with the command: chroot /sysroot.
Type passwd and follow the prompts to change the root password.
Run touch /.autorelabel to force file system relabeling. This is required for systems with SELinux. When you reboot the system, it will relabel the filesystem for SElinux. The reboot may take extra time during this process.
Run exit.
Run logout.
Run reboot to reboot the server.