One of the most fascinating topics I have learned about recently in my computer technologies course are operating systems. It really took this course to make me think about things I would have taken for granted before. One example is, I wondered: wait, how does a computer even restart itself? (The answer was anticlimactic: the power is never actually cut during a reboot, the computer just resets its components…)
Anyway, what is an operating system? At a high level, it is a package of software that act as intermediary between the user and the “computer”, i.e. all the software and hardware of a system.
An operating system:
- Is one of the first programs a computer launches when it is started up, after the BIOS begins the boot process. After that, all other programs are launched by the operating system.
- Provides an interface for the user to provide instructions to the computer, either through a GUI and/or a command line interface.
- Typically provides some core applications like a web browser, device drivers, and all those little things that you don’t want to find yourself without when operating a computer.
At the core of the OS (like a piece of popcorn) is the kernel.
For a beginner it can be a little difficult to understand the difference between a kernel and an operating system. The kernel is the most important part of the operating system. The kernel is the thing that takes information from software and executes tasks while managing all the resources to deliver the required actions without crashing the system. It ties together the software with the hardware, and enables the user to control the system. The kernel has complete control over the computer. Technically the kernel is a component of the operating system but it is definitely the main attraction.
When you install a new operation system on a computer, it is likely a reasonably large file. The kernel will actually be quite small, with the “extras” that make up the rest of the OS forming the bulk.
When did operating systems begin?
Before really drilling into this concept, I never would have imagined separating the ideas of an operating system and a computer. But in fact, computers can exist without an operating system. Bombe, the computer that Alan Turing used at Bletchley Park, did not have an operating system. Really, the concept of an operating system only came around during the 1950s when they realized it would be nice if computers didn’t need to constantly have their hands held for every task they execute.
Before then, a computer would need someone to feed it every command and then wait until the computer finished working on it before feeding it more instructions. An operating system, of course, allows for resource management. So introducing one to the early computers meant that the computer could automatically move onto another set of instructions (called a batch) once it finished with one. The introduction of operating systems also allowed computers to share software even when they have different hardware. (CrashCourse, 2018).
The Boot Process
When you start a computer, most people know that this is called a boot-up. “Boot” is short for bootstrapping. The name comes from the fact it is building itself piece by piece. The computer launches one program, which launches another and so on, as the operating system is loaded onto memory to enable operation. When you turn on a computer, the BIOS will kick on. This is a firmware that starts the bootstrapping process. It will look for a kernel on some media, such as a floppy disk or a hard-drive, so it can pass off the boot sequence to the boot loader. For Linux systems, the boot loader is called Grub. The boot loader will then load the kernel into memory, which takes it from there. After the kernel has been loaded, it launches all other programs. See (Raymond, 1998) for more information on the bootstrapping sequence.
Is it possible to delete the kernel, like the "delete system32" gag?
Yes, it is absolutely possible to delete the Linux kernel. As a matter of fact, that is the main topic of this post -- everything else is included only for the purposes of attracting computer scientists who will now be offended by the following.
It is possible to locate the kernel in your file system. After all, the kernel is a computer program just like anything else, and it needs to be stored somewhere so that your computer can load it into memory the next time it boots. The kernel binary is kept in a file called vmlinuz, and it is stored under the /boot directory, alongside Grub files. If you were going to look for a "kernel file", vmlinuz would be the one you want, I'd wager.
Can you delete that file? Yes, but I don't know why you'd ever want to. Deleting it is possible with root permissions, since the root user has complete authority over the computer and doesn't need to ask permission for any action. When you locate the correct version of the vmlinuz file under /boot, it is simple to delete it with the following command:
sudo rm -f <filename>
Do not include the quotes or angle brackets.
The current version of the file will be named "vmlinuz-version-of-kernel". You can find the current version of the kernel you are running with the command:
Nothing will happen immediately if the vmlinuz file is deleted. The kernel is already resident in memory, and deleting a file doesn't change that. The computer, however, needs the vmlinuz file to load the kernel next time it boots, so deleting it will cause the next boot to fail. In most cases, your OS retains a few older kernel versions, so someone would be able to select a previous kernel in the Grub menu to successfully boot into, and then I assume it is a simple matter to install the latest kernel version using dnf. So while you should never need to delete the vmlinuz file, it wouldn't necessarily spell the end of your system if you did.
CrashCourse. “Operating Systems.” June 28, 2018. YouTube video, 13:35. https://www.youtube.com/watch?v=26QPDBe-NB8
Raymond, Eric. “What happens when you switch on a computer?.” October 29, 1998. Accessed November 4, 2020. https://tldp.org/HOWTO/Unix-and-Internet-Fundamentals-HOWTO/bootup.html.