Monday, March 27, 2017

RHEL7 - System boot and reboot procedure

Traditional way of rebooting the system

# shutdown –[h/r] [now/30] [ which mean halt or reboot, now or after 30 minutes
# shutdown –h now
Where –h is halt or r for reboot.
Now is time. Or you can specify after 30 minutes

On Redhat 7 based systems, runlevels are replaces by system targets and managed by systemctl
# systemctl halt
# systemctl reboot
# systemctl --nowall poweroff            [no message is sent to the terminal]

Boot systems into different targets manually

Run level equivalent to system targets on RHEL7 based systems.
Runlevel
Target Units
Description
0
runlevel0.target, poweroff.target
Shut down and power off the system.
1
runlevel1.target, rescue.target
Takes you to a rescue shell.
2
runlevel2.target, multi-user.target
Brings system to non-graphical multi-user system.
3
runlevel3.target, multi-user.target
Brings system to non-graphical multi-user system.
4
runlevel4.target, multi-user.target
Brings system to non-graphical multi-user system.
5
runlevel5.target, graphical.target
Brings system to a graphical multi-user system mode
6
runlevel6.target, reboot.target
Shut down and reboots the system.


Check the default target level
# systemctl get-default

Set to a different target level called multiuser system
# systemctl set-default multi-user.target

Change the default target to graphical.gar for GUI based login
# systemctl set-default graphical.target

To switch to non-GUI based target rightaway
# systemctl isolate multi-user.target

Change system to emergency target immediately
# systemctl rescue/emergency
systemctl rescue/emergency

You can run systemctl on remote system as well
# systemclt –H root@remove-host statys httpd

How to recover root password if you forgot

a. Reboot your system whatever way available to you such as pressing power button or login through the console.
b. On splash menu where timer runs, press any key to stop the timer.
c. Press e to edit the highlighted grub boot loader menu
d. Go to the line linux16 and go to the end of the line. The best way is to press CTRL+E key
e. At the end of the line, type  init=/bin/sh or type rd.break
f. Press CTRL-X to boot the system, and you’ll be at the prompt.
g. Now, system is mounted readonly, remount with read/write option

# mount -o remount,rw /
# chroot /sysimage
# touch /.autorelebel

h. Press CTRL+D
i. And reboot the system using reboot at the prompt
j. # reboot


No comments:

Post a Comment