Operate running Systems Flashcards
multiple ways to reboot a system
# reboot # shutdown -r now # sudo init 6 # telinit 6 # shutdown -r +3 reboot after 3 minutes # shutdown -r 10:35 reboot at 10:35
Multiple ways to shutdown a system
# shutdown -h now # sudo init 0 # sudo telinit 0 # poweroff
Boot Process
- Bios initializes
- Bootloader is then called by the Bios
- Bootloader loads the first kernel image
- Kernel then mounts file systems and starts the appropriate system services.
- The system services finish starting up, and a login screen is presented
BIOS
- Basic Input Output System
- installed on a small chip on the motherboard
- initializes basic peripherals on the system, sets the system clock, and searches for the boot device
- once boot device is detected, the program installed(known as bootloader) is executed
BootLoader(GRUB)
- Default RHEL bootLoader is GRUB
- GRUB loads the first kernel image listed in its configuration file
- Then hands control of the rest of the boot process to the Linux kernel
Kernel boot process
- Kernel detects hardware on the system
- Kernel loads device drivers from its initial RAM file system initramfs-.img
- Mounts the root file system in read only mode
- init is then loaded(starts the init process)
Last stages of startup
- init runs the necessary scripts in /etc/init
- /etc/inittab is read for the default runlevel
- runlevel scripts for the appropriate runlevel are started
- user is presented with a login screen
Runlevels
0, shutdown
1, single: Maintenance level
2. level without some network resources(for example lack of NFS)
3. Multi-user level without graphical interface
4. None
5. Multi-user level with graphical interface
6. reboot
to check current run level
runlevel
to change current run level
# init x # telinit x
Boot into different run level at boot time
Press the letter i when you see the bootloader. At the grub menu press the a key to append an argument to the kernel boot line. Enter argument at the end of the parameter, then press enter.
upstart
- Originally developed for Ubuntu
- replaced the old system V init System
- SysV init started services Sequentially
- Upstart starts services in parallel
- Provides a much faster boot experience
- Review man 5 and man 8 for upstart
init
- init is the first process (PID 1)
- All other processes are child process from init
- /sbin/init
- configuration files for init|upstart are in /etc/init
rcs.conf
- /etc/init/rcs.conf
- Primary script that gets called from Upstart
- first it executes /etc/rc.d/rc.sysinit script
- reads /etc/inittab for default run level
- finally it switches to default runlevel
rc.sysinit
- /etc/rc.d/rc.sysinit
- sets system hostname
- starts networking
- Mounts and checks file Systems
- runs plymouth
- sets SELinux state
- send messages to /var/log/dmesg
Plymouth
provides the progress bar that we see during system bootup
inittab
- /etc/inittab
- Used to be the main script file that init uses during system startup
- it has been demoted with RHEL6 with upstar
- sets the default system runlevel
rc.conf
- /etc/rc.conf
- called by the /etc/init/rcs.conf file, uses default runlevel as set in /etc/inittab
- fires up the scripts located in /etc/rc.d/rcx.d/ (where x is the default runlevel)
some important startup scripts
- /etc/sysconfig/init
- – sets colors for plymouth, determines if single user mode will need a password or not etc.
- /etc/init/tty.conf
- –creates terminals accessed through ctrl + alt + F1 - F6
/etc/rc.d/rcx.d
check which scripts are run in different run level. Replace x for 0 - 6
K vs S before service startup scripts
K is for kill and the S is for start
chkconfig
use chkconfig to start or kill services at startup # chkconfig servicename on # chkconfig servicename off # chkconfig --list servicename check if service name is on or off # chkconfig --level 35 atd on allow a service to start at specific runlevel(3,5)
Cancel schedule shutdown
shutdown -c
top command
display an instantaneous image of a server’s activity
to get details about process
ps -edf
to start a process with a low priority
nice - n 10 ./script.sh