CentOS 7 Booting and Recovery

At GRUB prompt, edit the boot option and add one of the following options, depended on desired effect:

systemd.unit=rescue.target (Launches recovery shell. Must know root password.)

systemd.unit=emergency.target (Only mounts root filesystem. Must know password.)

init=/sysroot/bin/sh Starts shell, mounts root filesystem, does not need password.

Root password recovery:

boot with rd.break enforcing=0

Mount read-only filesystem as readable: mount –o remount,rw /sysroot

Change recovery shell’s root to newly mounted local filesystem: chroot /sysroot

Change root password with the “passwd” command, as would be done normally.

Set filesystem back to read only: mount –o remount,rw /

Then run exit twice to finish normal booting

Once booted, run “restorecon /etc/shadow” to correct the SELinux context following the password change.

Modify GRUB options by editing /etc/default/grub and running grub2-mkconfig –o /boot/grub2/grub.cfg to install the new config.

How long did the system take to boot? systemd-analyze time

Why did it take so long to boot? systemd-analyze blame

Close Menu