Unit 4 – The Boot Process Randy Marchany VA Tech Computing Center va-scan Copyright 2002, Marchany The Boot Process 4 main phases – Boot Prom – Boot Programs – Kernel – Init va-scan Copyright 2002, Marchany Boot Prom Phase Ensure the HW is working properly. Begin the process of starting Solaris 8. Run POST – Scan the system for installed HW – Run primary diagnostics on everything it finds – Builds the device tree The system banner is displayed when POST is done. – Ethernet address, HW type, Processor type and speed, hostid, memory size va-scan Copyright 2002, Marchany Boot Prom Phase Run the boot command if the environment variable, auto-boot? Is set to true. It looks at the environment variable bootdevice to find the boot drive. It reads the primary boot loader, boot block (bootblk) and executes it. The boot block is always located in sector 1-15 of the boot device. va-scan Copyright 2002, Marchany Boot Command Options -a -s -r -w -v va-scan Interactive boot, system will prompt you Boot into single user or maintenance mode Use after installing new HW Mount / as writable for repair Verbose mode Copyright 2002, Marchany Boot Programs Phase Sole function is to load the secondary boot program, ufsboot, and execute it. ufsboot locates and loads the basic kernel. ufsboot location is encoded in the boot block. va-scan Copyright 2002, Marchany Kernel Phase The kernel is the software that manages access to the OS and hardware resources. Two sections – Platform independent piece called genunix. – Platform dependent piece called unix. ufsboot loads these 2 pieces into memory, starts the kernel and hands control over to it. The kernel uses ufsboot to locate and load modules needed to complete the boot process. Modules are software programs that control a va-scan Copyright 2002, Marchany certain piece of HW. Kernel Phase Main kernel files are located: – /platform/ARCH/kernel – /platform/ARCH/kernel/sparcv9 – Where ARCH is the architecture of the system (uname –i) – Sparcv9 is the directory that contains the 64 bit support. Modules are located in /kernel, /usr/kernel, /platform/ARCH/kernel or /platform/MODEL/kernel (uname –m) va-scan Copyright 2002, Marchany Kernel Phase The kernel then mounts / Reads its config file (/etc/system) and configures itself. This file is read once at boot. If you make changes to it, you must reboot for them to go into effect. Be careful with this file. If you mess it up, you won’t be able to boot. va-scan Copyright 2002, Marchany Init Phase Once the kernel is loaded, it loads and executes the init process. The init phase is the last step in the boot process. Init is the ancestor of all processes that run on the system. Config file is /etc/inittab which describes the run levels and the processes that are to be run as the system transitions from 1 run level to another. va-scan Copyright 2002, Marchany /etc/inittab ID:run level:ACTION:Process ID – 1-4 character string that identifies the entry Run level – run level the system must be to run the process. 0 – halt/shutdown, 1 – single user, 2 – multiuser no network, 3 – multiuser with network, 5 – powerdown, 6 – reboot. Default run level is 3. ACTION – keyword describes how the process is to be run va-scan Copyright 2002, Marchany /etc/inittab ACTION keywords – Sysinit – process is run before the console login prompt is displayed – Initdefault – defines the default run level where the system will operate. Init will cycle through the run levels unitl it reaches this level. – Respawn – defines a process that should be started if it is note currently running. If it terminates, restart it again. – Wait – tells init to wait until this process is finished. va-scan Copyright 2002, Marchany /etc/initab ACTION keywords – Once – process is started when init activate the entry but it is not restarted when it completes. – Boot – process that init begins at boot time. Run only once. PROCESS – th command or script that is to be run when the entry is activated by init. The system run level scripts are started from here. va-scan Copyright 2002, Marchany Run Levels Determine the number of users that can access the system and what is available to those users. There are 8 predefined run levels but you can add your own. Run levels 0, 5, 6 are transition run levels. va-scan Copyright 2002, Marchany Run Level Scripts Each run level is controlled by a run control script (rc script) called /sbin/rcX where X = run level the script controls. These scripts are run by init whenever a new run level is entered. Example: we are at run level 3 and move to run level 1. The /sbin/rc1 script is run. Note: the older run scripts used to be in /etc/rcX va-scan Copyright 2002, Marchany Run Level Scripts /etc/init.d – True location of the service control scripts executed by the /sbin/rcX scripts. – Centralized location, these scripts start or shut down the service on the system. – Name Syntax: Sxxservice or Kxxservice • • • • va-scan S – start (run at boot) K – kill (run at shutdown) Xx – order number the service is started Service – short name for the particular service Copyright 2002, Marchany Run Level Commands init, telinit – change to a new run level shutdown – move to run level 1(S) halt – move to run level 0 reboot – move to run level 6 poweroff – move to run level 5 va-scan Copyright 2002, Marchany Possible Scenarios Modified /etc/system and Use reboot command need to reload it System needs to be shutdown immediately Use halt command Currently in multiuser mode but need to go to maintenance mode Need to shutdown gracefully Use init 1 or telinit 1to transition to maintenance mode Shutdown –i 0 g –300, for example va-scan Copyright 2002, Marchany