Boot vs Startup Commands: What’s the Difference?
Have you ever wondered how Linux boots itself? It's a complicated process. However, if you hope to be a Linux systems engineer, it's a process you need to understand. So, we are going to discuss the Linux boot process in this article at a high level. Likewise, we'll discuss what a boot command is versus a startup command, terminology that is often not used properly. Though, after reading this post you may very well refer to the entire process between pressing the power button on a computer to getting a login screen as booting the computer, you will at least walk away understanding the difference between boot and startup processes.
This post discusses the Linux startup process. Though various Linux distributions might differ to some degree, they all largely work the same way. We'll also be referencing the Grub2 bootloader as the bootloader of choice for this article. Likewise, if Grub is referenced, it will be referencing Grub2 and not the legacy version of Grub, a bootloader that is no longer in development and has largely been deprecated.
The Linux boot process occurs in two stages:
Boot stage
Startup stage
Each of those stages has a couple of phases they work through to complete as well.
The Linux Boot Process
The boot process begins the moment the power button is pressed on a computer. Technically if you reboot a computer, this process still occurs since Linux forces the computer into a powered-down state before re-initiating the boot process. On a side note, due to how modern hardware works, that powered down state during the reboot process doesn't make the computer seem as if it's powered down.
When the computer first powers on, the BIOS takes control. We'll use the term BIOS loosely here. Many computers now use UEFI instead, but the function is the same. The BIOS enumerates the hardware and makes sure the computer can operate. This is typically referred to as the POST process. During this process, the BIOS will make sure the processor is available and working, the RAM is available and working, find storage devices, etc…
After the BIOS confirms the computer is operational, it looks to the primary storage mechanism for the MBR (master boot record). Typically, this is a storage drive on the computer (like a mechanical hard drive or SSD). Most computers do have the option of changing or selecting a default or different boot device, though. This is akin to mashing the function buttons on a keyboard when a computer first starts to select a bootable thumb drive to install an OS.
After the MBR is located, the BIOS loads the bootloader. It's important to note that the MBR is the first couple of sectors on a storage drive and is very small. Nowadays, the MBR doesn't have enough space to hold the entire bootloader. In the case of Linux, the MBR loads the initial pieces of Grub.
As mentioned above, Grub is too large to fit entirely into the MBR. Those initial pieces of Grub that are loaded with the MBR then call the rest of the pieces of Grub that sit in the bit of space after the MBR on the primary storage drive and before the first instance of the primary partition of that drive. These pieces hold enough information to understand how to recognize file system types, how to mount the boot partition for the Linux OS, and where to find the kernels currently installed on the system. At this point, whether through the Grub configuration or active user selection, Grub loads the Linux Kernel.
And this is where the boot process ends.
The Linux Startup Process
The Linux kernel's first job is to start the system manager. For most Linux distributions today, this is Systemd. The Linux kernel is kind of stupid by itself. It has a lot of instructions for making a computer operate but has no idea how to kick off those instructions. That's where Systemd comes in.
Once Systemd is launched, it handles a bunch of different tasks. It's the job of Systemd to mount the rest of the partitions that the computer uses, tell the kernel what filesystems these partitions use, loads the rest of the system drivers, loads cryptographic services, loads the random seed generator, etc… All of these processes are handled concurrently.
Once these processes are done, Linux finally presents the user with the login screen.
Much like the older, deprecated Linux system manager, SystemV, SystemD supports various run states. These run states are:
Poweroff.target: The system is powered down
Emergency.target: This is Single User Mode. No services are running and filesystems are not mounted. This is used for recovery.
Rescue.target: This is similar to the emergency state but mounts the filesystems and starts basic services.
Runlevel2.target: This is a multiuser environment but without NFS or GUIs. This isn't used much.
Multi-user.target: The system is operating normally but without a GUI. This is most common with server OSes.
Graphical.target: This is the same as the multi-user state but includes graphical environments
Reboot.taget
Default.target
Though any of these states can be configured to run at startup, Grub targets the default.target first. The default target is a symbolic link that links to the default state of Systemd. This is typically the multi-user.target or the graphical.target. Each of these states has a different set of instructions and restrictions for Systemd.
After Systemd finishes its job and the user is presented with a login screen, the startup process is finished.
The Linux Boot vs Startup Process
That's it! That's how Linux works from pressing the power button to getting a login screen. To reiterate, the boot process works by:
System powers on
The BIOS is started
The BIOS confirms the computer can operate
The BIOS loads the bootloader from the MBR (GRUB)
The first bits of GRUB loads the rest of GRUB
GRUB loads the kernel
The startup process works by:
The Kernel launches Systemd
Systemd mounts the rest of the drives, partitions, drivers, starts the random seed generator, starts cryptographic services, etc…
The user is prompted to log in
Now you know the difference between the bootup and startup process in Linux. Having a strong understanding of Linux and knowing how to use the OS can be very beneficial. The demand for IT pros with Linux skills has soared in recent years.
delivered to your inbox.
By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.