Let's assume we have some FC19 installed. I've taken Live-CD and said it to install, accepting default values.
Less you make changes to GRUB2, more stable it will work. You had not change /boot/grub2/grub.conf file directly. It will be rebuilt by grub2-mkconfig command from templates and overwrite your changes. Templates is the place you can change something. They resides in /etc/grub.d/. Theese templates suits for most cases then should not be changed also. So, where the line with these "rhgb quiet blah-blah-blah" we want to remove ? /etc/default/grub is a right place to change. Once kernel line fixed as desired, then:
# grub2-mkconfig > /boot/grub2/grub.cfg Generating grub.cfg ... Found linux image: /boot/vmlinuz-3.9.5-301.fc19.x86_64 Found initrd image: /boot/initramfs-3.9.5-301.fc19.x86_64.img Found linux image: /boot/vmlinuz-0-rescue-7725dfc225d14958a625ddaaaea5962b Found initrd image: /boot/initramfs-0-rescue-7725dfc225d14958a625ddaaaea5962b.img done [root@localhost grub.d]#
This procedure will tell to systemd boot into "rescue" mode. However it does not suitable for root password recovery, because sulogin will ask for root password during entering to shell.
Break boot sequence by UP/DOWN keys when menu displayed. Select default highligted entry and press e to edit it. A "nano" like editor will display grub2 lines. Scroll down to line starting with "linux blah-blah-blah". Remove "rhgb quiet" and put single or rescue instead.
Give root password for maintenance (or type Control-D to continue):
Another variant for same "rescue" mode, but in very early boot stage (even without mounting /usr, etc., / still in ro mode) is using "emergency" keyword instead of single keyword above. sulogin still in use, therfore it still not usable for root password recovery.
dracut replaced mkinitrd in Fedora/RedHat. It create more powerfull initramfs images. Let's see how we recover root password using it.
Break boot sequence as in previous (GRUB2) chapter. Add rd.break instead of used "single" keyword. A shell will be started just before boot sequence switched to systemd. Pay attention that your root (/) mounted as /sysroot in read only (ro) mode. Remount it read-write:
switch_root:/# mount -o rw,remount /sysroot [ 74.671403] EXT4-fs (dm-1): re-mounted. Opts: data=ordered switch_root:/# chroot /sysroot sh-4.2# passwd Changing password for user root. New password: Retype new password: passwd: all authentication tokens updated successfully. sh-4.2# touch /.autorelabel sh-4.2# exit switch_root:/# exit
There are a lot's of "units" filling /usr/lib/systemd/system directory repalcing what was in /etc/rc.d/rc.sysinit file.
man systemd.special describes "built-in" targets, files resides here. Read it.
Some words about separate /usr. Because of fact that system's start files resides in /usr/lib/systemd/system now, it is impossible boot OS without /usr mounted. Then, developers jump to it and moved binaries back into /usr from /. The solution for separate /usr is that initramfs mounts /usr too, developers even promissing ro mount for /usr supported. But this early mount looks adding more troubles than solving them. The ultimate solution is to forget about /usr separation.
Some windows administrators likes press Ctrl-Alt-Del for some reason. Linux servers reacts for this combination in very unusual for them way, rebooting production servers. Let's disable this behaviour:
[root@localhost system]# pwd /usr/lib/systemd/system [root@localhost system]# ll ctrl-alt-del.target lrwxrwxrwx. 1 root root 13 Jun 27 20:12 ctrl-alt-del.target -> reboot.target [root@localhost system]# rm -f rm ctrl-alt-del.target [root@localhost system]# echo '# /usr/lib/systemd/system/ctrl-alt-del.target disabled. # Usually linked as ctrl-alt-del.target -> reboot.target ' > ctrl-alt-del.target
# systemctl list-unit-files | grep enabled # systemctl disable abrt-ccpp.service abrt-oops.service abrt-uefioops.service abrt-vmcore.service abrt-xorg.service # systemctl stop abrt-ccpp.service abrt-oops.service abrt-uefioops.service abrt-vmcore.service abrt-xorg.service # systemctl list-unit-files | grep disabled # systemctl enable nfs.target # systemctl start nfs.target # systemctl status