Introduction to Linux Init Scripts

Similar documents
Hands-on with the Sitara Linux SDK

U-Boot and Linux Kernel Debug using CCSv5

Labs instructions for Enabling BeagleBone with TI SDK 5.x

Optimizing Linux Boot Time

Certification. System Initialization and Services

Pengwyn Documentation

Lab 3a Using the vi editor

RHCE BOOT CAMP. The Boot Process. Wednesday, November 28, 12

Runlevels, System Shutdown and Reboot

CSE 265: System and Network Administration

CSE 265: System and Network Administration

The Linux IPL Procedure

System Administration. Startup Process

Booting up and Shutting down A primer for troubleshooting

Authored by: Brian E. Brzezicki Copyright 2013, Paladin Group LLC Reuse without permission is strictly prohibited

CompTIA Linux+/LPIC-1 COPYRIGHTED MATERIAL

Initialization: runlevels

Installing Red Hat Enterprise Linux AS 4 Update 3 on the IBM System p5 185 or IBM Intellistation POWER 185

Advanced Unix System Administration

Basic Shell Commands. Bok, Jong Soon

U-Boot & Linux Kernel Board Port

NETW 110 Lab 3 Post-Installation Configuration Page 1

OPERATING SYSTEMS. Božo Krstajić, PhD, University of Montenegro Podgorica.

HOW LINUX BOOTS. As it turns out, there isn t much to the boot process:

OPERATING SYSTEMS LINUX

Booting Up and Shutting Down. lctseng / Liang-Chi Tseng

Systems Programming/ C and UNIX

In this video, I will be covering DM385 IPNC RDK out of box demo-- Here, I'll be showing flashing the uboot using prebuilt binaries available in RDK--

Remote GUI access to a Linux computer using Tightvnc

ROS-Industrial Basic Developer s Training Class: Linux Basics. Southwest Research Institute Last Updated 2017

The System Boot Process

Chapter 2 Booting Up and Shutting Down

More on file systems, Booting Todd Kelley CST8177 Todd Kelley 1

client X11 Linux workstation

**Note that this must be run from a PC on the same network segment as the NetBotz device, and the NetBotz device MUST be connected to the network.

LPIC 102. be familiar with standard runlevels in a Linux system

Basic UNIX system administration

The Linux Boot Process

Vendor: RedHat. Exam Code: RH133. Exam Name: Red Hat Linux System Administration. Version: Demo

Integrated Lights-Out 3 Virtual Serial Port configuration and operation

Automatically Logging on a User at Linux System Boot time for Console Management

HP-UX System Administration Course Overview. Skills Gained. Who will the Course Benefit?

SmartPath EMS VMA Virtual Appliance Quick Start Guide

Arm Licence Server User Guide. Version 18.0

Installing Altiris Agent on Ubuntu

Console Redirection on VMware ESX Server Software and Dell PowerEdge Servers

Linux/Citrix Virtual Environment Documentation

Booting Up and Shutting Down

D. Delete the /var/lib/slocate/slocate.db file because it buffers all search results.

CS Fundamentals of Programming II Fall Very Basic UNIX

Using grub to Boot various Operating Systems

Please choose the best answer. More than one answer might be true, but choose the one that is best.

CS 215 Fundamentals of Programming II Spring 2019 Very Basic UNIX

More on file systems, Booting Todd Kelley CST8177 Todd Kelley 1

SANOG VI IP Services Workshop: FreeBSD Install

ITEC451 Network Design & Analysis Laboratory Guide: Appendix

Track Two Building an Internet Radio with the TI Sitara AM3517 using LinuxLink

GL-280: Red Hat Linux 7 Update. Course Description. Course Outline

Vmware Workstation Unable To Connect The Usb Device Error Code 13

Unit 2 System startup and shutdown

Working with Ubuntu Linux. Track 2 Workshop June 2010 Pago Pago, American Samoa

Please note that CNE 216 is a brand new course that has never been taught on the George campus; it will be taught for the first time in the fall of

Tizen EFL UTC User Guide

CCNA Discovery Server Live CD v2.0

Automating Linux App Startup

CL030 is a csage Certification Preparatory Course!

Environment Variables

Course 55187B Linux System Administration

CST8177 Linux II. Linux Boot Process

Virtual Machine Support

Oxalis Getting Started

VREDPro HPC Raytracing Cluster

University of Pennsylvania Zachary Goldberg. CIS c. More Kernel Bits. 10/03/09 Slide 1

TROUBLESHOOTING PROCEDURE FOR SYSTEM STALL ISSUES

Installing Nagios Log Server with VMware Workstation Player

Drupal Command Line Instructions Windows 7 Network Drive >>>CLICK HERE<<<

Production Installation and Configuration. Openfiler NSA

SparkGate7 Quick startup guide

This material is based on work supported by the National Science Foundation under Grant No

Power IQ DCIM Monitoring Evaluation Copy A Step-By-Step Guide

Track Two Building an Internet Radio with the TI Sitara AM3517 using LinuxLink

Introduction to Linux start-up. Hao-Ran Liu

Lab X2: PPP Connections (Extra Credit)

StormTracker EMS 2.3 Installation Instructions. Contents. Document Number EMS-A2-GN10-00 July 2002

Enabling DM_Crypt Functionality in SDK release 5.07

The instructions in this document are applicable to personal computers running the following Operating Systems:

How To Configure PowerAlert on Linux with the APC BackUPS Pro 280VA (v2.0, 5Sept2002)

CIS 192 Linux Lab Exercise

Unix Introduction to UNIX

Configuring Ubuntu to Code for the OmniFlash or OmniEP

Kernel Internals. Course Duration: 5 days. Pre-Requisites : Course Objective: Course Outline

Red Hat Operating System Installation Tips

Virtual Machines. Module 2

Environment Variables

Introduction to Virtualization

Sysinstall main menu. Move the cursor down by using the DOWN-ARROW and select Standard.

SANE 2006 Solaris SMF 15/05/06 11:03

SAMA5D3x-CM Instruction to program images with PEEDI

Actual4Test. Actual4test - actual test exam dumps-pass for IT exams

Reset the Admin Password with the ExtraHop Rescue CD

Transcription:

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. LAB: http://processors.wiki.ti.com/index.php/sitara_linux_training:_init_scripts July 2012

Pre-work Check List Installed and configured VMWare Player v4 or later Installed Ubuntu 10.04 Installed the latest Sitara Linux SDK and CCSv5 Within the Sitara Linux SDK, ran the setup.sh (to install required host packages) 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)

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

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

Init Process inittab example The inittab file is parsed by Init The inittab file contains position dependent Identifier:RunLevel:Action:Command 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

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

Linux Run-Levels From Wikipedia http://en.wikipedia.org/wiki/runlevel

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.

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

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

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<script>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.

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 13

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 runlevel. 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 14

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 15

Linux Init Process Links http://en.wikipedia.org/wiki/init_process http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.i bm.aix.files/doc/aixfiles/inittab.htm http://en.wikipedia.org/wiki/runlevel http://www.linux.com/news/enterprise/systems-management/8116-anintroduction-to-services-runlevels-and-rcd-scripts

Thank you 17