Pages

Tuesday, August 1, 2017

Fedora 26 : reset root password .

Although most believe that they know the answer to this question then in Fedora 26 you have to adopt a method other than the classic one.
Start with select the boot line and press e key to edit.
Find the line with linux16 and add this on the end of this row:

rd.break
Press Ctr+x or F10 keys to reboot.
#mount | grep root
#mount -o remount,rw /sysroot
#mount | grep root
#chroot /sysroot/
#passwd root
...
#touch /.autorelabel
#exit
#reboot

Now you can use the new password for user root to login the system.
I try the old way with init=/bin/bash but I got a panic kernel ( maybe is the SELinux performs a complete file system relabel).
Anyway this solve my problem with reset the root password on Fedora 26 Server.

About rd.break, this interrupt the boot process before control is passed from initramfs to systemd.
The disadvantage of this method is that it requires more steps, includes having to edit the GRUB menu, and involves choosing between a possibly time consuming SELinux file relabel or changing the SELinux enforcing mode and then restoring the SELinux security context for /etc/shadow/ when the boot completes.