Booting and Shutting Down
- Shutting down:
- Proper shutdown is important (we'll talk more about this
when we cover file systems)
- Bootstrapping (booting)
- what gets done during a boot?
- read the boot loader of the disk's master boot record
- load/init the kernel
- detect/configure devices
- create kernel processes
- Admin intervention if needed (single-user mode)
- Execute startup scripts
- Unix supports a 'run level" (type 'runlevel' to
see current level)
- level 0: shutdown
- level 1: single user mode
- levels 2 - 5 various levels - level 2 is
normal. Other levels might be admin specific.
Details vary on platform.
- level 6 reboot level
- What's up with this? Seems to be based
on historic telecom phone switches supporting a number of
run levels
- boot step 1: we assume the boot loader is GRUB
- Grand Unified Boot Loader
- Config in /boot/grub
- boot steps 2 -6:
- 2: load/init the kernel:
- issue a 'uname -a' to see the exact kernel boot image
- located in /boot
- eventually the init process is created which then starts
other kernel processes.
- 6: startup scripts
- historically /etc/inittab was used for init
configuration, Ubuntu uses upstart (the equivalent to the
init process) and config files in /etc/init.d
- Because there are init files from upstart as well as
from traditional /etc/rc scripts, the command
update-rc.d helps maintain compatibility
For Ubuntu 16.04, runlevels are slightly altered.
- systemd - provides an interface to startup and init of the system
- Try : systemd --test ;should dump the startup sequence but NOT actually run it
- --log-level : sets log level (emerg, alert, ..info, debug
- systemctl - controls systemd system and service mgr
- systemctl -a : shows all loaded modules
- sudo systemctl isolate multi-user.target : switches run level
- To change the default runlevel after a reboot:
- sudo systemctl start graphical.target : switches to GUI mode
- Mapping between older runlevel and updated Target
- 0 --- poweroff.target
- 1 --- rescue.target (single user mode)
- 2,3,4 --- multi-user.target
- 5 --- graphical.target
- 6 --- reboot.target
last update: 2/16/17