Linux CLI HowTo 0 ๐ง Linux Boot Process
0 – HowTos Linux Boot Process
โ How to Check if Your Computer Uses BIOS or UEFI
Why: Knowing this helps you understand how your computer boots and what files are needed.
Steps:
- Open a terminal (press Ctrl+Alt+T)
- Run:
ls -la /sys/firmware/efi/
If you see output, you have UEFI. If not, you likely have BIOS.
Alternative:
sudo dmesg | grep -i efi
๐ How to Find Your Boot Partition (UEFI Only)
Why: This is where the boot files live in modern computers.
Steps:
- Look for the
/boot/efifolder:
ls -la /boot/efi/
- If it exists, that’s your EFI System Partition.
๐ How to See What Operating Systems Are Installed
Why: To see all your boot options and understand what’s on your computer.
Steps:
- At startup, when GRUB menu appears:
- Don’t press anything yet
- You’ll see a list like “Ubuntu”, “Windows”, etc.
- If you want to see it in terminal:
cat /boot/grub/grub.cfg | grep -i menuentry
๐ ๏ธ How to Change Default Boot Option
Why: To make your preferred OS boot automatically.
Steps:
- Edit GRUB settings:
sudo nano /etc/default/grub
- Find line
GRUB_DEFAULT=and change the number or name (e.g.,GRUB_DEFAULT="Ubuntu"). - Update GRUB:
sudo update-grub
๐ฆ How to Check What Kernel Version You’re Running
Why: Shows which Linux version you have installed.
Steps:
- In terminal:
uname -r
Example output might be: 5.4.0-72-generic
๐ง How to See What Files Are in Your Initramfs
Why: To understand what drivers and tools are loaded early in the boot.
Steps:
- List contents:
sudo lsinitrd | head -20
- Or view full content:
sudo lsinitrd | less
๐ How to See What Services Are Starting at Boot
Why: Understand what programs run when your system starts.
Steps:
- Check services that start at boot:
systemctl list-unit-files --state=enabled | head -20
๐ How to Find Your Root Filesystem Location
Why: This tells where the main Linux folder lives on your hard drive.
Steps:
- Check fstab file:
cat /etc/fstab
Look for lines with /dev/sda1 or similar device names.
โ How to Boot from a Different Kernel if Current One Fails
Why: If your current kernel breaks, you can try an older one.
Steps:
- At GRUB menu, press
e(edit) - Find the line starting with
linuxand addrecoveryat the end:
linux ... recovery
- Press Ctrl+X to boot
๐ How to Fix Bootloader Issues
Why: If you can’t boot into your OS anymore.
Steps:
- Boot from a live USB
- Mount your root partition:
sudo mount /dev/sda1 /mnt
- Reinstall GRUB:
sudo grub-install --root-directory=/mnt /dev/sda
๐ Key Files to Remember
| File/Directory | Purpose |
|---|---|
/boot/grub/grub.cfg | Where GRUB finds all OS options |
/boot/vmlinuz | The Linux kernel image |
/boot/initrd.img or /boot/initramfs.img | Temporary root filesystem |
/etc/fstab | Tells where the real hard drive folders are |
/boot/efi | EFI partition needed for UEFI systems |
๐งช How to Make a Boot Menu Change
- Open terminal
- Edit GRUB config:
sudo nano /etc/default/grub
- Change
GRUB_TIMEOUT=5toGRUB_TIMEOUT=10 - Save and exit (Ctrl+O, then Ctrl+X)
- Update GRUB:
sudo update-grub
Now when you restart, the boot menu will wait 10 seconds instead of 5