1 / 22

Chapter 2 Booting and Shutting Down

Chapter 2 Booting and Shutting Down. Kim Grempler (Sections 2.0 to 2.3) Leon Dague (Sections 2.4 to 2.7). Bootstrapping. A.k.a. Booting Kernel loaded into memory and executes Initialization tasks performed System available to users Potential Problems when booting

ulf
Download Presentation

Chapter 2 Booting and Shutting Down

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 2Booting and Shutting Down Kim Grempler (Sections 2.0 to 2.3) Leon Dague (Sections 2.4 to 2.7)

  2. Bootstrapping • A.k.a. Booting • Kernel loaded into memory and executes • Initialization tasks performed • System available to users • Potential Problems when booting • Errors in configuration files, missing/unreliable equipment, or damaged filesystems • Boot configuration is first task of system administrator, on new system • Booting is hardware-dependent

  3. Reference Chapters • Chapter 3: Root Account • Chapter 4: The Filesystem • Chapter 7: Devices and Drivers • Chapter 8: Serial Devices • Chapter 9: Installing a Boot program • Chapter 13: Configuring the Kernal • Chapter 31: Daemons

  4. 2 Booting Modes • Automatic • Performs boot without external assistance • Manual • Automatic procedure until initialization scripts are run by operator • Single-user mode: most system processes not running and users unable to log in

  5. Six Steps in Booting Process • Loading and initialization of the kernel • Device detection and configuration • Creation of spontaneous system processes • Operator intervention (single user boot only) • Execution of system startup scripts • Multi-user operation • **Admin. has little control of steps above. Boot configuration via editing system startup scripts**

  6. Step 1: Loading and Initialization of the Kernal • Kernal (e.g., program) is loaded into memory to be executed • Pathname of kernal is vendor dependent • Example: /unix or /vmunix • 2-stage loading process • 1st: small boot program read into memory to enable kernal loading (outside domain of Unix) • 2nd: kernal runs tests to determine memory availability • kernels run in a fixed amount of memory and know what to reserve for internal storage and I/O buffers.

  7. Step 2: Device Detection and Configuration • Kernal performs hardware check • General hardware device info is incorporated in kernal configuration • Locate and initialize each device • Acquire more info via drivers • If not found, will disable hardware • If hardware added, must reboot, to access

  8. Step 3: Creation of Spontaneous System Processes • After basic initialization, kernel creates spontaneous processes in users space • Not created via normal UNIX fork mechanism • fork creates copy of the original process, with new ID, that is identical to the parent • BSD has 3 processes • Swapper - process 0; init - process1; pagedaemon - process 2 • ATT: varies • sched - process 0; init - process 1; various memory handlers • **Note- ONLY INIT USER PROCESS** • Kernal role complete; init handles processes for basic operations and UNIX daemons

  9. Step 4: Operator Intervention (Single-User Boot Only) • init notified via command-line flag from kernel • init creates shell and waits for it to terminate (<control-d> or exit) before continuing on with rest of startup procedure • Always in bourne shell (e.g., sh) and runs as root with root partition mounted • Available programs located in /bin, /sbin, /etc, and /usr; ~ other filesystems must be mounted by operator • Daemons not available • fsck (checks and repairs filesystems) must be run by hand

  10. Step 5: Execution of System Startup Scripts • The location, content, and organization of shell (e.g., sh) scripts vary from system to system • BSD: kept in /etc and names begin with rc • ATT: kept in /etc/init.d with links made to other directories such as /etc/rc0.d, /etc/rc1.d… • Examples of tasks performed in initialization scripts • Set computer name; Set time zone;fsck disk check; • Mount system’s disks; Remove files from /tmp • Configure network interfaces; • Start up daemons and network services; • Turn on accounting and quotas

  11. Step 6: Multi-User Operation • To complete boot process and allow user access, init produces getty process on each workstation • BSD: init has only two states ~ single-user and multi-user • ATT: init has one single-user and several multi-user “run levels” to determine which system resources are enabled

  12. Sample BSD Startup Scripts/etc/rc.boot • First rc script to run is /etc/rc.boot • The first two lines set HOME and PATH environment variables • Executes basic system commands during boot • hostname file in /etc for each network interface • enables IP networking on each interface • Reverse Address Resolution Protocol (RARP) • Find hostname from other machine on NW using hostconfig program and use NFS to mount filesystems • System Administrator intervene to fix problem

  13. Sample BSD Startup Scripts/etc/rc.boot (cont.) • Address or hostname of default Internet gateway is read from /etc/defaultrouter • non-local NW connections up prior to more complicated routing in boot process • /usr filesystem read-only for system check to see if /fastboot exists • Yes: system shut down cleanly~ filesystems in consistent state • No: all filesystems listed in /etc/fstab checked in fsck • If disks check cleanly~ rc.boot runs /etc/rc.single

  14. Sample BSD Startup Scripts/etc/rc.single • Commands in /etc/rc.single are executed at boot time even if not using single mode • Remounts / and /usr filesystems read/write • if not remounted~ system not able to come up • Cleans out /etc/mtabfile and adds entries for / and /usr • was previously mounted but not in mtab file because root filesystem not writable • /usr/kvm mounted~ clean up shared library cache

  15. Sample BSD Startup Scripts/etc/rc.single • /etc/utmp file cleaned out • contains user list of current log ins • tzsetup command sets local time zone & status of daylight savings time (kernal is GMT) • loadkeys command sets keyboard mapping • rc.single exits~rc.boot exits • No problems in autoboot mode the next init process is /etc/rc • If problem~single-user (sh process) on console

  16. Sample BSD Startup Scripts/etc/rc • /etc/rc is the main system startup up script in autoboot after rc.boot • if single-user: rc after shell is terminated • if root filesystems not writable~ rerun rc.single • clean up shared library cache • remove /fastboot file • /etc/passwd file edited ~system crashes • vipw and /etc/rc script make sure password file not destroyed at crash

  17. Sample BSD Startup Scripts/etc/rc (cont.) • Enable quotas • /bin/ps -u cleans out the ps database (status of processes) • /etc/nologin created by shutdown to prevent logins during shutdown • executes rc.local script • swapon -a to make use of all swap partitions listed in etc/fstab • expreserve: looks in /tmp to find files that were edited when system went down

  18. Sample BSD Startup Scripts/etc/rc (cont.) • Start standard system daemons (i.e., lpd,inetd, update, uushed)

  19. Sample BSD Startup Scripts/etc/rc.local • /etc/rc.local contains commands for local system • portmap daemon maps RPC (remote procedure call) service numbers to the NW ports of appropriate servers • NIS (NW info service) Domain Name set from /etc/default domain • set subnet mask of all machines interfaces • default route reset~ if no default routing daemon run • list current configuration of NW interfaces on console

  20. Sample BSD Startup Scripts/etc/rc.local (cont.) • All NFS filesystems mounted • named (server for Domain Name system) maps between hostnames and Internet addresses • Client side NFS daemon run (biod) • syslogd: responsible for managing log messages • save kernel core dump in /var/crash/hostname • Image saved on swap partition~ save image to real filesystem • Clean up temporary mail lock files and start sendmail

  21. Sample BSD Startup Scripts/etc/rc.local (cont.) • Make machine NFS Server if filesystems need to be exported • Daemon to support diskless clients • rpc.statd and rpc.lockd manage advisory locks on NFS filesystems • Start automount daemon • 3rd party vendor install scripts • Appletalk protocol stack started • Licensed software add-ons

  22. Sample ATT Startup Scripts • Leon Continue

More Related