The Linux Boot Process
The Boot Sequence
When a computer starts, the BIOS on the motherboard checks the hardware and input and output devices. If this 'passes' then the boot sequence can begin, usually with GRUB - the Grand Unified Boot Loader. The boot loader then loads up the Linux Kernel. The Linux Kernel then loads an Initial Ram Disk which contains relevant device drivers. It then starts of the Initialization System. At this point the Initialization System starts to mount the File Systems and the Initial Ram Disk is no longer required and is therefore removed.
There are three Initialization systems used by Linux operating systems: init, upstart and systemd.
Init is based off of the Unix System V init system known as systemvinit. Init was designed to initialise services in a serial way, i.e, one after the other. This can be seen as a downside in anything but a fairly simple system. Init is located in /sbin/init and is found by the Kernel after the Initial Ram Disk is removed. At this point init is in control and checks the configuration settings in /etc/inittab. The init process uses this file to establish what Run Level the operating system should be running in.
The Upstart init daemon was first developed for Ubuntu but adopted later by other Linux flavours. Upstart offered advantages over Init in that it was able to start services in parallel which led to a faster boot. Upstart has a second advantage over init in that it is able to react to configuration changes, for example, adding a hard drive. A system change is known as an Event and with Upstart an Event triggers a Job.
When systemd was developed, its chief advantage was removal of shell scripts found in init and partly in upstart. The problem with the utilisation of Bash shell scripts in the other System Managers is that they spawned new processes which referenced library files and this caused a bottleneck in the boot process. Systemd replaced shell scripts with compiled C code which runs much faster and therefore completes the boot quicker. Systemd is, however, backwards compatible (with caveats) with the older SystemV Init scripts.
If you want to add or edit a systemd unit file, you can in the following location:
If you want to view the systemd unit files, run the following command:
edp@ip-172-31-39-32:~$ systemctl list-unit-files
Systemd is still initiated by the Kernel at /sbin/init but this is just a symbolic link to systemd binary that contimues with the boot process.
init -> /lib/systemd/systemd
To determine which System Manager your system is using, run the following command:
ps -p1 | grep "init\|upstart\|systemd"
Kernel Log Messages
The kernel writes logs to the Kernel Ring Buffer but these logs are typically volatile. There are a couple of utilities for looking at the Kernel Logs - dmesg and journalctl -k. The '-k' option states that you want to see Kernel messages. dmesg is typically a legacy utility on systems that use init. Modern linux systems more usually use systemd and journalctl -k is used to query the Ring Buffer.
Jun 29 22:19:09 seeds.xxxxxxxx.org.uk kernel: iptables denied:
[69322123.856917] iptables denied: IN=eth0 OUT