Presentation is loading. Please wait.

Presentation is loading. Please wait.

Booting and boot levels

Similar presentations


Presentation on theme: "Booting and boot levels"— Presentation transcript:

1 Booting and boot levels

2 …The Boot Process Linux uses the init command and a directory structure based on run-levels to start running the system and loading processes 21/04/2017

3 The Initialisation Process…
System States (or run levels) on early UNIX systems grew out of a need to separate how the system ran depending on the maintenance being performed Usually, this meant that to add new hardware (or software) a system reboot was necessary Today, with hot swappable devices, it is not strictly necessary to reboot systems in order to install new hardware or software 21/04/2017

4 …The initialisation Process…
The /etc/inittab file contains settings for the init process and also defines the run levels for a Linux system 21/04/2017

5 /etc/inittab file # Default runlevel. The runlevels used by RHS are:
# halt (Do NOT set initdefault to this) # Single user mode # Multiuser, without NFS (The same as 3, if you do not have networking) # Full multiuser mode # unused # X11 # reboot (Do NOT set initdefault to this) # 21/04/2017

6 init process init is sometimes referred to as the ‘father of all processes’ init is responsible for creating processes from a script stored in /etc/inittab Linux init command is compatible with the System V init command init starts as the last step of the kernel booting init is the first command that initialises and configures the system for use 21/04/2017

7 init process Init works by parsing the /etc/inittab file and by running scripts in the /etc/rc.d directories depending on the required run level Each individual script is designed to start or stop and individual service such as networking, mail, news, web, nfs, dhcp etc. 21/04/2017

8 /etc/rc.d directory The /etc/rc.d directory contains the following files: rc, rc.local, rc.sysinit And the following directories: init.d rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d 21/04/2017

9 Startup Scripts One of the most important scripts in /etc/inttab is rc.sysinit When init parses the inittab file, rc.sysinit is the first script found and executed 21/04/2017

10 rc.sysinit script Sets some initial $PATH variables
Configures Networking Sets up Swapping for Virtual Memory Sets the system hostname Checks root file systems for possible repairs Checks root filesystem quotas Turns on user and group quotas for root file system 21/04/2017

11 rc.sysinit script Remounts the root filesystem read/write
Clears the mounted filesystems table /etc/mtab Enters the root filesystem into mtab Readies the system for loading modules Finds module dependencies Checks filesystems for possible repairs Mounts all other file systems 21/04/2017

12 rc.sysinit script Deletes UUCP lock files
Deletes stale subsystem files Deletes stale pid files Sets the system clock Turns on swapping Initialises the serial ports Loads Modules 21/04/2017

13 rc.local script After the rc.sysinit script is run, init runs the rc.local script to carry out any site-specific operations that may be required upon system startup rc.local may examine the local system and create a message for the login prompt based on the hardware and software versions found If it does, it will put such details in the file /etc/issue which may be displayed on login 21/04/2017

14 Run Level 0: /etc/rc.d/rc0.d Starts the shutdown sequence
Kills All Processes Turns off Virtual Memory File Swapping Unmounts swap and mounted file systems 21/04/2017

15 Run Level 1: /etc/rc,d/rc1.d Single user mode, or administrative state
Used by sys admins while performing software maintenance Nobody else can log in Networking is turned off, but file systems are mounted 21/04/2017

16 Run Level 2: /etc/rc.d/rc2.d Multiuser state
Networking is enabled, NFS is disabled 21/04/2017

17 Run Level 3: /etc/rc.d/rc3.d
Usually the default run level specified as the first line in the /etc/inittab file Remote file sharing is enabled along with all other desired services 21/04/2017

18 Run Level 4: /etc/rc4.d Usually empty, not used
If you want to define your own run level, this can be used to set up the appropriate links 21/04/2017

19 Run Level 5: /etc/rc.d/rc5.d
Similar to the default run level, but with the named (internet DNS server) Usually the default run level for X11 21/04/2017

20 Run Level 6: /etc/rc5.d Reboot run level
Contains links similar to level 0, but logic in the halt script in init.d determines whether the system is being shut down or rebooted 21/04/2017

21 Run Levels… Each run-level is defined by the services (daemons) that are normally running in that level The services to stop and start for each run level are defined in the rcX.d directories mentioned above These directories contain symbolic links to master scripts contained in the /etc/rc.d/init.d directory 21/04/2017

22 …Run Levels… The symbolic links contained in the rcX.d directories must be named so as to start with capital K or capital S For example: rc3.d contains the following symbolic links: K05saslauthd K87portmap S10network S25netfs S80sendmail S95anacron Any other files or symbolic links contained in the rcX.d directories will be ignored by the rc script 21/04/2017

23 …Run Levels… In addition to the inclusion of K or S at the start of the symbolic links, the file names also carry a number between 00 and 99 The combination of K or S followed by a number means that when the files are listed alphabetically, they appear in a particular order This order determines the order in which the scripts are run by the rc script 21/04/2017

24 …Run Levels When a symbolic link beginning with K is encuntered, rc runs that script with the stop parameter When a symbolic link beginning with S is encountered, rc runs that script with the start parameter 21/04/2017

25 /etc/rc/d/init.d directory
This directory contains the master copies of all the scripts that may contain symbolic links in the rcX.d directories 21/04/2017

26 Adding Services to Run Levels
If we want a service to start in a given run level we must: Create or copy the start/stop/status script to the /etc/rc.d/init.d directory Create a symbolic link in the required run level directory to start the script in the appropriate sequence ln -s /etc/rc.d/init.d/isdn /etc/rc.d/rc3.d/S20isdn 21/04/2017

27 Init Specify the run-level to put the machine into 21/04/2017

28 Shutdown shutdown [-krhfnc] [-t secs] time [warning message]
-k: Don’t really shut down, just warn -r: reboot after shutdown -h: halt after shutdown -f: do a ‘fast’ reboot -n: do not go through ‘init’ but go down real fast -c: cancel a running shutdown -t <sec>: delay between warning and kill signal Shutdown –t60 –r now 21/04/2017

29 Halt Notifies the kernel of a shutdown or reboot 21/04/2017

30 Reboot Symbolic link to halt 21/04/2017


Download ppt "Booting and boot levels"

Similar presentations


Ads by Google