Introduction to Linux Init Scripts In this session we will cover the Linux initialization process, run levels, how to change the run level and how to initialize.

Slides:



Advertisements
Similar presentations
Introduction to Linux Linux startup process Unix Shells and scripts.
Advertisements

PC Encryption installation progress/password screen Includes comments from: Encryption team Sarah Deane Tony Stieber Selected people who took part in the.
Booting and Shuting Down WeeSan Lee. Roadmap Bootstrapping Boot Loaders Startup/Init Scripts Reboot & Shutdown Q&A.
Genesis: from raw hardware to processes System booting sequence: how does a machine come into life.
Chapter 9: Understanding System Initialization The Complete Guide To Linux System Administration.
Week 8 System Initialization and X Windows. Objectives  Summarize the major steps necessary to boot a Linux system  Configure the LILO and GRUB boot.
Booting and Shutting Down the UNIX Operating System Arcadio A. Sincero Jr. 6/6/2001 CMSC 691X, Section 6080.
Linux+ Guide to Linux Certification Chapter Nine System Initialization.
Linux can be generally divided into four major components: 1. KERNEL – OS, ultimate boss The kernel is the core program that runs programs and manages.
Linux+ Guide to Linux Certification, Third Edition
U-Boot and Linux Kernel Debug using CCSv5
Hands-on with the Sitara Linux SDK This presentation provides a hands-on overview of the Sitara Linux SDK. It focuses on the software and tools found in.
Chapter 2 Accessing Your System and the Common Desktop Environment.
Starting and Stopping Linux. Boot Process BIOS initializes hardware –Loads the boot sector MBR loads the bootloader –Point to kernel Kernel initializes.
Processes & Daemons Chapter IV / Part III. Commands Internal commands: alias, cd, echo, pwd, time External commands, code is in a file: grep, ls, more.
Va-scanCopyright 2002, Marchany Unit 4 – The Boot Process Randy Marchany VA Tech Computing Center.
System Startup and Shutdown
Guide to Linux Installation and Administration, 2e1 Chapter 6 Using the Shell and Text Files.
Linux Qt Graphical User Interface (GUI) Development In this session, we will cover Qt GUI development tools including: Qt Creator for remote debug and.
Linux Cryptography overview and How-to’s using OpenSSL
NDT Tools Tutorial: How-To setup your own NDT server Rich Carlson Summer 04 Joint Tech July 19, 2004.
Linux Operations and Administration
Introduction to The Linaro Toolchain Embedded Processors Training Multicore Software Applications Literature Number: SPRPXXX 1.
1 Introduction to Tool chains. 2 Tool chain for the Sitara Family (but it is true for other ARM based devices as well) A tool chain is a collection of.
U-Boot Debug using CCSv5 In this session we will cover fundamentals necessary to use CCSv5 and a JTAG to debug a TI SDK-based U-Boot on an EVM platform.
One to One instructions Installing and configuring samba on Ubuntu Linux to enable Linux to share files and documents with Windows XP.
Linux Filesystem Management
Booting and boot levels
System Startup & Shutdown Objectives –to interpret the Unix startup and shutdown configuration files –to be able to create a customised run level Contents.
E X C E E D I N G E X P E C T A T I O N S RUNLEVELS Linux System Administration Dr. Hoganson Kennesaw State University A runlevel is a mode of operation.
1 Linux Basics for Networking. 2 Module - Linux Basics for Networking ♦ Overview This module focuses on the basics of networking using Redhat Enterprise.
Special Project Group 03 Chintan Shah Nisharg Patel Cynthia York.
Agenda User Profile File (.profile) –Keyword Shell Variables Linux (Unix) filters –Purpose –Commands: grep, sort, awk cut, tr, wc, spell.
– Introduction to the Shell 10/1/2015 Introduction to the Shell – Session Introduction to the Shell – Session 2 · Permissions · Users.
Linux Services Muhammad Amer. 2 xinetd Programs  In computer networking, xinetd, the eXtended InterNET Daemon, is an open-source super-server daemon.
Guide to Linux Installation and Administration1 Chapter 4 Running a Linux System.
Connect. Communicate. Collaborate The Installation of RRD Measurement Archive (MA) Roman Łapacz, PSNC 27 th September, 2006 SEEREN2 Summer School, Heraklion.
System Startup & Shutdown
Apache, MySQL and PHP Installation and Configuration Chapter 1 Apache Installation and Configuration.
Unix/Linux cs3353. The Shell The shell is a program that acts as the interface between the user and the kernel. –The shell is fully programmable and will.
Linux Startup Process Presenter: Dipu Gupta.
Linux Security. Module 13 – Linux Security ♦ Overview Linux is more prone today to security loopholes and attacks, both inside and outside the network.
7200 Samsung Confidential & Proprietary Information Copyright 2006, All Rights Reserved. 1/16 OfficeServ 7200 Enterprise IP Solutions Data Server S/W Upgrade.
Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration.
Lesson 3-Touring Utilities and System Features. Overview Employing fundamental utilities. Linux terminal sessions. Managing input and output. Using special.
1 Day 18 Bash and the.files. 2 The.files ls shows you the files in your directory –Or at least most of them. –Some files are hidden. Try: ls –a –This.
System Administration. Logging in as System Administrator System Admin login (aka superuser, aka root) –login id: root –Default PS1 prompt: # –Home directory:
CN2668 Routers and Switches Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
135 Shutdown and Reboot Version A.01 H3064S Module 17 Slides.
Sem 2v2 Chapter 5 Router Startup and Setup. A router initializes by loading the bootstrap, the operating system, and a configuration file. If the router.
Lecture 02 File and File system. Topics Describe the layout of a Linux file system Display and set paths Describe the most important files, including.
Sys Admin Course Service Management Fourie Joubert.
1 Figure 6-5: Turning Off Unnecessary Services Unnecessary Services  Operating system vendors used to install many services by default  This made them.
Agenda The Bourne Shell – Part I Redirection ( >, >>,
System initialization Unit objectives A.Outline steps necessary to boot a Linux system, configure LILO and GRUB boot loaders, and dual boot Linux with.
Agenda Customizing a Unix/Linux account Environment Introduction to Start-up Files (.bash_profile,.bashrc,.profile,.kshrc) Safe Methods for Changing Start-up.
Using Networks. Assignment Issues find syntax Permissions HW4 3c /proc vs /tmp vs /var.
Apache Web Server v. 2.2 Reference Manual Chapter 2 Starting Apache.
System Administration Startup Process. Why Care? ● Every process on your system comes about by following a specific chain of events from the machine startup.
The Linux Kernel About 6 million lines of code
bitcurator-access-webtools Quick Start Guide
Chap-I Network and System Configuration in Linux
Data Server S/W Upgrade Samsung Electronics Co., Ltd.
Router Startup and Setup
Linux Start Sequence Summary
Lab 1 introduction, debrief
SUSE Linux Enterprise Desktop Administration
Linux Shell Script Programming
Router Startup and Setup
bitcurator-access-webtools Quick Start Guide
Presentation transcript:

Introduction to Linux Init Scripts In this session we will cover the Linux initialization process, run levels, how to change the run level and how to initialize a script on login. July 2012 LAB:

2

3 Pre-work Check List  Installed and configured VMWare Player v4 or laterconfigured VMWare Player v4 or later  Installed Ubuntu Installed Ubuntu  Installed the latest Sitara Linux SDK and CCSv5latest Sitara Linux SDK and CCSv5  Within the Sitara Linux SDK, ran the setup.sh (to install required host packages)ran the setup.sh  Using a Sitara EVM, followed the QSG to connect ethernet, serial cables, SD card and 5V power  Booted the EVM and noticed the Matrix GUI application launcher on the LCD  Pulled the ipaddr of your EVM and ran remote Matrix using a web browser  Brought the USB to Serial cable you confirmed on your setup (preferable)

4 Agenda Linux Init Process Linux Run Levels Initialization Directory Init Process Console Log Changing Run Levels Init Script Defaults Running a Process on Login

5 Linux Init Process The last step of the Linux Kernel boot process is to call the user space initilization function “init” –This is one call of several made by the kernel looking for the user space init function - run_init_process("/sbin/init"); (in init/main.c) Is the first User Space application to run that setups the user environment and allows user interaction such as login. Below is a ps (process status) dump from a console, init typically has a PID of 1, first process started. PID USER VSZ STAT COMMAND 1 root 1616 S init [5] /etc/inittab is the script that contains instructions for the init process that sets up and calls other scripts as part of the user space initialization –Sets the run level, this in turn sets which init scripts based on run level are run –Identifier:RunLevel:Action:Command –Based on sysv5init scheme

6 Init Process – inittab example The inittab file is parsed by Init The inittab file contains position dependent –Identifier:RunLevel:Action:Co mmand –Colon is used as a delimiter and is used to comment the line if placed in the first character of the line entry. id:5:initdefault: –Indicates which run level that init is supposed to enter

7 Additional inittab resource links bm.aix.files/doc/aixfiles/inittab.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.i bm.aix.files/doc/aixfiles/inittab.htm

8 Linux Run-Levels From Wikipedia –

9 Initialization Directory (SysV) Initialization Directory /etc/init.d in the root file system All System initialization files are typically stored in this directory. Initialization Directories for the different possible run levels in /etc/ in the root file system. Each run level has its own directory and contains scripts to be executed for that particular run-level.

10 Init process console log Running in Kernel context before this line rcS.d rc5.d – starts here

11 Init Process – rcS.d rcS.d Base Initialization Directory contains several that all are sym linked to initialization directory /etc/init.d These are all executed in the order displayed, if you want to change the order they are executed modify Sxx pre-fix number to the string

12 Run Level Init Directory Files Run Level 5 Init Directory Adding files to this directory are called by init process Alphabetical is the order the scripts are executed in, S10 before S99 S prefix is intended to mean startup, K prefix is intended to mean stoping a service or process, a script used to reset a possible running service. Typically called in Run Level 0 and 6 (halt and reboot) An ls command will list K s first and be executed first. So if the developer wants to make sure that a previous process is stopped before starting a new process using the same resources.

13 Changing Run Levels The default run level can be changed by either: –Passing the desired run level in the kernel bootargs setenv bootargs ${bootargs_def} 3 –Changing the default run level line in /etc/inittab id:3:initdefault: When the system is running you can also change run levels using the “init” command. For example: –To change from run level 3 to run level 5 init 5 –To reboot the system init 6 NOTE: When switching run levels the rc utility will check if there is a Start (or S) script in the previous run level and there is no Kill (or K) script in the current level. To simplify, if you add a start script and the process was already started then it will not be run again

14 Init script defaults Many init scripts use files in the /etc/default directory to provide default settings. For example the /etc/default/rcS file contains settings used by the scripts in the /etc/rcS.d directory. Some examples are: –SULOGIN - whether to prompt for a login before moving to the default run- level. –UTC - whether the system clock is set to UTC time –ENABLE_ROOTFS_FSCK - whether to run fsck on the root file system on boot –FSCKFIX - whether to fix file system errors by default This is useful if you have a series of scripts needing access to the same defaults to avoid duplication of settings

15 Running a Process on Login The set of commands and processes to when a user logs into the system are in the “/etc/profile” file. This file usually sets default values for the PATH and other variables By adding commands to the /etc/profile file you can change what actions are performed on a successful login. Some common examples: –Adding additional directories to the path –Exporting environment variables Likewise additional files ending in.sh in the “/etc/profile.d” directory will be sourced. –This allows abstracting setting and functions to run to individual files rather than lumping everything into the /etc/profile file. –When creating packages you can add any custom setting used for login without having to tell the user how to modify their profile. i.e. TSLIB_TSDEVICE exported to the user’s environment

16 Linux Init Process Links bm.aix.files/doc/aixfiles/inittab.htmhttp://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.i bm.aix.files/doc/aixfiles/inittab.htm introduction-to-services-runlevels-and-rcd-scriptshttp:// introduction-to-services-runlevels-and-rcd-scripts

17 THANK YOU