1
 
 

I thought I would next give a shot at writing about the boot process. Ever wondered what the various steps are that take a computer from powered down to full graphical user interaces?

Well the typical order goes something like

Firmware -> Boot loader -> Kernel -> initramfs -> Root Filesystem -> init -> Login/session management -> Desktop

So the first piece of this process is firmware. Firmware is embedded in the computer, and in most circumstances is invisible to an average user. Implementations vary, but its main responsibility is to handle the power on signal and start the bootloader.

Bootloaders are an interesting area of programming and come in many shapes and sizes. For desktop linux, the most common options are things like grub, which gives you a nice menu to choose your kernel and other launch options. Like many other bootloaders grub is installed into an area of memory accessible to most firmware. Grub has to know where the kernel and everything is, so it also keeps a configuration you can manage through grubmkconfig If you like project boards, you'll probably end up more familiar with uBoot which is a less resource intensive loader used in embedded. The bootloader is responsible for finding the Kernel and loading it into memory, along with passing in any needed arguments. This means it has storage drivers and is often reading info out of your /boot folder.

Now we get to the Linux kernel, the heart of our operating system. The kernel is responsible for setting up the root filesystem and creating the framework to run your userspace. The kernel also creates many volatile file structures that don't persist across boots. /proc /sys and /dev being some of the major ones. The kernel is composed of a variety of modules that can be loaded and unloaded for managing different systems and hardware. You can see what is being used on your system with the lsmod command. modprobe and insmod can be used to change some of the configurations currently loaded.

On desktop the most common setup is to use initramfs to begin the next step. That is a shortening of init RAM filesystem. This is a compressed file system that contains utilities for probing hardware and discovering hardware layout that are too complex to handle without specialized programs like RAID filesystems. Initrsmfs is common, but also not entirely necessary. If the kernel can find and understand the root filesystem it can mount it on its own. Even more complex systems can be launched without initramfs, typically through the use of a flattened device tree specifying much of the physical layout of the electronics and the settings needed to bring them up safely on a System on Chip.

Once it is prepared, the kernel or initramfs accesses the root file system and launches init. This program is a part of systemd on most systems, and it follows a tree of dependencies to choose what to start on your system and when. It is responsible for determining when a program is ready and its dependencies are available.

Next up is login/session management. Here is where I will do my best, because I am less certain of some of the terms here. Linux logins are generally shell based. A shell is a program that acts as an interpreter for commands for the kernel. Shells can be interactive or not, and will use different configurations for each. Getty is the classic program for starting shells, and stands for "Get TTY" Once a shell is started it will ask for authentication if it is a login shell, and then run through the commands in .profile to setup variables. Most users won't see this unless they open a terminal, instead entering their authentication into a graphical login like LightDM (Light display manager). That display manager will then start your graphical session!

A graphical session is similar to a login on Windows. When you select a user and enter a password on Windows you are starting "explorer.exe" under your user. On Linux on many new systems this is Wayland, with a compositor like Sway. KDE Plasma uses one called KWin instead, but they have similar responsibilities. On older systems the display is managed by XOrg, with different desktop environments and compositors on top of that. The display manager starts a "session" of your desktop environment, which then sets up your UI and hotkeys. Some desktop environments restore programs opened during your last session, but not all are as feature-full. The variety of desktop experiences offered in Linux is enormous and ranges from desktops similar to Windows with things like Cinnamon, to tiling managers like DWM, and bare bones options like Openbox.

From there you are in your graphical session, and are ready to use your computer! Learning which tools your PC uses can help you figure out where you want to tweak it for different tasks. For many daemons or system services, systemd is the right place to configure. For user programs you can use systemd with userctrl, or your desktop environment. Enjoy tweaking your configuration :)

EDIT: Mint -> Cinnamon, Mint is the distro, cinnamon is the DE

2
 
 

You have 3 ways to support the community

  1. Share the Community with your Friends

  2. Post anything here (about Linux) even if a stupid post

  3. Comment on the already made posts

Thank you for supporting the community

3
 
 

In Linux why have tools that might differ from a distro to a distro

So today I will talk about those tools

  1. ls

ls refers to list directory it useful for seeing your files through the terminal or the tty

Fun fact: Omarchy uses a custom ls

  1. cd

Its made to go from a directory to another like ~/ $ cd Downloads takes you to the downloads folder but Downloads/ $ cd ../ takes you to the directory before you

Fun fact: ./ means current directory

  1. Bash (or sh or zsh or fish)

That's the default shell in most distros It makes you able to use the tools and apps but some Arch users like to use zsh or fish while sh is more older

Fun fact: most initramfs uses ash

  1. grep

Its helpful when you want to see something from a file but you don't need to read the whole file like ~/ $ cat test | grep something

Fun fact | means give output to next command

  1. cat

cat looks at files and gives you the output so ~/ $ cat test shows you what is inside the file

Fun fact: typing cat /dev/urandom will fill your terminal with binary so never try cat /dev/urandom

But actually the userspace tools differs in most distros they use GNU tools while alpine uses busybox or some Linux from scratch systems may use sbase or you could code your tools

I hope you learned something new

4
 
 

Want to run virtual machines on Linux Mint? QEMU with KVM and virt-manager is a great alternative to VirtualBox.

  1. Update your system

Open a terminal and run:

sudo apt update sudo apt upgrade

  1. Install QEMU, KVM, and virt-manager

Run:

sudo apt install qemu-system-x86 qemu-utils libvirt-daemon-system libvirt-clients virt-manager

This installs:

  • QEMU: Emulates virtual hardware and runs virtual machines.
  • KVM: Provides hardware-assisted virtualization on supported Linux systems.
  • libvirt: Manages virtual machines and their resources.
  • virt-manager: A graphical interface for creating and managing virtual machines.
  1. Enable libvirt

Enable and start the libvirt service:

sudo systemctl enable --now libvirtd

Add your user to the relevant groups:

sudo usermod -aG libvirt,kvm "$USER"

Log out and log back in so the group changes take effect.

  1. Check virtualization support

Check whether your CPU exposes virtualization support:

lscpu | grep Virtualization

You can also check whether KVM is available:

ls -l /dev/kvm

If "/dev/kvm" is missing, check whether Intel VT-x or AMD-V is enabled in your firmware settings and whether your system supports KVM.

  1. Launch virt-manager

Open the application menu and search for Virtual Machine Manager, or run:

virt-manager

Choose the local QEMU/KVM connection, then click Create a new virtual machine.

Select an installation ISO, choose your memory and CPU allocation, create a virtual disk, and start the virtual machine.

What about VirtualBox?

VirtualBox can run on Linux Mint, but certain versions may have dependency issues or fail to build their kernel modules after a kernel update. The version in Mint's repositories may not always be compatible with the kernel you're running.

QEMU/KVM with virt-manager is a good alternative, and it integrates naturally with Linux's virtualization stack.

Happy virtualizing!

5
submitted 1 month ago by to c/learninglinux@lemmy.zip
 
 

Here I'm gonna tell you how Linux works From the beginning to the end Step 1: The bootloader Your Firmware opens an app called bootloader (usually in Linux it's grub) then the bootloader uses its config to load the kernel Step 2: the kernel After the kernel is loaded it knows where is your root partition it mounts it as / then runs /sbin/init in most distros /sbin/init is systemd Step 3: the init After the kernel runs the init the init starts the services and listens to shutdown or reboot signals (killing the init makes the kernel panick)