Resetting root password on an Oracle Linux 9 with selinux enforced


Resetting root password on an Oracle Linux 9 with selinux enforced

I’ve found an issue on the procedure documented online in various sites (and chatGPT). And spent some time with it.

Step 1: reboot and press ‘e’ at the boot menu, add ‘rd.break’ at the end of the “linux….” line, and press F10

Step 2: at the prompt type

# mount -o remount,rw /sysroot
# chroot /sysroot
# passwd

and set the new password. Don’t reboot!

Step 3: edit “/etc/selinux/config” and set it to ‘permissive

Step 4: reboot and login with the new password, then issue this command

# fixfiles -F onboot

and reboot (it takes some time)

Step 5: login with the new password and set selinux back to ‘enforcing