360 likes | 502 Views
Class Note:. The Syllabus is available on-line at: http://www.wildbill.org/rose. System Profiles. System Profiles. When a user logs in a system profile is established Set’s environment variables I.e. PATH=/bin;/usr/bin; Set’s alias’s I.e. alias rm ‘rm –i’ alias cp ‘cp –I’
E N D
Class Note: • The Syllabus is available on-line at: http://www.wildbill.org/rose
System Profiles • When a user logs in a system profile is established • Set’s environment variables • I.e. PATH=/bin;/usr/bin; • Set’s alias’s • I.e. alias rm ‘rm –i’ alias cp ‘cp –I’ alias cls ‘clear’
System Profiles • Various system-wide profiles: • /etc/profile (bourne shell) • /etc/bashrc (bash shell) • /etc/tcshrc (c-shell) • User specific profiles (located in home dir) • ~/.profile • ~/.bashrc • ~/.tcshrc
Shell Scripts • A shell script is a group of commands, functions, variables, etc., that can be run from the shell prompt (command line) • Chapter 12 gives an overview of how shell scripts work and can be used: • Automate system chores • Application startup • Even generate web pages • http://www.wildbill.org/rose/spring07.cgi • Those who attend Intro to UNIX should have a reasonable understanding of shell scripts.
Shell Scripts (/etc/init.d/*) • Many of the startup scripts are located in the /etc/init.d directory • Know and understand symbolic links • A symbolic Link is where a file has one main name, but there's an extra entry in the file name table that refers any accesses back to the main name
Symbolic Links • Symbolic links are set up using the ln command with the -s option - so for exampleln -s filename1.txt filename2.txt
Overview • Sequence of booting Linux • Component description • Sequence of shutting down Linux • Conclusion
POST • The principal duties of the main BIOS during POST are as follows: • verify the integrity of the BIOS code itself • determine the reason POST is being executed • find, size, and verify system main memory • discover, initialize, and catalog all system buses and devices • pass control to other specialized BIOSes (if and when required) • provide a user interface for systems configuration • identify, organize, and select which devices are available for booting • construct whatever system environment that is required by the target OS
Bootstrap loader • In computing, booting is a bootstrapping process that starts operating systems when the user turns on a computer system. • A boot sequence is the set of operations the computer performs when it is switched on that load an operating system. • Locate and start boot loader program • ROM BIOS • Look for a boot sector • Boot sector • First sector of the disk • 0xAA55 at byte 0x1FE (510) • byte 510 (last two bytes of the sector) • Load boot sector into memory
Boot loader • Load the operating system into its computer memory from its hard disk • Master Boot Record • Special reserved area • Beginning of the system disk • First stage boot loader • Load and run second stage boot loader • Second stage boot loader • Prompt to choose OS • Loads the kernel of the chosen OS
Boot loader • Two primary Boot loader programs for Linux • LILO (Linux Loader) • GRUB (Grand Unified Boot loader)
LILO • /etc/lilo.conf • Location of kernel • Disk partition to mount as root file system • Map installer • Read configuration file • Write boot loaders, OS info to hard disk
GRUB • Boot time shell • GRUB interactive command prompt • Run new configuration on the fly • Dynamic default configuration • Can use to boot other OS
GRUB • /boot/grub/grub.conf • # general section • splashimage (hd0,0)/grub/splash.xpm.gz • default 0 • timeout 30 • password -md5 encoded-password • title Linux • root (hd0,0) kernel /vmlinuz ro root=/dev/hda2
LILO Traditional Need to be reinstalled in the master boot record after replacing the kernel or changing the boot configuration GRUB Newer Flexible Interactive command prompt Compare LILO and GRUB
Kernel initialization • Checks system hardware • Identifies devices • Kernel • Makes hardware do what the programs want
Kernel Initialization • Probe essential devices • CPU, Console, Memory • Probe other hardware Subsystem • I/O buses, Network interfaces, Hard disks, CD-ROM drives, Floppy drives, Storage devices
Kernel Initialization • File System initialization • Logical volume manager subsystem • RAID • SCSI Devices • Hard disk partitions • Change configuration of kernel • /usr/src/linux/make menuconfig or xconfig • rdev • Boot loader parameter
Init • Location: /sbin/init • Uses functions from libraries written in C • Checks and mounts file system • Starts up daemons to log system messages • Starts the getty processes that put the login prompts on your virtual terminals • Networking • Serves web page • Listen to the mouse
Inittab file • Location: /etc/inittab • xx:levels:action:process • Xx • Label for the entry • Levels • Specific system operating mode • Predefined set of system processes
Run levels in init • 0: Halted system (ready for powering off) • 1: Conversion to/preparation for single user mode • 2: Non-networked multiuser mode • 3: Networked multiuser mode • 4: Networked multiuser mode with graphical login • 6: Reboot mode
Run levels in init • S,s: Single user mode • U,u: Init process re-execution (pseudo run level) • Q,q: Force reread of configuration file (pseudo run level) • a,b,c: On-demand process initialization pseudo run levels
Inittab file • Actions • wait: Start the process and wait for it to finish before going onto the next entry. • once: Start the process only if it is not already running (don't wait). • respawn: Start the process (don't wait) and automatically re-start it if the process later dies.
Inittab file • bootwait: Execute the process only at boot time, waiting for it to finish. • initdefault: Specifies default run level. • ctrlaltdel: Execute the action when the Ctrl-Alt-Del key sequence is detected. • power*: Several keywords are defined for various power failure-related events (see examples below)
Inittab • Program to interpret the initialization script – bash • Script link to other scripts • Several scripts • Initialization script • Run-level script
Initialization script • Initialization script • (Red hat) /etc/rc.d/rc.sysinit • File system get checked and mounted • /etc/fstab • Clock set • Swap space enabled • Hostname
Shutting down sequence • shutdown [-h/r] (warning message) • Logins are blocked • All process are notified that the system is going down by signal SIGTERM • Process to exit cleanly • Signal the init process to change the run level • Default 1, -h flag 0, -r flag 6
Shutting down • unmount -a unmounts all the partitions listed in fstab • shutdown -F = Force fsck on reboot • Journaling file system • saves a transaction log of file system changes • replay when the system is restarted
Acknowledge • Two new links at wildbill.org/rose • http://www.linuxforum.com/linux-introduction/ch04s02.html • http://linux.about.com/library/cmd/blcmdl8_shutdown.htm