Skip to content

Reset Root Password

To access a root shell before the scripts that run from the initramfs, follow these steps:

  • Reboot the system.
  • Interrupt the boot loader countdown by pressing any key, except Enter.
  • Move the cursor to the kernel entry to boot.
  • Press e to edit the selected entry.
  • Move the cursor to the kernel command line
  • Append rd.break.
  • Press Ctrl + x to boot with the changes.

The system loads a root shell with the root file system on the disk mounted read-only on /sysroot.

Reset the root password from this point:

mount -o remount,rw /sysroot
chroot /sysroot
passwd root
touch /.autorelabel
exit
exit

By default, the system journals are kept in the /run/log/journal directory, which are cleared when the system reboots.

To store journals in the /var/log/journal directory persistently, set the Storage parameter to persistent in /etc/systemd/journald.conf.

To inspect the logs of a previous boot:

journalctl -b

Summary

Use rd.break on the kernel command-line to interrupt the boot process before control is handed over from the initramfs. The root file system is mounted read-only under /sysroot. Use the emergency.target target to diagnose and fix file system issues.

Command References:

journald.conf, journalctl and systemctl.