Class Note:
description
Transcript of Class Note:
![Page 1: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/1.jpg)
Class Note:Class Note:
The Syllabus is available on-line at: The Syllabus is available on-line at: http://www.wildbill.org/rosehttp://www.wildbill.org/rose
![Page 2: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/2.jpg)
System ProfilesSystem Profiles
![Page 3: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/3.jpg)
System ProfilesSystem Profiles
When a user logs in a system profile When a user logs in a system profile is establishedis established• Set’s environment variablesSet’s environment variables
I.e. PATH=/bin;/usr/bin;I.e. PATH=/bin;/usr/bin;• Set’s alias’sSet’s alias’s
I.e. alias rm ‘rm –i’I.e. alias rm ‘rm –i’alias cp ‘cp –I’alias cp ‘cp –I’alias cls ‘clear’alias cls ‘clear’
![Page 4: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/4.jpg)
System ProfilesSystem Profiles
Various system-wide profiles:Various system-wide profiles:• /etc/profile/etc/profile (bourne shell) (bourne shell)• /etc/bashrc/etc/bashrc (bash shell) (bash shell)• /etc/tcshrc/etc/tcshrc (c-shell) (c-shell)
User specific profiles (located in home User specific profiles (located in home dir)dir)• ~/.profile~/.profile• ~/.bashrc~/.bashrc• ~/.tcshrc~/.tcshrc
![Page 5: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/5.jpg)
Shell ScriptsShell Scripts
A A shell scriptshell script is a group of commands, is a group of commands, functions, variables, etc., that can be run functions, variables, etc., that can be run from the shell prompt (command line)from the shell prompt (command line)
Chapter 12 gives an overview of how shell Chapter 12 gives an overview of how shell scripts work and can be used:scripts work and can be used:• Automate system choresAutomate system chores• Application startupApplication startup• Even generate web pagesEven generate web pages
http://www.wildbill.org/rose/spring07.cgihttp://www.wildbill.org/rose/spring07.cgi
• Those who attend Intro to UNIX should have a Those who attend Intro to UNIX should have a reasonable understanding of shell scripts.reasonable understanding of shell scripts.
![Page 6: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/6.jpg)
Shell Scripts (/etc/init.d/*)Shell Scripts (/etc/init.d/*)
Many of the startup scripts are Many of the startup scripts are located in the located in the /etc/init.d/etc/init.d directory directory
Know and understand Know and understand symbolic linkssymbolic links A A symbolic Linksymbolic Link is where a file has is where a file has
one main name, but there's an extra one main name, but there's an extra entry in the file name table that entry in the file name table that refers any accesses back to the main refers any accesses back to the main namename
![Page 7: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/7.jpg)
Symbolic LinksSymbolic Links
Symbolic links are set up using the ln Symbolic links are set up using the ln command with the -s option - so for command with the -s option - so for exampleexampleln -s filename1.txt ln -s filename1.txt filename2.txtfilename2.txt
![Page 8: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/8.jpg)
System InitializationSystem Initialization
![Page 9: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/9.jpg)
OverviewOverview Sequence of booting LinuxSequence of booting Linux Component descriptionComponent description Sequence of shutting down LinuxSequence of shutting down Linux ConclusionConclusion
![Page 10: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/10.jpg)
Booting SequenceBooting Sequence
![Page 11: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/11.jpg)
POSTPOST The principal duties of the main BIOS during POST The principal duties of the main BIOS during POST
are as follows:are as follows:• verify the integrity of the BIOS code itself verify the integrity of the BIOS code itself • determine the reason POST is being executed determine the reason POST is being executed • find, size, and verify system main memory find, size, and verify system main memory • discover, initialize, and catalog all system buses and discover, initialize, and catalog all system buses and
devices devices • pass control to other specialized BIOSes (if and when pass control to other specialized BIOSes (if and when
required) required) • provide a user interface for systems configuration provide a user interface for systems configuration • identify, organize, and select which devices are available identify, organize, and select which devices are available
for booting for booting • construct whatever system environment that is required construct whatever system environment that is required
by the target OS by the target OS
![Page 12: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/12.jpg)
Bootstrap loaderBootstrap loader
![Page 13: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/13.jpg)
Bootstrap loaderBootstrap loader In computing, In computing, bootingbooting is a is a bootstrappingbootstrapping
process that starts operating systems when process that starts operating systems when the user turns on a computer system. the user turns on a computer system.
A A boot sequenceboot sequence is the set of operations the is the set of operations the computer performs when it is switched on computer performs when it is switched on that load an operating system. that load an operating system. • Locate and start boot loader programLocate and start boot loader program• ROM BIOS ROM BIOS • Look for a boot sectorLook for a boot sector• Boot sectorBoot sector
First sector of the diskFirst sector of the disk 0xAA55 at byte 0x1FE (510)0xAA55 at byte 0x1FE (510) byte 510 (last two bytes of the sector)byte 510 (last two bytes of the sector)
• Load boot sector into memoryLoad boot sector into memory
![Page 14: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/14.jpg)
Boot loader programBoot loader program
![Page 15: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/15.jpg)
Boot loaderBoot loader Load the operating systemLoad the operating system into its into its
computer memory from its hard diskcomputer memory from its hard disk Master Boot RecordMaster Boot Record
• Special reserved areaSpecial reserved area• Beginning of the system diskBeginning of the system disk
First stage boot loaderFirst stage boot loader• Load and run second stage boot loaderLoad and run second stage boot loader
Second stage boot loaderSecond stage boot loader• Prompt to choose OSPrompt to choose OS• Loads the kernel of the chosen OSLoads the kernel of the chosen OS
![Page 16: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/16.jpg)
Boot loaderBoot loader
Two primary Boot loader programs Two primary Boot loader programs for Linuxfor Linux• LILOLILO ( (LiLinux nux LoLoader)ader)• GRUBGRUB ( (GrGrand and UUnified nified BBoot loader)oot loader)
![Page 17: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/17.jpg)
LILOLILO /etc/lilo.conf/etc/lilo.conf
• Location of kernelLocation of kernel• Disk partition to mount as root file Disk partition to mount as root file
systemsystem
Map installerMap installer• Read configuration fileRead configuration file• Write boot loaders, OS info to hard Write boot loaders, OS info to hard
diskdisk
![Page 18: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/18.jpg)
GRUBGRUB
Boot time shellBoot time shell GRUB interactive command GRUB interactive command
promptprompt Run new configuration on the Run new configuration on the
flyfly Dynamic default configurationDynamic default configuration Can use to boot other OSCan use to boot other OS
![Page 19: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/19.jpg)
GRUBGRUB /boot/grub/grub.conf/boot/grub/grub.conf
• # general section # general section • splashimage splashimage
(hd0,0)/grub/splash.xpm.gz(hd0,0)/grub/splash.xpm.gz• default 0 default 0 • timeout 30 timeout 30 • password -md5 password -md5 encoded-passwordencoded-password
• title Linux title Linux • root (hd0,0) root (hd0,0)
kernel /vmlinuz ro root=/dev/hda2 kernel /vmlinuz ro root=/dev/hda2
![Page 20: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/20.jpg)
Compare LILO and GRUBCompare LILO and GRUB LILOLILO
• TraditionalTraditional• Need to be Need to be
reinstalled in the reinstalled in the master boot record master boot record after replacing the after replacing the kernel or changing kernel or changing the boot the boot configurationconfiguration
GRUB GRUB • NewerNewer• FlexibleFlexible• Interactive Interactive
command promptcommand prompt
![Page 21: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/21.jpg)
Kernel InitializationKernel Initialization
![Page 22: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/22.jpg)
Kernel initializationKernel initialization Checks system hardwareChecks system hardware Identifies devicesIdentifies devices
KernelKernel• Makes hardware do what the Makes hardware do what the
programs wantprograms want
![Page 23: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/23.jpg)
Kernel InitializationKernel Initialization
Probe essential devicesProbe essential devices• CPU, Console, MemoryCPU, Console, Memory
Probe other hardware SubsystemProbe other hardware Subsystem• I/O buses, Network interfaces, Hard I/O buses, Network interfaces, Hard
disks, CD-ROM drives, Floppy disks, CD-ROM drives, Floppy drives, Storage devicesdrives, Storage devices
![Page 24: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/24.jpg)
Kernel InitializationKernel Initialization
File System initializationFile System initialization• Logical volume manager subsystemLogical volume manager subsystem• RAIDRAID• SCSI DevicesSCSI Devices• Hard disk partitionsHard disk partitions
Change configuration of kernelChange configuration of kernel• /usr/src/linux/make menuconfig or /usr/src/linux/make menuconfig or
xconfigxconfig• rdevrdev• Boot loader parameterBoot loader parameter
![Page 25: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/25.jpg)
Init programInit program
![Page 26: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/26.jpg)
InitInit Location: Location: /sbin/init/sbin/init Uses functions from libraries written in CUses functions from libraries written in C Checks and mounts file systemChecks and mounts file system Starts up daemons to log system messagesStarts up daemons to log system messages Starts the Starts the gettygetty processes that put the processes that put the
login prompts on your virtual terminalslogin prompts on your virtual terminals NetworkingNetworking Serves web pageServes web page Listen to the mouseListen to the mouse
![Page 27: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/27.jpg)
Inittab fileInittab file
Location: Location: /etc/inittab/etc/inittab xx:levels:action:processxx:levels:action:process XxXx
• Label for the entryLabel for the entry LevelsLevels
• Specific system operating modeSpecific system operating mode• Predefined set of system Predefined set of system
processesprocesses
![Page 28: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/28.jpg)
Run levels in initRun levels in init 00: : Halted system (ready for powering Halted system (ready for powering
off) off) 11:: Conversion to/preparation for single Conversion to/preparation for single
user mode user mode 22:: Non-networked multiuser mode Non-networked multiuser mode 33:: Networked multiuser mode Networked multiuser mode 44:: Networked multiuser mode with Networked multiuser mode with
graphical login graphical login 66:: Reboot mode Reboot mode
![Page 29: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/29.jpg)
Run levels in initRun levels in init SS,,ss:: Single user mode Single user mode UU,,uu:: Init process re-execution Init process re-execution
(pseudo run level) (pseudo run level) QQ,,qq:: Force reread of configuration Force reread of configuration
file (pseudo run level) file (pseudo run level) aa,,bb,,cc:: On-demand process On-demand process
initialization pseudo run levels initialization pseudo run levels
![Page 30: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/30.jpg)
Inittab fileInittab file ActionsActions
• waitwait:: Start the process and wait for it to Start the process and wait for it to finish before going onto the next entry.finish before going onto the next entry.
• onceonce:: Start the process only if it is not Start the process only if it is not already running (don't wait).already running (don't wait).
• respawnrespawn:: Start the process (don't wait) Start the process (don't wait) and automatically re-start it if the and automatically re-start it if the process later dies.process later dies.
![Page 31: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/31.jpg)
Inittab fileInittab file• bootwaitbootwait:: Execute the process only at Execute the process only at
boot time, waiting for it to finish.boot time, waiting for it to finish.• initdefaultinitdefault:: Specifies default run level. Specifies default run level.• ctrlaltdelctrlaltdel:: Execute the action when the Execute the action when the
Ctrl-Alt-Del key sequence is detected.Ctrl-Alt-Del key sequence is detected.• power*power*:: Several keywords are defined Several keywords are defined
for various power failure-related events for various power failure-related events (see examples below)(see examples below)
![Page 32: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/32.jpg)
InittabInittab Program to interpret the Program to interpret the
initialization script – bashinitialization script – bash Script link to other scriptsScript link to other scripts Several scriptsSeveral scripts
• Initialization scriptInitialization script• Run-level scriptRun-level script
![Page 33: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/33.jpg)
Initialization scriptInitialization script Initialization scriptInitialization script
• (Red hat) (Red hat) /etc/rc.d/rc.sysinit/etc/rc.d/rc.sysinit• File system get checked and mountedFile system get checked and mounted
/etc/fstab/etc/fstab
• Clock setClock set• Swap space enabledSwap space enabled• HostnameHostname
![Page 34: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/34.jpg)
Shutting down sequenceShutting down sequence shutdownshutdown [ [-h-h//rr] ] (warning message)(warning message) Logins are blockedLogins are blocked All process are notified that the system is All process are notified that the system is
going down by signal SIGTERMgoing down by signal SIGTERM Process to exit cleanlyProcess to exit cleanly Signal the init process to change the run Signal the init process to change the run
level level • Default 1, -h flag 0, -r flag 6Default 1, -h flag 0, -r flag 6
![Page 35: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/35.jpg)
Shutting down Shutting down unmount -aunmount -a unmounts all the unmounts all the
partitions listed in fstabpartitions listed in fstab shutdown -Fshutdown -F = Force fsck on reboot = Force fsck on reboot
• Journaling file systemJournaling file system saves a transaction log of file system saves a transaction log of file system
changeschanges replay when the system is restartedreplay when the system is restarted
![Page 36: Class Note:](https://reader035.fdocuments.in/reader035/viewer/2022062802/56814499550346895db13f27/html5/thumbnails/36.jpg)
AcknowledgeAcknowledge Two new links at Two new links at wildbill.org/rosewildbill.org/rose http://www.linuxforum.com/linux-introduction/ch04s02.htmlhttp://www.linuxforum.com/linux-introduction/ch04s02.html http://linux.about.com/library/cmd/blcmdl8_shutdown.htmhttp://linux.about.com/library/cmd/blcmdl8_shutdown.htm