20 troubleshooting grub persistent password reset rd.break

GNU GRUB (short for GNU GRand Unified Bootloader) is a boot loader package from the GNU Project.

when finished in rescue/emergency target modes, run
systemctl reboot
this will bring into normal operation mode
=====================
grub2-mkconfig will create a new configuration based on the currently running system, what is found in /boot, what is set in /etc/default/grub

never touch grub.cfg file manually


[root@localhost system]# grub2-mkconfig -o /boot/grub2/grub.cfg 
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-b249270c260a4b5391e0c516013244aa
Found initrd image: /boot/initramfs-0-rescue-b249270c260a4b5391e0c516013244aa.img
done

below parameters can be modified

[root@localhost system]# cat /etc/default/grub 
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=cl/root rd.lvm.lv=cl/swap rhgb quiet"
GRUB_DISABLE_RECOVERY="true"
[root@localhost system]#
==========================
reset root password

add rd.break to grub after linux16
(in RHEL 6 init=/bin/bash)

ctrl+x to boot

#mount -o remount, rw /sysroot
#chroot /sysroot
#echo newpassword | passwd --stdin root
#touch /.autorelabel
----------
autorelabel file will relabel entire filesystem which will take time
instead of autorelabel we can do the faster option:
1) load SELinux policy using load_policy -i
2) Correct SELinux context type on /etc/shadow: chcon -t shadow_t /etc/shadow
----------
regarding autorelabel:

Next time when you will reboot the system, it will relabel the filesystem for SElinux automatically.
This usually occurs when labeling a file system for SELinux for the first time, or when switching between different types of policy, such as changing from the targeted to the strict policy








Comments

Popular posts from this blog

HAproxy logging

tomcat catalina coyote jasper cluster

NFS mount add in fstab _netdev instead of default | firewall-cmd --list-all