2. MARCOS DE REFERENCIA
2.2. GENERALIDADES DEL MUNICIPIO DE GUAPI
2.2.7. Agua potable y saneamiento básico
There are two widely used boot loaders for Linux, namely GRUB and LILO. Both boot loaders are broken into at least two stages. The first stage is a small machine code binary on the MBR. Its sole job is to locate and load the second stage boot loader. The 2nd stage boot loader then locates and loads
the Linux kernel passing in any parameters with which it has been provided.
When the 2nd sage boot loader is running, you are presented with an opportunity to pass additional
parameters to the Linux kernel via a text console that is part of the boot loader. Typical parameters that you may pass to the kernel include:
init – overrides the process that is run by the kernel after it has finished loading.
“init=/bin/bash” is used to bypass the login prompt in cases where the root password had been forgotten. Because this gives access to a root shell, this also highlights why it is important to have good physical access controls to the computer console and why it is a good idea to secure your boot loader with a password. This will prevent users from modifying the boot-time kernel parameters.
root – informs the kernel which device to use as the root filesystem. Often used when
troubleshooting an incorrectly configured boot loader. E.g root = /dev/hda1 tells the kernel to use /dev/hda1 as the root device filesystem rather than what it has been configured to use
noapic/nolapic – tells the kernel not to use the advanced programmable interrupt controller or
local advanced programmable interrupt controller for assigning IRQ and resources. This effectively turns off pnp in the Linux kernel.
noacpi – turns off the advance configuration and power interface capabilities of the Linux kernel.
Often needed in the case of a buggy BIOS.
There are many more parameters that can be passed to the kernel at boot time. Please consult the kernel documentation for more options.
Init Process Overview (SysV init style)
Once the kernel has finished loading it starts the init process. Init is responsible for checking and mounting file systems, and starting up configured services, such as the network, mail and web servers for example, it does this by entering its default runlevel. This is configured in the /sbin/init application configuration file /etc/inittab. An example of the inittab file is given below:
1.# 2.# inittab This file describes how the INIT process should set up 3.# the system in a certain runlevel. 4. 5.id:3:initdefault: 6. 7.# System initialization. 8.si::sysinit:/etc/rc.d/rc.sysinit 9. 10.l0:0:wait:/etc/rc.d/rc 0 11.l1:1:wait:/etc/rc.d/rc 1 12.l2:2:wait:/etc/rc.d/rc 2 13.l3:3:wait:/etc/rc.d/rc 3 14.l4:4:wait:/etc/rc.d/rc 4 15.l5:5:wait:/etc/rc.d/rc 5 16.l6:6:wait:/etc/rc.d/rc 6 17. 18.# Trap CTRLALTDELETE 19.ca::ctrlaltdel:/sbin/shutdown t3 r now 20. 21.# When our UPS tells us power has failed, assume we have a few minutes 22.# of power left. Schedule a shutdown for 2 minutes from now. 23.# This does, of course, assume you have powerd installed and your 24.# UPS connected and working correctly. 25.pf::powerfail:/sbin/shutdown f h +2 "Power Failure; System Shutting Down" 26. 27.# If power was restored before the shutdown kicked in, cancel it. 28.pr:12345:powerokwait:/sbin/shutdown c "Power Restored; Shutdown Cancelled" 29. 30.# Run gettys in standard runlevels 31.1:2345:respawn:/sbin/mingetty tty1 32.2:2345:respawn:/sbin/mingetty tty2 33.3:2345:respawn:/sbin/mingetty tty3 34.4:2345:respawn:/sbin/mingetty tty4 35.5:2345:respawn:/sbin/mingetty tty5 36.6:2345:respawn:/sbin/mingetty tty6 37.# Run xdm in runlevel 5 38.x:5:respawn:/etc/X11/prefdm nodaemon
A line in the inittab file has the following format: id:runlevels:actions:process
•id – 1-4 characters that identify the function,
•runlevels – the runlevels for which the process will be executed,
•action – One of a defined list of events for which the process should be executed or an instruction
to init on what to do when the process is executed. The most commonly used actions are: •wait – init will wait till the process it is starting has completed before continuing,
•respawn – tells init to restart the process whenever it terminates, this is useful for login processes. •CtrlAltDel – this traps the ctrl-alt-delete key combination,
•initdefault – set the default runlevel
•powerfail and powerokwait – are used to respond to notifications from attached UPS devices in the event of power failure and restoration
•process - the command to execute
Line 5 sets the default run level for init. In order to determine the default runlevel the init process
searches for the initdefault entry, if there is no such entry (or no /etc/inittab at all), a runlevel must be entered at the system console. There are 6 run levels. On a RedHat-style system, the default run level is 3 for a server (no GUI) or 5 for a desktop machine.
Line 8 is for the sysinit action, this process is run for every runlevel. Line 10 – 16 define the scripts that should be run for each runlevel.
Line 19, 25, 28 define the processes to be run when the specified actions occur. These actions are:
•Line 19 when ctrl-alt-delete combination is hit, the computer shuts down, ,
•Line 25 when the a signal from the ups on a power outage is received, the computer is told to
shutdown after 2 minutes,
•Line 28 when power is restored and the machine has not shutdown the scheduled shutdown is
canceled.
Line 32-37 spawn the console logins. They are set to automatically restart when the process dies. Line 40 – starts the graphical login console for runlevel 5
After it has spawned all of the processes specified, init goes dormant, and waits for one of three events to happen:- processes it started to end or die, a power failure signal or a request via /sbin/telinit to further change the runlevel.
Init Process Overview (systemd init style)
Systemd is a system and service manager for Linux, backwards-compatible with SysV and LSB init scripts. So it can be installed on any Linux that uses sysvinit or as a replacement.
systemd brings efficiency by providing faster startups by parallelizing processes startup, this is achieved by activating D-Bus(Desktop Bus) which uses Unix domain sockets for inter-process communication, processes are able to run parallel to each other without acknowledging if the daemons they depend on are actually running.
It also offers on-demand starting of daemons and serves as the full-time dynamic resource manager to a running system rather than simply starting the system and then going to sleep until the next reboot as it is with sysvinit.
You will need to tell your kernel to run the init provided by systemd, this is achieved by changing the init kernel parameter to pint to /usr/bin/systemd:
FILE: /boot/grub/grub.cfg . . . title Desktop openSUSE 12.1 3.1.01.2 root (hd0,0) kernel /vmlinuz3.1.01.2desktop root=/dev/sda1 init=/bin/systemd splash=silent quiet showopts vga=0x317 initrd /initrd3.1.01.2desktop
Init Process Overview (upstart init style)
Upstart is an event-based replacement for the/sbin/init daemon which handles starting of tasks and services during boot, stopping them during shutdown and managing them while the system is running. Upstart comes with a set of default jobs which it installs into /etc/init. These are based on the sysvinit configuration of Debian based systems, including running the /etc/init.d/rcscript.