Skip to content
Author Nejat Hakan
eMail nejat.hakan@outlook.de
PayPal Me https://paypal.me/nejathakan


Installing Ubuntu Linux

Introduction

Welcome to this comprehensive guide on installing Ubuntu Linux. Ubuntu is a popular, user-friendly, and powerful open-source operating system based on the Debian Linux distribution. Developed by Canonical Ltd., Ubuntu is designed for a wide range of users, from beginners to experienced developers and system administrators. Its philosophy revolves around usability, accessibility, security, and a commitment to free and open-source software principles.

What is Ubuntu?

Ubuntu derives its name from an African philosophy meaning "humanity to others" or "I am what I am because of who we all are." This reflects the community-driven nature of its development and its aim to make software accessible to everyone. First released in October 2004, Ubuntu quickly gained popularity due to its ease of use, predictable release cycle (every six months, with Long-Term Support versions every two years), and extensive software repository.

Why Choose Ubuntu?

There are many reasons to choose Ubuntu:

  • User-Friendly:
    Ubuntu's GNOME desktop environment (by default) is intuitive and modern, making it an excellent choice for those new to Linux.
  • Open Source and Free:
    Ubuntu is free to download, use, modify, and distribute. This provides transparency and control over your operating system.
  • Vast Software Availability:
    Ubuntu's Software Center and Advanced Package Tool (APT) provide access to tens of thousands of free applications, from office suites and web browsers to development tools and scientific software.
  • Strong Community Support:
    A large and active global community means help is readily available through forums, Q&A sites (like Ask Ubuntu), and documentation.
  • Security: Ubuntu is built with security in mind, receiving regular updates and patches. Features like AppArmor provide mandatory access control to confine programs' capabilities.
  • Hardware Compatibility:
    Ubuntu supports a wide range of hardware out-of-the-box, and Canonical works with hardware manufacturers to improve compatibility.
  • Versatility:
    Ubuntu is suitable for desktops, laptops, servers, cloud computing, and IoT devices.

Versions of Ubuntu

Ubuntu comes in several flavors and versions:

  • Ubuntu Desktop:
    The most common version, designed for personal computers and laptops. It includes a graphical desktop environment (GNOME by default).
  • Ubuntu Server:
    A streamlined version optimized for server deployments. It typically does not include a graphical interface by default, focusing on performance and stability for hosting applications and services.
  • Ubuntu Flavors:
    Community-maintained versions of Ubuntu that offer different desktop environments (e.g., Kubuntu with KDE Plasma, Xubuntu with XFCE, Lubuntu with LXQt) or are tailored for specific use cases (e.g., Ubuntu Studio for multimedia production).
  • Release Cycles:
    • Standard Releases:
      Published every six months (in April and October) and are supported for nine months with security and maintenance updates. These releases bring the latest features.
    • Long-Term Support (LTS) Releases:
      Published every two years (in April of even-numbered years, e.g., 20.04 LTS, 22.04 LTS). LTS releases are supported for five years on both Desktop and Server, making them ideal for stability and production environments. For critical systems, Extended Security Maintenance (ESM) can further extend this support.

System Requirements

While Linux distributions are generally more lightweight than some proprietary operating systems, modern Ubuntu Desktop versions have specific requirements:

  • Minimum Requirements (for a basic graphical session):
    • 2 GHz dual-core processor or better
    • 4 GB RAM
    • 25 GB of free hard drive space (or USB stick, memory card or external drive)
    • VGA capable of 1024x768 screen resolution
    • Either a CD/DVD drive or a USB port for the installer media
    • Internet access is helpful (for updates and third-party software)
  • Recommended System Specifications (for a smooth experience):
    • 2.5 GHz dual-core processor or better
    • 8 GB RAM or more
    • 50 GB of free hard drive space (SSD highly recommended for performance)
    • Graphics card capable of 1024x768 resolution, with hardware acceleration
    • USB port for installation media
    • Consistent internet access

For Ubuntu Server, the requirements are generally lower, especially for RAM and disk space, as it doesn't typically run a graphical desktop.

Overview of the Installation Process

Installing Ubuntu involves several key stages:

  1. Pre-Installation Preparations:
    Backing up data, downloading the Ubuntu ISO image, creating bootable installation media, and planning disk partitioning.
  2. Booting from Installation Media:
    Configuring your computer to boot from the USB drive or DVD containing Ubuntu.
  3. The Installation Wizard:
    Following the on-screen prompts to select language, keyboard layout, network, installation type (how to partition your disk), time zone, and create a user account.
  4. Post-Installation Steps:
    Updating the system, installing drivers, and customizing your new Ubuntu environment.

This guide will walk you through each of these stages in detail, providing verbose explanations and practical workshops to solidify your understanding.

1. Pre-Installation Preparations

Before you begin the Ubuntu installation, several crucial preparatory steps must be taken to ensure a smooth process and safeguard your existing data. Rushing this phase can lead to data loss or installation difficulties.

Backing Up Your Data

This is the most critical step before making any significant changes to your operating system or disk partitions. If something goes wrong during the installation (e.g., accidental deletion of the wrong partition), having a backup will be a lifesaver.

Importance of Backups

  • Data Protection:
    Your personal files (documents, photos, videos, projects) are invaluable. An OS can be reinstalled, but personal data, once lost, might be irreplaceable.
  • System State Recovery:
    For advanced users, backing up system configurations can save time in restoring a working environment.
  • Peace of Mind:
    Knowing your data is safe allows you to proceed with the installation with less anxiety.

Methods for Backing Up

Choose a method or combination of methods that suits your needs and the amount of data:

  • External Hard Drive/SSD:
    • Pros:
      Large capacity, relatively fast, you have physical control.
    • Cons:
      Can be damaged, lost, or stolen.
    • Process:
      Connect an external drive and copy your important folders (e.g., Documents, Pictures, Music, Videos, Desktop, and any project directories). On Windows, these are typically under C:\Users\<YourUsername>\. On macOS, they are under /Users/<YourUsername>/.
  • USB Flash Drives:
    • Pros:
      Portable.
    • Cons:
      Smaller capacity, easier to lose, slower for large backups. Best for essential documents.
  • Cloud Storage Services:
    (e.g., Dropbox, Google Drive, OneDrive, Mega, pCloud)
    • Pros:
      Accessible from anywhere, off-site (protects against local disasters like fire or theft).
    • Cons:
      Requires internet access, upload times can be long for large amounts of data, potential privacy concerns, subscription costs for significant storage.
  • Network Attached Storage (NAS):
    • Pros:
      Centralized storage for multiple devices, often includes RAID for data redundancy.
    • Cons:
      Higher initial cost, requires some setup.
  • Disk Imaging/Cloning (for entire system backup):
    • Tools like Clonezilla (Linux), Macrium Reflect Free (Windows), or Carbon Copy Cloner (macOS) can create an exact image of your entire hard drive. This is useful if you want to restore your entire previous operating system.
    • Pros:
      Complete system restoration possible.
    • Cons:
      Requires a destination drive at least as large as the used space on the source drive. Can be time-consuming.

Tools for Backing Up

  • Windows:
    • File History:
      Built-in, backs up versions of files in specified libraries and folders.
    • Backup and Restore (Windows 7):
      Older but still functional for creating system images and file backups.
    • Third-party tools: Macrium Reflect Free, EaseUS Todo Backup Free, AOMEI Backupper Standard.
  • macOS:
    • Time Machine:
      Excellent built-in backup utility that creates incremental backups to an external drive.
    • Third-party tools: Carbon Copy Cloner, SuperDuper!.
  • Linux:
    • Déjà Dup:
      Simple, user-friendly backup tool often pre-installed (uses Duplicity backend).
    • Timeshift:
      Focuses on system snapshots (like Windows System Restore or macOS Time Machine for the system).
    • rsync:
      Powerful command-line tool for synchronizing files and directories. Example: rsync -avh --progress /home/youruser/Documents /media/external_drive/backup/
    • BorgBackup, Restic:
      More advanced, deduplicating command-line backup tools.

What to Back Up Specifically:

  • Personal files: Documents, Pictures, Music, Videos, Downloads, Desktop.
  • Application settings: Browser bookmarks/profiles, email client data, specific software configuration files (often in AppData on Windows, ~/Library/Application Support on macOS, or hidden dotfiles/directories in your home directory on Linux).
  • Product keys for paid software (if you plan to reinstall them).

Downloading Ubuntu

Once your data is secure, you need to obtain the Ubuntu installation image.

Official Ubuntu Website

Always download Ubuntu from the official website to ensure you get a legitimate and untampered copy. Navigate to ubuntu.com/download.

Choosing the Right ISO Image

  • Ubuntu Desktop:
    This is what most users will want for a personal computer. You'll usually find the latest standard release and the latest LTS (Long-Term Support) release.
    • LTS Version (e.g., 22.04 LTS, 24.04 LTS):
      Recommended for most users, especially those prioritizing stability and long-term support (5 years of updates).
    • Latest Standard Version (e.g., 23.10, 24.10):
      Offers newer features and software versions but has a shorter support period (9 months). Suitable for users who want the newest technology and don't mind upgrading more frequently.
  • Ubuntu Server:
    If you intend to set up a server. The installation process is text-based and different from the Desktop version. This guide focuses on Ubuntu Desktop.
  • Ubuntu Flavors:
    If you prefer a different desktop environment (KDE, XFCE, LXQt, MATE, Budgie), you can download an official flavor from their respective websites or via the Ubuntu flavors page. The underlying system is still Ubuntu, but the desktop experience and pre-installed applications differ.
  • Architecture:
    For modern computers (last 10-15 years), you will almost certainly need the 64-bit (amd64) version. 32-bit (i386) versions are largely phased out for desktop use.

The downloaded file will be an .iso file, which is a disk image.

Verifying the ISO Image Integrity

Downloading a large file over the internet can sometimes result in corruption. Verifying the ISO image ensures it's complete and an exact copy of the one provided by Canonical. This is done by comparing its checksum (a cryptographic hash) with the official checksums.

  • Find Official Checksums:
    On the Ubuntu download page or a linked "checksums" page, you'll find files like SHA256SUMS or MD5SUMS. These contain lists of filenames and their corresponding checksums.
  • How to Calculate the Checksum on Your Downloaded File:

    • Linux: Open a terminal in the directory where you downloaded the ISO.
      • For SHA256: sha256sum ubuntu-xx.xx-desktop-amd64.iso
      • For MD5: md5sum ubuntu-xx.xx-desktop-amd64.iso
    • macOS: Open Terminal.
      • For SHA256: shasum -a 256 ubuntu-xx.xx-desktop-amd64.iso
      • For MD5: md5 ubuntu-xx.xx-desktop-amd64.iso
    • Windows:
      • Using PowerShell: Get-FileHash ubuntu-xx.xx-desktop-amd64.iso -Algorithm SHA256 | Format-List
      • Using Command Prompt (with CertUtil, built-in): CertUtil -hashfile ubuntu-xx.xx-desktop-amd64.iso SHA256
      • Alternatively, use third-party tools like 7-Zip (which can calculate various hashes) or dedicated checksum utilities like MD5 & SHA Checksum Utility.
  • Compare: The output hash from your command must exactly match the hash listed in the official SHA256SUMS (or MD5SUMS) file for your specific ISO image. If they don't match, your download is corrupted, and you must download it again. Using SHA256 is generally preferred over MD5 as it's more secure against collisions.

Creating Bootable Installation Media

You cannot simply copy the .iso file to a USB drive; you need to "burn" it in a way that makes the drive bootable.

USB Drive vs. DVD

  • USB Drive:
    • Pros:
      Faster installation, reusable, most modern computers can boot from USB, more durable. This is the recommended method.
    • Cons:
      Requires a USB drive (at least 4GB, 8GB+ recommended).
  • DVD:
    • Pros:
      Good if your computer lacks USB boot capability or if you prefer physical media.
    • Cons:
      Slower installation, DVDs are write-once (for DVD-R), many modern laptops lack DVD drives.

Tools for Creating Bootable USB Drives

  • Rufus (Windows):

    • Website: rufus.ie
    • Features:
      Very popular, fast, reliable, offers many options (e.g., partition scheme MBR/GPT, target system BIOS/UEFI).
    • Step-by-Step for Rufus:
      1. Download and run Rufus (it's portable or installable).
      2. Device:
        Select your USB drive from the dropdown. Ensure you select the correct drive, as its contents will be erased.
      3. Boot selection:
        Click "SELECT" and browse to your downloaded Ubuntu .iso file.
      4. Partition scheme:
        • GPT:
          For modern computers using UEFI firmware. This is the most common choice.
        • MBR:
          For older computers using BIOS firmware, or for UEFI systems in CSM (Compatibility Support Module) mode.
        • Rufus usually auto-detects a good setting based on your system, but you can override it if you know your target system's firmware.
      5. Target system:
        • If GPT is selected, "UEFI (non CSM)" is typical.
        • If MBR is selected, "BIOS (or UEFI-CSM)" is typical.
      6. Volume label:
        Can be left as default or changed (e.g., "Ubuntu 22.04").
      7. File system:
        Usually "FAT32" (default) or "NTFS" (for larger ISOs if FAT32 has limitations, though for Ubuntu ISOs FAT32 is fine). Rufus typically handles this correctly.
      8. Cluster size:
        Leave as default.
      9. Click "START".
      10. A warning will appear stating that all data on the USB drive will be destroyed. Confirm by clicking "OK".
      11. Rufus may ask if you want to write in "ISO Image mode" or "DD Image mode". For Ubuntu, "ISO Image mode" is usually recommended and the default. If it offers to download newer versions of Syslinux or GRUB, allow it.
      12. Wait for the process to complete. It will say "READY" when finished.
  • balenaEtcher (Cross-platform: Windows, macOS, Linux):

    • Website: www.balena.io/etcher
    • Features:
      Very simple and user-friendly interface, focuses on safety by preventing accidental drive selection.
    • Step-by-Step for balenaEtcher:
      1. Download, install, and run balenaEtcher.
      2. Click "Flash from file" and select your Ubuntu .iso file.
      3. Click "Select target." Etcher is designed to avoid listing system drives, making it safer. Select your USB drive. Verify it's the correct one.
      4. Click "Flash!"
      5. If prompted by User Account Control (Windows) or for your password (macOS/Linux), provide it.
      6. Etcher will flash the image and then verify it. Wait for completion.
  • dd command (Linux/macOS):

    • Features:
      Powerful command-line tool. Extremely dangerous if used incorrectly, as you can easily wipe the wrong disk. Use with extreme caution.
    • Step-by-Step for dd:
      1. Identify your USB drive:
        • Linux:
          Open a terminal. Use lsblk or sudo fdisk -l. Identify your USB drive (e.g., /dev/sdb, /dev/sdc). Do NOT use partition names like /dev/sdb1. You need the whole device. Ensure it's unmounted: sudo umount /dev/sdx* (replace sdx with your device).
        • macOS:
          Open Terminal. Use diskutil list. Identify your USB drive (e.g., /dev/disk2, /dev/disk3). Ensure it's unmounted: diskutil unmountDisk /dev/diskX (replace diskX with your device).
      2. Execute the dd command:
        • Linux:
          sudo dd bs=4M if=/path/to/your/ubuntu.iso of=/dev/sdx status=progress oflag=sync
          • bs=4M: Sets block size to 4 Megabytes (can speed up the process).
          • if=...: Input file (your ISO).
          • of=...: Output file (your USB device). TRIPLE-CHECK THIS PATH.
          • status=progress: Shows progress (on newer dd versions).
          • oflag=sync: Ensures data is physically written before the command finishes.
        • macOS:
          sudo dd bs=4m if=/path/to/your/ubuntu.iso of=/dev/rdiskX
          • Note rdiskX instead of diskX for raw disk access, which is faster.
          • macOS dd does not have status=progress. You can press Ctrl+T to see progress.
      3. Wait for the command to complete. It will return to the command prompt when done. This can take a while, and there might be no visual progress indicator on older dd versions or macOS without Ctrl+T.

Burning to DVD (if necessary):

  • Most operating systems have built-in ISO burning capabilities.
  • Windows:
    Right-click the .iso file, select "Burn disc image."
  • macOS:
    Right-click the .iso file in Finder, select "Burn Disc Image '[ISO_Name].iso' to Disc..." or use Disk Utility.
  • Linux:
    Use tools like Brasero, K3b, or Xfburn.

Understanding Your System's Firmware

Firmware is low-level software that controls your computer's hardware when it first powers on. Modern computers use UEFI, while older ones use BIOS.

  • BIOS (Basic Input/Output System):

    • The traditional firmware found on older PCs (pre-2010 approximately).
    • Stored on a chip on the motherboard.
    • Initializes and tests hardware (POST - Power-On Self-Test).
    • Loads the bootloader from the Master Boot Record (MBR) of a storage device.
    • Limitations: 16-bit processor mode, limited to booting from disks smaller than 2.2TB (with MBR partitioning), simpler text-based setup utility.
  • UEFI (Unified Extensible Firmware Interface):

    • The modern replacement for BIOS.
    • Advantages:
      • Support for larger hard drives (>2.2TB) through GPT partitioning.
      • Faster boot times.
      • More advanced graphical setup utility with mouse support.
      • Enhanced security features like Secure Boot.
      • CPU-independent architecture and drivers.
      • Boots by loading EFI bootloader files from a dedicated EFI System Partition (ESP).
    • Most computers manufactured since ~2010 use UEFI. UEFI can often include a CSM (Compatibility Support Module) which allows it to emulate a traditional BIOS environment. This is sometimes called "Legacy Mode."

Checking Your Current Firmware Mode (primarily for Windows users preparing for dual boot):

  1. In Windows, press Win + R, type msinfo32, and press Enter.
  2. In the System Information window, look for "BIOS Mode."
    • If it says "UEFI," your system is using UEFI.
    • If it says "Legacy," your system is using BIOS or UEFI in CSM/Legacy mode.

It is highly recommended to install Ubuntu in the same mode as your existing operating system (if dual-booting).
For example, if Windows is installed in UEFI mode, install Ubuntu in UEFI mode. Mixing modes can lead to boot complications. For a new installation on a modern PC, UEFI is the preferred mode.

Secure Boot

  • What it is:
    A UEFI security feature that helps protect the boot process from malware (e.g., rootkits) by ensuring that only signed and trusted software (bootloaders, OS kernels) can run.
  • Implications for Linux:
    • Most major Linux distributions, including Ubuntu, support Secure Boot. Ubuntu's bootloader (Shim and GRUB) is signed by Microsoft, allowing it to work with Secure Boot enabled on most systems.
    • Some third-party drivers (e.g., NVIDIA proprietary drivers, some Wi-Fi drivers) might not be signed initially. During installation of these drivers, a process called MOK (Machine Owner Key) enrollment might be required. This involves creating a password at the driver installation stage and then entering it during a special MOK management screen that appears on the next reboot.
  • Managing Secure Boot:
    • You can usually enable or disable Secure Boot in your UEFI firmware settings.
    • If you encounter issues booting the Ubuntu installer or the installed system, temporarily disabling Secure Boot can be a troubleshooting step. However, for Ubuntu Desktop, it's generally recommended to keep it enabled if possible and handle MOK enrollment for any necessary third-party drivers.

Preparing Your Hard Drive

This involves understanding how disks are organized and making space for Ubuntu.

Understanding Disk Partitions

A hard drive (HDD or SSD) can be divided into one or more sections called partitions. Each partition can be treated as a separate logical disk and can hold a different filesystem or operating system.

  • Primary Partitions:
    The main divisions of a disk.
  • Extended Partition (MBR specific):
    With the older MBR partitioning scheme, you are limited to 4 primary partitions. To overcome this, one primary partition can be designated as an "extended partition."
  • Logical Partitions (MBR specific):
    The extended partition can then be subdivided into multiple logical partitions.
  • GPT Scheme:
    The newer GPT partitioning scheme does not have this distinction and directly supports many more partitions (typically 128 by default) without needing an extended/logical structure.

Partitioning Schemes: MBR vs. GPT

  • MBR (Master Boot Record):

    • Used with traditional BIOS firmware.
    • Partition table is stored in the first sector of the disk along with boot code.
    • Limitations:
      • Maximum disk size of 2.2 TB.
      • Maximum of 4 primary partitions, or 3 primary + 1 extended (which can contain multiple logical partitions).
    • Susceptible to corruption as the partition table is in one place.
  • GPT (GUID Partition Table):

    • Used with UEFI firmware. GUID stands for Globally Unique Identifier.
    • Advantages:
      • Supports disks larger than 2.2 TB (effectively unlimited for current technology).
      • Supports up to 128 partitions by default on Windows (more on other OSes).
      • More robust: Stores multiple copies of the partition table (primary and backup) and uses CRC32 checksums to detect corruption.
      • Includes a "protective MBR" for compatibility, to prevent MBR-only utilities from misinterpreting or damaging a GPT disk.
    • Required for UEFI boot.

Your system's firmware mode (BIOS or UEFI) dictates which partitioning scheme you should use for the boot disk.

  • UEFI systems require GPT for the OS disk.
  • BIOS systems require MBR for the OS disk.
  • If you are unsure, and your system is reasonably modern (last 5-7 years), it's likely UEFI and will use GPT. The Ubuntu installer usually handles this correctly.

Freeing Up Space for Ubuntu

If you plan to install Ubuntu alongside an existing OS (like Windows), you need to create unallocated (free) space on your hard drive.

  • Using Windows Disk Management (for dual-boot with Windows):

    1. In Windows, right-click the Start button and select "Disk Management."
    2. You'll see a list of your disks and their partitions. Identify the partition you want to shrink (usually your C: drive).
    3. Right-click the partition and select "Shrink Volume..."
    4. Enter the amount of space to shrink by in MB (1 GB = 1024 MB). For Ubuntu Desktop, aim for at least 25GB, but 50GB-100GB or more is better if you have the space, especially if you plan to install many applications or have a separate /home partition.
    5. Click "Shrink." This will create "Unallocated space" on your drive. The Ubuntu installer will detect and use this space.
    6. Note: Windows Disk Management might not be able to shrink a partition as much as you want if there are "unmovable files" (like page file, hibernation file, or system restore points) located in the middle of the space you're trying to free up. You might need to temporarily disable hibernation (powercfg /h off in an admin command prompt), system protection, and disk defragmentation, then try shrinking again. Sometimes, a third-party partitioning tool (like GParted, booted from a live USB) can offer more flexibility.
  • Using GParted (from Ubuntu "Try Ubuntu" live environment):

    • GParted is a powerful partition editor. It's included in the Ubuntu live environment.
    • If you boot into "Try Ubuntu," you can launch GParted to modify partitions before starting the installation. This is useful if Windows Disk Management is too restrictive or if you're managing partitions on a Linux-only system.
    • Caution: Be very careful with GParted. Modifying partitions can lead to data loss if done incorrectly. Always ensure your data is backed up.

Planning Your Partition Layout (especially for "Something Else" installation type)

When you install Ubuntu, you'll have choices for how your disk is partitioned. While the installer offers automatic options, understanding manual partitioning gives you more control. Here are common partitions you might create:

  • / (Root Partition):

    • This is the top-level directory of the Linux filesystem hierarchy. All other directories and files reside under root.
    • Essential.
    • Filesystem:
      Typically ext4 (default, stable, robust), or Btrfs (for advanced features like snapshots).
    • Size:
      • Minimum: ~15-20GB for a basic system.
      • Recommended: 30-50GB or more if you install many applications. Software is installed here.
      • If /home is not separate, the root partition needs to be much larger to accommodate user data as well.
  • /home (Home Partition):

    • This partition is for user data: documents, downloads, pictures, application settings, etc. Each user gets a subdirectory here (e.g., /home/username).
    • Highly Recommended to be separate.
    • Benefits of a separate /home:
      • Data Preservation:
        If you reinstall or upgrade Ubuntu, you can format the root partition (/) and re-use your existing /home partition without losing your personal files and settings.
      • Different Filesystem:
        You could use a different filesystem for /home if desired (though typically ext4 or Btrfs is fine for both).
      • Quota Management:
        Easier to manage disk space if user data is separate from system files.
    • Filesystem: Typically ext4 or Btrfs.
    • Size:
      Depends on your needs. Allocate the majority of your remaining free space here if you store lots of media files, documents, etc. (e.g., 50GB to several hundred GB or more).
  • swap (Swap Space):

    • Virtual memory for when your RAM is full. The system can move inactive pages from RAM to swap to free up RAM for active processes.
    • Also used for hibernation (suspend-to-disk), where the entire contents of RAM are saved to swap before powering off.
    • Two forms:
      • Swap Partition: A dedicated partition for swap.
      • Swap File:
        A file on an existing filesystem (e.g., on /) used as swap. Modern Ubuntu installers often default to a swap file if you don't manually create a swap partition, as it's more flexible to resize.
    • Size:
      • No Hibernation:
        • If RAM < 2GB: Swap = 2 x RAM size.
        • If RAM = 2GB-8GB: Swap = RAM size.
        • If RAM > 8GB: Swap can be smaller (e.g., 4GB, or sqrt(RAM)), or even optional if you have a lot of RAM (e.g., 32GB+) and don't run memory-intensive applications that exceed RAM. However, some recommend a small swap even with lots of RAM for specific kernel behaviors.
      • With Hibernation:
        Swap space (partition or file) must be at least the size of your RAM, preferably slightly larger (e.g., RAM + 10% or RAM + sqrt(RAM)) to be safe.
    • If creating a swap partition manually, no filesystem type is chosen; it's just designated as "swap area."
  • /boot (Boot Partition - Optional for most modern setups, but sometimes needed):

    • Contains the Linux kernel, initramfs image, and bootloader configuration files (GRUB).
    • Usually NOT needed as a separate partition if / is on a standard filesystem like ext4 or XFS and you are not using full disk encryption with LVM, or certain complex RAID setups. GRUB can read these filesystems.
    • When it MIGHT be needed or beneficial:
      • If your / (root) partition is on LVM (Logical Volume Management) and you want GRUB to be simpler.
      • If your / (root) partition uses a filesystem GRUB cannot read (rare nowadays for common choices).
      • If you are using full-disk encryption for / (except for /boot itself, which must remain unencrypted to boot).
      • Some older BIOS systems or specific configurations might benefit.
    • Filesystem: ext4.
    • Size: 500MB to 1GB is usually more than enough (to hold multiple kernel versions).
  • /boot/efi (EFI System Partition - ESP):

    • Required if your system uses UEFI firmware. This is where EFI bootloaders for all installed operating systems are stored.
    • Must be formatted as FAT32.
    • Mount point: /boot/efi.
    • Size:
      Typically 100MB to 550MB. The Ubuntu installer often suggests around 500MB. If you are dual-booting with Windows, Windows will have already created an ESP. You should use the existing ESP and tell the Ubuntu installer to mount it at /boot/efi. Do NOT format the existing ESP if it contains a Windows bootloader.
    • Flags:
      Must be marked as "EFI System Partition" (or have the "boot" and "esp" flags set in GParted).

Summary of Partition Planning for a typical UEFI system with separate /home:

  1. EFI System Partition (ESP):
    FAT32, 500MB, mount point /boot/efi. (Use existing one if dual-booting).
  2. Root Partition (/):
    ext4, 30-50GB+, mount point /.
  3. Home Partition (/home):
    ext4, (most of the remaining space), mount point /home.
  4. Swap:
    Either a swap partition (size based on RAM and hibernation needs) or rely on the installer to create a swap file (if you don't plan to hibernate or will configure it later).

This detailed planning is primarily for the "Something else" installation option. If you choose "Erase disk and install Ubuntu" or "Install alongside," the installer automates much of this.

Workshop Pre-Installation Preparations

Let's put some of this theory into practice.

Project 1: Create a Bootable Ubuntu USB Drive and Verify Its Integrity

Objective:

To safely create a bootable USB drive with the latest Ubuntu LTS version and confirm the ISO used was not corrupted.

You will need:

  • A computer with internet access.
  • A USB flash drive (at least 4GB, 8GB+ recommended). This drive will be erased.
  • Access to the tools mentioned (Rufus for Windows, balenaEtcher for cross-platform, or dd for Linux/macOS).

Steps:

  1. Backup Your USB Drive (if it has important data):
    Before proceeding, copy any important files from the USB drive you intend to use to a safe location. This process will erase the USB drive.
  2. Download Ubuntu Desktop LTS:
    • Go to ubuntu.com/download/desktop.
    • Download the latest LTS version (e.g., Ubuntu 22.04.x LTS or 24.04.x LTS). Choose the 64-bit version.
  3. Download Checksum Information:
    • On the Ubuntu downloads page (or by navigating to releases.ubuntu.com/<version_number>/), find the SHA256SUMS file.
    • Open this file (it's a text file) and find the line corresponding to the exact ISO filename you downloaded. Copy this SHA256 hash string. For example: e5b72e9cfe209a2699941a8040f632a53f00685ca8140080017f232dda967a91 *ubuntu-22.04.3-desktop-amd64.iso
  4. Verify the ISO Image Integrity:
    • Windows (PowerShell):
      1. Open PowerShell.
      2. Navigate to the directory where you saved the ISO: cd C:\Path\To\Your\Downloads
      3. Run: Get-FileHash your-ubuntu-filename.iso -Algorithm SHA256
      4. Compare the displayed Hash value with the one you copied from the SHA256SUMS file. They must match exactly.
    • macOS (Terminal):
      1. Open Terminal.
      2. Navigate to the directory: cd /Path/To/Your/Downloads
      3. Run: shasum -a 256 your-ubuntu-filename.iso
      4. Compare the output with the official hash.
    • Linux (Terminal):
      1. Open a terminal.
      2. Navigate to the directory: cd /path/to/your/downloads
      3. Run: sha256sum your-ubuntu-filename.iso
      4. Compare the output with the official hash.
    • If hashes don't match:
      Your ISO is corrupted. Delete it and download it again. Repeat the verification.
  5. Create the Bootable USB Drive (using balenaEtcher as an example, as it's cross-platform and user-friendly):
    1. Download and install balenaEtcher from www.balena.io/etcher.
    2. Insert your USB flash drive.
    3. Launch balenaEtcher.
    4. Click "Flash from file" and select the verified Ubuntu .iso file.
    5. Click "Select target" and carefully choose your USB drive. Ensure it's the correct drive.
    6. Click "Flash!"
    7. Grant administrative privileges if prompted.
    8. Wait for balenaEtcher to complete the flashing and verification process. This may take several minutes.
  6. Safely Eject: Once completed, close balenaEtcher and safely eject the USB drive.

You now have a verified, bootable Ubuntu installation USB drive.

Project 2: Analyze Your Current Disk Setup (if planning dual-boot with Windows) and Plan a Partitioning Scheme

Objective:

To understand your current disk layout (if using Windows) and devise a manual partitioning plan for an Ubuntu dual-boot installation. This is a planning exercise.

You will need:

  • Access to a Windows machine (if you intend to dual-boot with Windows).

Steps (for Windows users):

  1. Open Disk Management:
    • Right-click the Start button.
    • Select "Disk Management."
  2. Identify Your Main Disk:
    Usually "Disk 0". Note its total capacity and current partitions.
  3. Observe Key Partitions:
    • EFI System Partition (ESP):
      Look for a small partition (100-500MB) labeled "EFI System Partition," usually formatted as FAT32. Note its size. This is where Windows boot files reside. You will share this with Ubuntu.
    • Microsoft Reserved Partition (MSR):
      A small partition (e.g., 16MB-128MB) used by Windows. Do not touch this.
    • Windows OS Partition (C: drive):
      This is your main Windows partition, typically formatted as NTFS. Note its current size and used space.
    • Recovery Partition(s):
      Windows often creates one or more recovery partitions. It's generally best to leave these untouched if possible.
  4. Determine Firmware Mode:
    • Press Win + R, type msinfo32, press Enter.
    • Find "BIOS Mode." If it's "UEFI," you'll be using GPT and the existing ESP. If "Legacy," you'll be using MBR.
  5. Plan Free Space:
    • Decide how much space you want to allocate for Ubuntu (e.g., 100GB).
    • In Disk Management, right-click your C: drive and select "Shrink Volume..."
    • See the "Total size after shrink in MB." In "Enter the amount of space to shrink in MB," enter your desired amount for Ubuntu (e.g., 102400 for 100GB).
    • Do not click "Shrink" yet if you are just planning.
      Simply observe if Windows allows you to shrink by that amount. If not, consider what might be preventing it (unmovable files) and how much it does allow.
  6. Devise Your Ubuntu Partition Plan: Assuming your system is UEFI and you have successfully freed up, say, 100GB of unallocated space:

    • EFI System Partition (ESP):
      • Action: Use existing one.
      • Mount Point: /boot/efi
      • Format: Do NOT format.
    • Root Partition (/):
      • Size: 30 GB (30720 MB)
      • Filesystem: ext4
      • Mount Point: /
    • Home Partition (/home):
      • Size: 65 GB (66560 MB) (This uses 100GB - 30GB - 5GB for swap as an example)
      • Filesystem: ext4
      • Mount Point: /home
    • Swap Partition:
      • Size: 5 GB (5120 MB) (Assuming 4GB RAM and you might want hibernation, or just a comfortable swap. Adjust based on your actual RAM).
      • Type: linux-swap

    Write this plan down. This will be your guide if you choose the "Something else" installation method. If you have less space, you'll need to adjust these numbers. For example, with only 50GB, you might do: / = 25GB, /home = 22GB, swap = 3GB (or opt for a swap file automatically created by the installer if not creating a swap partition).

This planning exercise familiarizes you with your system's layout and the decisions you'll face during installation.

2. Booting from Installation Media

Once you have prepared your bootable Ubuntu USB drive (or DVD), the next step is to instruct your computer to boot from this media instead of its internal hard drive. This will load the Ubuntu installer or the "Try Ubuntu" live environment.

Accessing the Boot Menu or BIOS/UEFI Settings

When your computer first powers on, it performs a Power-On Self-Test (POST) and then looks for a bootable device according to a predefined boot order (usually the internal hard drive is first). You need to intercept this process to select your USB drive.

Common Keys to Access Boot Options:

The key to press varies by manufacturer and model. It's usually displayed briefly on the screen when you power on your computer (e.g., "Press F12 for Boot Menu," "Press DEL for Setup"). You need to press this key quickly and repeatedly as soon as you power on the PC.

Common keys include:

  • Boot Menu:
    • F12: (Most common) Dell, Acer, Lenovo, Toshiba, HP (some models)
    • F10: HP (some models)
    • F9: HP (older models)
    • Esc: ASUS, HP (some models), Sony
    • Option Key (⌥): Apple Macs (when booting from external media, hold it down after the chime)
  • BIOS/UEFI Setup Utility:
    • Del (Delete): (Most common) ASUS, Gigabyte, MSI, ASRock, many custom-built PCs
    • F2: Acer, Dell (some models), Lenovo (some models), Samsung
    • F1: Lenovo (ThinkPads)
    • F10: HP (some older models, sometimes for setup)
    • Esc: Some older systems or specific motherboards.

Procedure:

  1. Insert the Bootable Media:
    Make sure your Ubuntu USB drive is plugged into a USB port (preferably a USB 2.0 port if you encounter issues with USB 3.0 during boot, though this is rare on modern systems). If using a DVD, insert it into the DVD drive.
  2. Power On or Restart Your Computer:
  3. Press the Key:
    As soon as the manufacturer's logo appears, start pressing the appropriate key (F12, Esc, Del, F2, etc.) repeatedly until the Boot Menu or BIOS/UEFI Setup Utility appears.
    • If you access the Boot Menu:
      • This menu allows you to select a boot device for the current session only.
      • Look for an option that lists your USB drive. It might be identified by its brand name (e.g., "Kingston DataTraveler," "SanDisk Cruzer") or as a generic "USB HDD," "USB Storage Device," or "Removable Device."
      • If your system is UEFI-based, you might see two entries for your USB drive: one with "UEFI:" prefix (e.g., "UEFI: SanDisk") and one without (e.g., "SanDisk"). Choose the UEFI entry if your system is set to UEFI mode (which is recommended). If your system is in BIOS/Legacy mode, choose the non-UEFI entry.
      • Use the arrow keys to highlight your USB drive and press Enter to boot from it.
    • If you access the BIOS/UEFI Setup Utility:
      • This is a more comprehensive settings menu. You'll need to navigate to the "Boot," "Boot Order," or "Startup" section.
      • Here, you can change the permanent boot order of devices.
      • Find the list of boot devices and move your USB drive to the top of the list (or the DVD drive if using a DVD). The keys for navigation and changing order are usually displayed on-screen (e.g., arrow keys to select, +/- keys to change order, F10 to save and exit).
      • Again, if UEFI, ensure you're prioritizing the UEFI version of the USB drive if available and desired.
      • After changing the boot order, navigate to the "Exit" menu and select "Save Changes and Exit" or "Exit Saving Changes" (often F10). The computer will restart and should now boot from your USB drive.
      • Important:
        After installing Ubuntu, you might want to re-enter the BIOS/UEFI setup and set your internal hard drive (which now contains Ubuntu) back to the first boot device. However, many modern UEFI systems will automatically add an "Ubuntu" boot entry and prioritize it correctly.

Troubleshooting Boot Issues:

  • Key not working:
    Try a different key or consult your computer/motherboard manual.
  • USB drive not listed:
    • Ensure the USB drive is properly created and bootable. Try re-creating it.
    • Try a different USB port.
    • Ensure USB boot is enabled in BIOS/UEFI settings. Some systems have an option to disable booting from USB devices.
    • If using UEFI, Secure Boot might be preventing the USB from booting if it's not recognized as signed. You might need to temporarily disable Secure Boot in the UEFI settings to boot the installer, though Ubuntu's installer is generally Secure Boot compatible.
    • On older systems, you might need to enable "Legacy USB Support."
  • System boots directly to Windows/existing OS:
    You didn't press the key fast enough, or the boot order is not set correctly. Try again. On some very fast-booting systems, the window to press the key is extremely short.

Booting Ubuntu in "Try Ubuntu" Mode (Live Environment)

Once your computer successfully boots from the Ubuntu installation media, you will typically be greeted by the GRUB bootloader menu (a simple text-based menu or a graphical one on newer versions). This menu usually offers several options:

  • Try or Install Ubuntu (or simply Ubuntu):
    This is the default and recommended option. It boots into a full, live Ubuntu desktop environment running directly from the USB drive without installing anything on your hard drive.
  • Ubuntu (safe graphics):
    If the default option results in a black screen or display issues, this option boots with a "nomodeset" kernel parameter, which uses basic graphics drivers. This can help bypass compatibility issues with some graphics cards.
  • OEM install (for manufacturers):
    For pre-installing Ubuntu for another user. Not for regular users.
  • Boot from next volume:
    Skips USB boot and tries the next device in boot order.
  • UEFI Firmware Settings:
    (On UEFI systems) Takes you directly to your computer's UEFI setup utility.

Select "Try or Install Ubuntu" and press Enter.

You will see a loading screen with the Ubuntu logo, and after a short while, you will be presented with the Ubuntu desktop. A window will typically pop up asking:

  • Try Ubuntu:
    Loads the live desktop environment. You can use Ubuntu, connect to the internet, test hardware, and run applications. Nothing is installed on your hard drive. This is highly recommended to do first.
  • Install Ubuntu:
    Proceeds directly to the installation wizard.

Importance of the Live Environment ("Try Ubuntu")

Clicking "Try Ubuntu" is extremely useful:

  1. Hardware Compatibility Check:
    This is your chance to test if Ubuntu works well with your specific hardware before committing to an installation.
    • Wi-Fi:
      Try connecting to your wireless network. If it doesn't work, you might need proprietary drivers or a different approach (e.g., using a wired connection during installation to download necessary drivers).
    • Graphics:
      Check if the display resolution is correct and if the desktop feels responsive. Play a video to test graphics acceleration.
    • Sound:
      Play some audio to ensure your sound card is working.
    • Keyboard and Touchpad/Mouse:
      Ensure all keys work, and your pointing device is functional.
    • Bluetooth:
      Try pairing a Bluetooth device.
    • Webcam, Microphone:
      Test these if important to you.
  2. Explore the Ubuntu Desktop:
    Get a feel for the GNOME desktop environment (or whichever desktop your chosen Ubuntu flavor uses). Open applications, browse the file manager (Nautilus), and see if you like the general workflow.
  3. Access Utilities:
    The live environment includes useful tools:
    • GParted:
      A powerful partition manager. You can use it to inspect or modify your hard drive partitions before installation (e.g., if you need to shrink a Windows partition and couldn't do it sufficiently from within Windows). Use with caution!
    • Terminal:
      Access the command line for advanced operations or troubleshooting.
    • Web Browser (Firefox):
      You can look up installation guides or troubleshoot issues if you have an internet connection.
  4. Prepare for Installation:
    If you are performing a manual ("Something else") installation, you can use GParted from the live environment to set up your partitions exactly how you want them before starting the installer. You can also use it to ensure you know the device names for your partitions (e.g. /dev/sda1, /dev/nvme0n1p2).

If everything looks good in the "Try Ubuntu" mode, you can start the installation by clicking the "Install Ubuntu" icon that is usually present on the desktop.

Workshop Booting and Exploration

Project: Boot into the Ubuntu Live Environment and Test Hardware Components

Objective:

To successfully boot your computer from the Ubuntu USB drive into the "Try Ubuntu" live environment and perform basic hardware checks.

You will need:

  • The bootable Ubuntu USB drive you created in the previous workshop.
  • The computer on which you plan to install Ubuntu.

Steps:

  1. Prepare for Boot:
    • Ensure your computer is turned off.
    • Plug the bootable Ubuntu USB drive into a USB port.
  2. Access Boot Menu/BIOS/UEFI:
    • Power on your computer.
    • Immediately start pressing the key to access your computer's Boot Menu (commonly F12, Esc, F9) or BIOS/UEFI Setup (commonly Del, F2).
    • If you get the Boot Menu:
      • Select your USB drive. Remember to choose the "UEFI: [USB Name]" option if your system supports UEFI and you plan to install in UEFI mode.
      • Press Enter.
    • If you get the BIOS/UEFI Setup:
      • Navigate to the "Boot" or "Startup" tab.
      • Change the boot order to prioritize your USB drive (UEFI version if applicable).
      • Save changes and exit. The computer will restart.
  3. Ubuntu GRUB Menu:
    • You should see a menu with options like "Try or Install Ubuntu".
    • Ensure "Try or Install Ubuntu" is highlighted and press Enter. (If you miss this and it auto-boots, that's usually fine too).
  4. Welcome Screen:
    • After Ubuntu loads, you'll see a welcome screen asking if you want to "Try Ubuntu" or "Install Ubuntu".
    • Click "Try Ubuntu".
  5. Explore the Live Desktop:
    • You are now in the live Ubuntu environment. Take a few minutes to look around.
  6. Hardware Test Checklist:
    • Display:
      • Is the screen resolution correct for your monitor?
      • Right-click on the desktop, choose "Display Settings." Can you change the resolution if needed?
    • Network Connectivity:
      • Wi-Fi: Click the top-right system tray area (where network, volume, power icons are). Click on "Wi-Fi Not Connected" or the network icon, then "Select Network." Does it list available Wi-Fi networks? Try connecting to yours by entering the password.
      • Wired Ethernet: If you have an Ethernet cable, plug it in. Does it connect automatically?
      • Once connected, open Firefox (the fox icon in the dock on the left) and try browsing a website like ubuntu.com to confirm internet access.
    • Sound:
      • Click the system tray area and adjust the volume slider. Do you hear a sound?
      • Open Firefox and play a video from a site like YouTube. Is there audio?
    • Keyboard and Mouse/Touchpad:
      • Open a text editor (click the "Activities" overview or Show Applications button, then search for "Text Editor"). Type all the characters on your keyboard to ensure they work.
      • Test your mouse or touchpad, including clicking, right-clicking, and scrolling.
    • USB Ports:
      • If you have another USB stick (with some files on it, non-bootable), try plugging it into a different USB port. Does Ubuntu detect it? (An icon should appear in the dock or on the desktop, and it should be visible in the Files application).
    • (Optional) Bluetooth: If your computer has Bluetooth and you have a Bluetooth device (e.g., mouse, headphones):
      • Click the system tray, find Bluetooth settings. Turn it on. Try to pair your device.
    • (Optional) Webcam/Microphone:
      • Search for an application like "Cheese" (a webcam app) in the Activities overview. If installed, open it. Does your webcam work? For microphone, you might need to go to Settings -> Sound -> Input and test.
  7. Check System Information (Optional but informative):
    • Open "Settings" (from the top-right menu or by searching).
    • Go to the "About" section at the bottom of the left sidebar.
    • Note the information displayed: Ubuntu version, GNOME version, Memory, Processor, Graphics. Does it seem correct for your system?
  8. Launch GParted (For Observation Only):
    • Click the "Show Applications" button (usually a grid of dots at the bottom of the dock).
    • Type "GParted" in the search bar and launch it. You may need to enter a password (just press Enter if it asks, as there's no password for the live user by default).
    • Do not make any changes yet. Simply observe how GParted displays your internal hard drive(s) and their current partitions. This can help you visualize the disk layout you planned earlier.
    • Close GParted.

Outcome:

  • If all or most of your hardware works, you're in good shape to proceed with the installation.
  • If key hardware (like Wi-Fi or graphics) doesn't work correctly:
    • Make a note of the problem.
    • You might need to connect to the internet via a wired connection during installation to allow Ubuntu to download necessary drivers.
    • For graphics issues, you might need to try the "safe graphics" boot option or install proprietary drivers post-installation.
    • Search online (e.g., "Ubuntu 22.04 [your hardware model] Wi-Fi not working") for solutions.

Once you are satisfied with the hardware compatibility test in the live environment, you can proceed with the actual installation by double-clicking the "Install Ubuntu XX.YY LTS" icon on the live desktop.

3. The Ubuntu Installation Process Step-by-Step

After booting into the live environment and testing your hardware, you're ready to install Ubuntu. If you haven't already, double-click the "Install Ubuntu" icon on the desktop of the live session. This will launch the Ubiquity installer.

The installation process is a guided, graphical wizard. Here's a detailed breakdown of each step:

Language Selection

  • Screen: "Welcome"
  • Action:
    Choose your preferred language for the installation process and for the installed system. The list is extensive. Select your language (e.g., "English") and click "Continue."
  • Impact:
    This sets the language for menus, prompts, and system messages. You can add more languages or change this later in the installed system.

Keyboard Layout Configuration

  • Screen: "Keyboard layout"
  • Action:
    1. Select your keyboard layout (e.g., "English (US)" - "English (US)").
    2. You can use the "Detect Keyboard Layout" button if you're unsure, or type in the text field "Type here to test your keyboard" to verify your selection. Special characters (@, #, $, ~, |, etc.) are good to test.
    3. Click "Continue."
  • Impact:
    Ensures your keyboard inputs characters correctly. This is crucial for typing passwords and commands accurately.

Network Configuration

  • Screen:
    "Wireless" (or a similar network screen)
  • Action:
    • The installer will scan for available Wi-Fi networks.
    • If you have a Wi-Fi network:
      Select it from the list, click "Connect," and enter the password. Connecting to the internet now is recommended as it allows the installer to download updates and third-party software during the installation process.
    • If you have a wired Ethernet connection:
      It should be detected and connected automatically. You might see "Wired connection 1" listed.
    • If you do not want to connect now or cannot:
      Select "I don't want to connect to a Wi-Fi network right now" (or a similar option) and click "Continue." You can set up networking after the installation.
  • Impact:
    Internet access during installation can save time by downloading the latest packages and codecs. If you have problematic Wi-Fi that requires proprietary drivers, connecting via Ethernet (if possible) is a good idea.

Updates and Other Software

  • Screen:
    "Updates and other software"
  • Action:
    You'll see several checkboxes:
    • "What apps would you like to install to start with?"
      • "Normal installation":
        This installs a full suite of software, including a web browser (Firefox), utilities, office software (LibreOffice), games, and media players. Recommended for most desktop users.
      • "Minimal installation":
        This installs a basic desktop environment, web browser, and core utilities. It omits office software, games, and media players, resulting in a smaller footprint. Suitable if you prefer to install only specific applications later or have limited disk space.
    • "Other options"
      • "Download updates while installing Ubuntu":
        • Saves time by downloading the latest package updates during the installation process. Requires an internet connection.
        • Recommended to check this if you have a stable internet connection.
      • "Install third-party software for graphics and Wi-Fi hardware, Flash, MP3 and other media":
        • Installs proprietary drivers (e.g., for NVIDIA/AMD graphics cards, some Wi-Fi adapters) and common multimedia codecs (for playing MP3s, DVDs, etc.) that are not open source.
        • Highly recommended to check this for better hardware compatibility and multimedia support out-of-the-box.
        • If Secure Boot is enabled, you might be prompted to create a password for MOK (Machine Owner Key) management during this process or on the first reboot after installing these drivers. This password will be used to authorize the new third-party drivers. Pay attention to any on-screen instructions regarding this.
  • Click "Continue."

Installation Type - The Core of Disk Configuration

This is the most critical step where you decide how Ubuntu will be installed on your hard drive(s). The options presented will depend on what the installer detects on your system (e.g., an existing OS, free space).

Common Options You Might See:

  • "Erase disk and install Ubuntu":

    • Explanation:
      This option will delete everything on the selected hard drive (all existing operating systems, partitions, and data) and install Ubuntu as the sole OS.
    • When to use:
      • If you are installing Ubuntu on a new, empty hard drive.
      • If you want to completely replace your current operating system with Ubuntu.
      • If you are sure you have backed up all important data from the drive.
    • Advanced Options (often under this choice or a separate button):
      • "Use LVM with the new Ubuntu installation":
        • LVM (Logical Volume Management):
          A powerful disk management system that provides more flexibility than traditional partitions. It allows you to create logical volumes that can span multiple disks, be resized easily (even while mounted, for some filesystems), and supports features like snapshots.
        • How it works:
          It creates a Physical Volume (PV) on the disk, a Volume Group (VG) encompassing the PV, and then Logical Volumes (LVs) within the VG for / (root) and swap. Your /home would typically be within the root LV or could be a separate LV.
        • Benefits:
          Easier to manage disk space in the long run, especially if your needs change. For example, if your root partition fills up, you might be able to shrink another LV (if available and it has free space) and extend the root LV.
        • Consideration:
          Adds a layer of abstraction. While robust, it's slightly more complex than standard partitions.
      • "Encrypt the new Ubuntu installation for security" (Full Disk Encryption - FDE):
        • Explanation:
          Encrypts the entire Ubuntu system partition (usually using LUKS - Linux Unified Key Setup). You will be prompted to create an encryption passphrase during installation. This passphrase will be required every time you boot the computer, before Ubuntu starts.
        • Importance:
          Crucial for protecting sensitive data, especially on laptops or portable devices that might be lost or stolen.
        • Impact:
          • Slight performance overhead (usually negligible on modern CPUs with AES acceleration).
          • If you forget the passphrase, your data will be irrecoverable. Choose a strong but memorable passphrase and consider storing it securely (e.g., in a password manager, or a written copy in a very safe place).
          • A recovery key might also be offered or can be set up post-installation.
        • Note:
          If you choose both LVM and Encryption, the LVM setup will typically reside inside an encrypted container. The /boot partition, which contains the kernel and bootloader, usually remains unencrypted to allow the system to start the decryption process.
      • "Use ZFS with the new Ubuntu installation" (Experimental or specific Ubuntu versions):
        • ZFS (Zettabyte File System):
          An advanced filesystem and logical volume manager with features like strong data integrity (checksums, self-healing), copy-on-write, snapshots, clones, built-in RAID, and efficient compression.
        • Benefits:
          Excellent data protection, flexible storage pooling.
        • Considerations:
          Can be more memory-intensive (RAM). While support on Linux (via OpenZFS) is mature, it might be considered more advanced for new users compared to ext4. If offered as a primary option, it typically sets up ZFS for the root filesystem.
  • "Install Ubuntu alongside [Existing OS, e.g., Windows Boot Manager, another Linux]":

    • Explanation:
      This option appears if the installer detects another operating system already installed and there is free space or a partition that can be resized. It will automatically shrink an existing partition (usually the largest one) to make space for Ubuntu and set up a dual-boot system.
    • How it works:
      The installer presents a slider allowing you to choose how much space to allocate to Ubuntu versus the existing OS.
    • When to use:
      If you want to keep your existing OS and have Ubuntu installed on the same drive, and you prefer an automated process.
    • Limitations and Considerations:
      • You have less control over the exact partition layout (e.g., creating a separate /home partition might not be an option here; Ubuntu usually creates just a root partition and swap).
      • The resizing operation, while generally safe, carries a small risk. Ensure your data is backed up.
      • Make sure Windows Fast Startup and Hibernation are disabled before attempting this, as they can lock the Windows partition and prevent resizing.
  • "Something else" (Manual Partitioning):

    • Explanation:
      This option gives you complete control over partitioning. You can create, delete, resize, format, and assign mount points to partitions manually.
    • When to use:
      • If you want a custom partition layout (e.g., separate /home, /var, /tmp partitions).
      • If you are installing on a system with multiple hard drives and want to specify where Ubuntu goes.
      • If you are dual-booting and have already created unallocated space and want to define partitions precisely.
      • If you need to use an existing ESP or specific existing partitions.
      • If you want to choose specific filesystems for each partition (e.g., Btrfs for root, XFS for a data partition).
    • The Manual Partitioning Interface:

      • You will see a list of your detected storage devices (e.g., /dev/sda, /dev/sdb, /dev/nvme0n1) and their existing partitions.
      • Key Actions:
        • Select free space:
          If you have unallocated space, select it and click the + (plus) button to create a new partition.
        • Select an existing partition:
          You can choose to format it (change its type and erase its data) or delete it (if it's safe to do so).
        • Create Partition Dialog:
          When creating or modifying a partition, you'll specify:
          • Size: In megabytes (MB) or gigabytes (GB).
          • Type for the new partition:
            • Primary:
              If using MBR and have fewer than 4 primary partitions.
            • Logical:
              If using MBR and creating it within an extended partition. (GPT doesn't have this distinction; all are effectively primary).
          • Location for the new partition:
            Beginning or End of the selected space.
          • "Use as":
            This is where you choose the filesystem or purpose:
            • Ext4 journaling file system:
              Common default for /, /home, etc.
            • Ext3, Ext2 journaling file system:
              Older Linux filesystems.
            • Btrfs journaling file system:
              Advanced filesystem with CoW, snapshots.
            • XFS journaling file system:
              High-performance, good for large files.
            • FAT32 file system:
              For ESP (/boot/efi) or shared data partitions.
            • NTFS file system:
              For shared data partitions with Windows.
            • Swap area:
              For a swap partition.
            • EFI System Partition:
              Designates the partition as ESP (use for /boot/efi).
            • Physical volume for LVM:
              If you plan to set up LVM manually.
            • Do not use the partition:
              Leaves it untouched.
          • "Mount point":
            If it's a filesystem partition for Ubuntu, you assign a mount point:
            • / (for the root filesystem)
            • /home (for user data)
            • /boot (if creating a separate boot partition)
            • /boot/efi (for the EFI System Partition - critical for UEFI systems)
            • Other custom mount points like /var, /srv (for advanced users).
          • "Format the partition" checkbox:
            Check this if you are creating a new partition or want to erase an existing one for Ubuntu. Uncheck it if you are re-using an existing /home partition from a previous Linux install and want to keep its data, or if you are assigning an existing ESP that already has Windows boot files.
      • Device for boot loader installation:
        • This dropdown determines where the GRUB bootloader will be installed.
        • For UEFI systems:
          GRUB is installed to the ESP. You don't usually need to change this from the default (which is often the main disk like /dev/sda or /dev/nvme0n1, but the installer correctly places the EFI files in the ESP on that disk).
        • For BIOS/Legacy systems:
          GRUB is installed to the Master Boot Record (MBR) of the primary boot disk (e.g., /dev/sda).
        • Generally, leave this to the default unless you have a very specific multi-disk setup and know what you're doing. Incorrectly setting this can make your system unbootable.
    • Step-by-Step Manual Partitioning Example (UEFI, separate /home, new install):

      1. Assuming you have "free space" selected.
      2. Create EFI System Partition (ESP):
        • Click +. Size: 512 MB. Type: Primary. Location: Beginning. Use as: EFI System Partition. Click OK. (If one already exists from Windows, select it, click "Change...", set "Use as" to EFI System Partition, ensure "Mount point" is /boot/efi, and DO NOT check format).
      3. Select the remaining "free space."
      4. Create Swap Partition (optional, can use swap file instead):
        • Click +. Size: (e.g., 4096 MB for 4GB RAM, or RAM size if hibernation desired). Type: Logical (or Primary). Location: Beginning. Use as: swap area. Click OK.
      5. Select the remaining "free space."
      6. Create Root Partition (/):
        • Click +. Size: (e.g., 30720 MB for 30GB). Type: Logical (or Primary). Location: Beginning. Use as: Ext4 journaling file system. Mount point: /. Check "Format the partition." Click OK.
      7. Select the remaining "free space."
      8. Create Home Partition (/home):
        • Click +. Size: (use all remaining space, or leave some if planning other partitions). Type: Logical (or Primary). Location: Beginning. Use as: Ext4 journaling file system. Mount point: /home. Check "Format the partition." Click OK.
      9. Review your partition table carefully. Ensure mount points are correct, ESP is set, and filesystems are chosen.
      10. Ensure "Device for boot loader installation" points to your main hard drive (e.g., /dev/sda or /dev/nvme0n1).

Once you've made your choice in the "Installation type" screen and configured partitions if necessary, click "Install Now" (if you chose "Erase disk" or "Install alongside") or "Continue" (if you chose "Something else," which then leads to a confirmation screen).

A dialog box "Write the changes to disks?" will appear, summarizing the partitioning actions to be taken. Review this very carefully. This is your last chance to go back before changes are made to your disk. If you are sure, click "Continue."

Time Zone Selection

  • Screen: "Where are you?"
  • Action:
    • The installer may try to auto-detect your location based on your internet connection.
    • If incorrect, type your nearest major city in the text box (e.g., "New York," "London," "Berlin") or click on the map.
    • Click "Continue."
  • Impact: Sets the system clock and regional settings correctly.

User Account Creation

  • Screen: "Who are you?"
  • Action:
    Fill in the details for your primary user account:
    • "Your name":
      Your full name (e.g., "Ada Lovelace").
    • "Your computer's name":
      This is the hostname for your computer on the network (e.g., "ada-desktop"). It should be a single word, alphanumeric, can contain hyphens.
    • "Pick a username":
      Your login name (e.g., "ada"). This is typically lowercase, no spaces.
    • "Choose a password":
      Create a strong password. The installer will indicate its strength.
    • "Confirm your password":
      Re-type the password.
    • Login options:
      • "Log in automatically":
        Your computer will boot directly to the desktop without asking for a password. Less secure, generally not recommended, especially for laptops.
      • "Require my password to log in":
        You will need to enter your password at the login screen. Recommended for security.
    • (Optional) "Use Active Directory":
      Only relevant if you are connecting to a corporate Active Directory domain. Most home users will ignore this.
  • Click "Continue."

Installation Progress

  • Screen:
    A slideshow showcasing Ubuntu's features while files are copied and the system is installed.
  • Action:
    Wait for the installation to complete. This can take anywhere from 10-15 minutes to over an hour, depending on your computer's speed, the installation media (USB is faster than DVD), and whether you chose to download updates during installation.
  • What happens:
    • Partitions are formatted (if specified).
    • System files are copied from the installation media to your hard drive.
    • Hardware is detected and configured.
    • The bootloader (GRUB) is installed.
    • Software packages are installed and configured.
    • If selected, updates are downloaded and installed.
    • User accounts are created.

Installation Complete and Restart

  • Screen: "Installation Complete"
  • Action:
    • A dialog box will appear stating "Installation is complete. You need to restart the computer in order to use the new installation."
    • You will have two options:
      • "Restart Now": Click this to reboot your computer.
      • "Continue Testing":
        Allows you to remain in the live environment if you want to do something else before restarting. Most users will choose "Restart Now."
    • When you click "Restart Now," you will be prompted: "Please remove the installation medium, then press ENTER."
    • Remove your USB drive (or DVD) from the computer.
    • Press Enter.

Your computer will restart. If the installation was successful and the bootloader is configured correctly, you should see the GRUB boot menu (if you have a dual-boot system) or Ubuntu will boot directly. You will then be presented with the login screen (unless you chose automatic login). Enter your password to log in to your new Ubuntu system!

Workshop Installation

This workshop section will guide you through three distinct installation scenarios to practice different disk configuration approaches. It is highly recommended to perform these workshops in a virtual machine (VM) like VirtualBox or VMware Workstation Player/Fusion, or on a spare computer where data loss is not a concern. Do NOT attempt these on your primary machine with important data unless you are very confident and have full backups.

Prerequisites for all Workshop Projects:

  • A bootable Ubuntu USB drive (created earlier).
  • A VM environment set up (e.g., VirtualBox) or a spare computer.
  • Familiarity with booting from USB in your chosen environment.

Project 1: Install Ubuntu as Sole OS with LVM and Encryption

Objective:

To perform a full disk installation using LVM for flexible volume management and LUKS encryption for security. This simulates dedicating an entire machine (or VM disk) to Ubuntu.

VM Setup (if using VirtualBox):

  • Create a new VM. Name: Ubuntu-LVM-Encrypted. Type: Linux. Version: Ubuntu (64-bit).
  • Memory: At least 4GB.
  • Hard disk: Create a virtual hard disk now, VDI, Dynamically allocated, Size: at least 40GB (more is better if you want to play with LVM resizing later).
  • Settings -> System -> Motherboard: Enable EFI (special OSes only).
  • Settings -> Storage: Add the Ubuntu ISO to the virtual CD/DVD drive.
  • Settings -> Display: Increase Video Memory if possible, enable 3D Acceleration.

Steps:

  1. Boot from Ubuntu Media:
    Start the VM/computer and boot from the Ubuntu ISO/USB.
  2. Choose "Try or Install Ubuntu".
  3. Start Installer:
    Once in the live environment, click "Install Ubuntu".
  4. Language, Keyboard, Network:
    Proceed through these steps as described earlier. Connect to the internet if possible, and for "Updates and other software," select:
    • "Normal installation"
    • Check "Download updates while installing Ubuntu"
    • Check "Install third-party software..."
  5. Installation Type:
    • Select "Erase disk and install Ubuntu".
    • Click the "Advanced features..." button.
    • In the "Advanced features" dialog:
      • Select "Use LVM with the new Ubuntu installation".
      • Select "Encrypt the new Ubuntu installation for security".
      • Click "OK".
    • Click "Install Now".
  6. Encryption Passphrase:
    • A screen will appear: "Choose a security key".
    • Enter a strong encryption passphrase. Remember this passphrase! If you lose it, you lose access to your installation.
    • Confirm the passphrase.
    • You can also choose to "Create a recovery key" (recommended) or "Overwrite empty disk space" (more secure erase, but takes much longer; usually not needed for VMs or new disks).
    • Click "Install Now" (or "Continue" if that's the button).
  7. Confirm Changes:
    A dialog "Write the changes to disks?" will appear, showing the planned actions (creating encrypted LVM). Review and click "Continue".
  8. Time Zone, User Account:
    Complete these steps as usual. For the user account, ensure you "Require my password to log in".
  9. Installation:
    Wait for the installation to finish.
  10. Restart:
    Remove the installation media when prompted and press Enter.
  11. First Boot - Decryption:
    • When the system reboots, before Ubuntu loads, you will see a prompt similar to: Please unlock disk <crypt_device_name>:.
    • Enter the encryption passphrase you set during installation. Press Enter.
    • If correct, Ubuntu will continue to boot.
  12. Login:
    At the Ubuntu login screen, enter your user password.

Outcome:

You now have an Ubuntu system installed with LVM and full disk encryption (except for /boot). You can explore the disk layout using lsblk in a terminal or the "Disks" utility to see the LVM and cryptsetup layers.

Project 2: Install Ubuntu Alongside Windows (Dual Boot) - Guided

Objective:

To install Ubuntu in a dual-boot configuration with an existing (simulated) Windows installation, using the installer's guided "Install alongside" feature.

VM Setup (if using VirtualBox):

  • Simulate Windows: You'd ideally have a VM with Windows already installed. If not, for this exercise, we can prepare a disk to look like it has Windows for the installer.
    1. Create a new VM. Name: Ubuntu-DualBoot-Guided. Type: Linux. Version: Ubuntu (64-bit).
    2. Memory: At least 4GB.
    3. Hard disk: Create a virtual hard disk, VDI, Dynamically allocated, Size: at least 50GB (e.g., 60GB to give Windows "space").
    4. Settings -> System -> Motherboard: Enable EFI.
    5. Prepare "Windows" Partition (Simplified):
      • Boot the VM from the Ubuntu ISO into the "Try Ubuntu" environment.
      • Open GParted.
      • Select your virtual disk (e.g., /dev/sda).
      • Device -> Create Partition Table -> Select gpt -> Apply.
      • Create a new partition:
        • Size: ~30GB (for our "Windows"). Filesystem: ntfs. Label: Windows. Add.
      • Apply all operations in GParted. This creates a partition that the Ubuntu installer might recognize as resizable. (A real Windows install would also have an ESP and MSR).
    6. Restart the VM, ensuring it boots from the Ubuntu ISO again for the actual installation.

Steps:

  1. Boot from Ubuntu Media:
    Start the VM/computer and boot from the Ubuntu ISO/USB.
  2. Choose "Try or Install Ubuntu".
  3. Start Installer: Click "Install Ubuntu".
  4. Language, Keyboard, Network, Updates:
    Proceed as before. Normal installation, download updates, install third-party software.
  5. Installation Type:
    • The installer should detect the existing NTFS partition (our "Windows").
    • You should see an option like "Install Ubuntu alongside [identified OS/partition]". Select this.
    • If this option is available, you'll see a graphical representation of your disk with a slider. Drag the slider to allocate space between "Windows" and Ubuntu. Give Ubuntu at least 25-30GB.
    • Click "Install Now".
  6. Confirm Changes:
    A dialog will show how it plans to resize the "Windows" partition and create new partitions for Ubuntu. Review and click "Continue".
  7. Time Zone, User Account:
    Complete these steps.
  8. Installation:
    Wait for it to finish.
  9. Restart:
    Remove media, press Enter.
  10. GRUB Menu:
    On reboot, you should see the GRUB boot menu listing options for "Ubuntu" and an entry for "Windows Boot Manager" (or similar, even if our "Windows" is just a placeholder partition, GRUB might still add an entry if it detected an OS).
  11. Login:
    Select Ubuntu, boot, and log in.

Outcome:

Ubuntu is installed alongside your "Windows" partition. Open GParted or "Disks" utility in the installed Ubuntu to see how the disk was partitioned (typically, the NTFS partition was shrunk, and Ubuntu created a root partition and possibly a swap file/partition in the new space).

Project 3: Perform a Manual Partition Installation of Ubuntu

Objective:

To gain experience with the "Something else" installation option by manually creating partitions for /, /home, and swap.

VM Setup (if using VirtualBox):

  • Create a new VM. Name: Ubuntu-ManualPartition. Type: Linux. Version: Ubuntu (64-bit).
  • Memory: At least 4GB.
  • Hard disk: Create a virtual hard disk, VDI, Dynamically allocated, Size: at least 40GB.
  • Settings -> System -> Motherboard: Enable EFI.
  • Settings -> Storage: Add Ubuntu ISO.

Steps:

  1. Boot from Ubuntu Media: Into "Try Ubuntu".
  2. Start Installer: Click "Install Ubuntu".
  3. Language, Keyboard, Network, Updates: Proceed as before.
  4. Installation Type:
    • Select "Something else".
    • Click "Continue".
  5. Manual Partitioning Screen:
    • You'll see your virtual disk (e.g., /dev/sda). It will likely show as unpartitioned or "free space".
    • If it's not empty and you want a clean slate for the VM, select the disk and you might see an option for "New Partition Table..." (choose gpt).
    • Select the "free space" on /dev/sda.
    • Create EFI System Partition (ESP):
      • Click +.
      • Size: 512 MB.
      • Type for the new partition: Primary.
      • Location: Beginning of this space.
      • Use as: EFI System Partition.
      • Click "OK".
    • Select the remaining "free space".
    • Create Swap Partition:
      • Click +.
      • Size: (e.g., 2048 MB for 2GB, or adjust based on VM RAM).
      • Type: Logical (or Primary if preferred, doesn't matter much in GPT with few partitions).
      • Location: Beginning of this space.
      • Use as: swap area.
      • Click "OK".
    • Select the remaining "free space".
    • Create Root Partition (/):
      • Click +.
      • Size: (e.g., 20480 MB for 20GB).
      • Type: Logical (or Primary).
      • Location: Beginning of this space.
      • Use as: Ext4 journaling file system.
      • Mount point: /.
      • Click "OK".
    • Select the remaining "free space".
    • Create Home Partition (/home):
      • Click +.
      • Size: Use the rest of the available space (it should default to this).
      • Type: Logical (or Primary).
      • Location: Beginning of this space.
      • Use as: Ext4 journaling file system.
      • Mount point: /home.
      • Click "OK".
    • Review:
      Your partition table should now show the ESP, swap, root, and home partitions correctly configured.
    • Device for boot loader installation:
      Ensure it's set to your main disk (e.g., /dev/sda). For UEFI, this is fine; the EFI files go to the ESP on that disk.
    • Click "Install Now".
  6. Confirm Changes:
    A dialog "Write the changes to disks?" will summarize the partitions to be created and formatted. Review carefully. Click "Continue".
  7. Time Zone, User Account:
    Complete these steps.
  8. Installation:
    Wait for it to finish.
  9. Restart:
    Remove media, press Enter.
  10. Login:
    Boot into Ubuntu and log in.

Outcome:

Ubuntu is installed with your custom partition scheme.

  • Open a terminal and type lsblk. You should see your /, /home, swap, and ESP (/boot/efi) mounted as you defined them.
  • You can also use the "Disks" utility or GParted (install it with sudo apt install gparted) to view the partition layout.

These workshops provide hands-on experience with different installation methods, particularly focusing on disk configuration which is often the most daunting part for new users. Remember that VMs offer a safe environment to experiment without risking your main system.

4. Post-Installation Steps

Congratulations on successfully installing Ubuntu! Your journey doesn't end with the installation wizard. Several important steps should be taken after the first boot to ensure your system is up-to-date, secure, and customized to your needs.

First Boot and Welcome Screen

Upon restarting after installation, you should be greeted by the Ubuntu login screen (unless you chose automatic login). Enter the password you created during installation.

Once logged in, you might see a "Welcome to Ubuntu" application (on newer versions). This wizard can help you:

  • Connect online accounts (Google, Nextcloud, Microsoft).
  • Set up Livepatch (for applying kernel updates without rebooting, requires an Ubuntu One account).
  • Send diagnostic information to Canonical (optional).
  • Show you where to find new software (Ubuntu Software).

Feel free to go through this welcome wizard or skip it for later.

Updating Your System

Even if you chose "Download updates while installing Ubuntu," new updates might have been released since the ISO image was created or since the installation finished. Keeping your system updated is crucial for security and stability.

There are two main ways to update: via the command line (terminal) or a graphical tool.

Using the Terminal (Recommended for understanding):

  1. Open Terminal:
    You can find it by clicking the "Activities" overview (top-left) or the "Show Applications" button (bottom-left grid icon) and searching for "Terminal." Alternatively, press Ctrl+Alt+T.
  2. Update Package List:
    This command downloads the latest list of available packages and their versions from the repositories defined in your system's sources.
    sudo apt update
    
    • sudo (superuser do): Executes the command with administrative (root) privileges. You will be prompted for your user password. Type it and press Enter (no characters will appear as you type).
    • apt (Advanced Package Tool): The command-line tool for managing software packages on Ubuntu and other Debian-based distributions.
    • update: The action to resynchronize the package index files.
  3. Upgrade Installed Packages:
    This command upgrades all currently installed packages to their newest versions, based on the updated list from the previous step. It will not remove any packages.
    sudo apt upgrade
    
    • You'll be shown a list of packages to be upgraded and the amount of disk space required. Press Y (for Yes) and Enter to proceed.
  4. Full Upgrade (Optional but often good):
    This command also upgrades installed packages but can remove packages if necessary to complete the upgrade of others. This is sometimes needed for more significant updates, like kernel updates that might conflict with older versions of related packages.
    sudo apt full-upgrade
    
    • Again, review the changes and press Y to proceed if you agree.
  5. Remove Unnecessary Packages (Autoremove):
    After updates, some packages might become obsolete (e.g., old kernels or dependencies that are no longer needed). This command removes them to free up disk space.
    sudo apt autoremove
    
  6. Clean Package Cache (Optional):
    APT keeps downloaded .deb package files in a cache (/var/cache/apt/archives/). This command removes these cached files, which can free up significant disk space. The packages can be re-downloaded if needed later.
    sudo apt clean
    

Using the Software Updater GUI:

Ubuntu also has a graphical tool for updates.

  1. Search for "Software Updater" in the Activities overview and launch it.
  2. It will automatically check for updates.
  3. If updates are available, it will list them. You can click "Details of updates" to see the specific packages.
  4. Click "Install Now" to download and install the updates. You'll need to enter your password.
  5. Sometimes, a restart might be required after installing certain updates (like a new kernel). The Software Updater will inform you if this is the case.

It's good practice to check for updates regularly (e.g., once a day or once a week).

Installing Drivers

Ubuntu has excellent hardware support out-of-the-box, but some hardware components (especially newer graphics cards and some Wi-Fi adapters) may require proprietary (closed-source) drivers for optimal performance or functionality.

Using the "Additional Drivers" Tool:

This is the easiest way to find and install proprietary drivers.

  1. Search for "Software & Updates" in the Activities overview and launch it.
  2. Go to the "Additional Drivers" tab.
  3. The system will search for available proprietary drivers for your hardware. This might take a few moments.
  4. If any proprietary drivers are found (e.g., for NVIDIA or AMD graphics cards, Broadcom Wi-Fi adapters), they will be listed.
  5. Typically, one option will be selected by default (often an open-source driver, like "X.Org X server -- Nouveau display driver" for NVIDIA).
  6. You can select a proprietary driver from the list (e.g., "NVIDIA driver metapackage from nvidia-driver-xxx (proprietary, tested)"). Usually, the one marked "tested" or the highest version number is a good choice.
  7. Click "Apply Changes."
  8. The driver will be downloaded and installed. You'll need to enter your password.
  9. Restart Required: After installing graphics drivers, a restart is almost always necessary for the changes to take effect. The system will usually prompt you to restart.

Secure Boot and MOK Management (if applicable):

If you have Secure Boot enabled in your UEFI settings and you install third-party/proprietary drivers (like NVIDIA's), these drivers need to be signed to load. Ubuntu uses a system called MOK (Machine Owner Key) for this.

  • During driver installation (via "Additional Drivers" or if you selected "Install third-party software" during Ubuntu installation): You might be prompted to "Configure Secure Boot" and set up a password for MOK management. Choose a memorable password.
  • On the next reboot: Before Ubuntu fully loads, a blue screen titled "Perform MOK management" (or similar) will appear.
    • Select "Enroll MOK" (or "Enroll key").
    • You might need to "Continue" or view key details.
    • When prompted for the password, enter the MOK password you created earlier.
    • Confirm enrollment.
    • Select "Reboot."

This enrolls the signing key for the new drivers, allowing them to load even with Secure Boot enabled. If you miss this MOK enrollment step, the proprietary drivers might not load, and your system might fall back to basic graphics drivers. You might need to reinstall the driver to trigger the MOK prompt again or manage MOK keys manually (which is more advanced).

Customizing Your Ubuntu Experience

Now that your system is updated and drivers are installed, you can start tailoring Ubuntu to your preferences.

  • Desktop Environment Settings (GNOME):
    • Open "Settings" from the top-right menu or Activities overview.
    • Background:
      Change your desktop wallpaper.
    • Appearance:
      Choose Light/Dark style, Accent Color.
    • Notifications:
      Configure which apps can send notifications.
    • Search:
      Control what's included in the Activities overview search.
    • Multitasking:
      Configure Hot Corner, Active Screen Edges, Number of Workspaces.
    • Displays:
      Adjust resolution, scaling (for HiDPI screens), and multi-monitor setups.
    • Mouse & Touchpad:
      Adjust pointer speed, natural scrolling.
    • Power:
      Configure power saving settings.
  • Install GNOME Tweaks (for more advanced GNOME customization):
    • Open Terminal: sudo apt install gnome-tweaks
    • Launch "Tweaks." You can customize fonts, themes, window titlebar buttons, startup applications, top bar appearance, and much more.
  • Installing Essential Software:
    • Ubuntu comes with many applications, but you might want more. Use the "Ubuntu Software" application (a graphical package manager) or apt in the terminal.
    • Web Browsers:
      Firefox is default. You might want Google Chrome, Brave, or Microsoft Edge (Linux versions available).
      • For Chrome (example): Download the .deb package from Google's website. Then install it: sudo apt install ./google-chrome-stable_current_amd64.deb (navigate to your Downloads folder first) or double-click the .deb file to open it with Software Install.
    • Office Suite:
      LibreOffice is default. It's highly compatible with Microsoft Office formats.
    • Media Players:
      Rhythmbox (music) and Videos (Totem) are default. VLC is a very popular alternative that plays almost anything: sudo apt install vlc
    • Image Editors:
      GIMP (GNU Image Manipulation Program - powerful, like Photoshop): sudo apt install gimp. Pinta (simpler, like Paint.NET): sudo apt install pinta.
    • Code Editors/IDEs:
      Visual Studio Code (VS Code) is very popular. Download the .deb from code.visualstudio.com. Sublime Text, Atom, IntelliJ IDEA, Eclipse, etc., are also available.
    • Communication:
      Thunderbird (email, default), Slack, Discord, Zoom, Skype (Linux versions often available from their websites).
    • Utilities: htop (interactive process viewer), neofetch (system info display), synaptic (alternative graphical package manager).
  • Configuring Language Support and Input Methods:
    • Go to Settings -> Region & Language.
    • Language:
      Ensure your preferred language is at the top.
    • Formats:
      Set formats for dates, times, numbers, and currency according to your region.
    • Input Sources:
      Add or remove keyboard layouts or input method editors (IMEs) for different languages (e.g., for typing Chinese, Japanese, Korean).

Setting up a Firewall

Ubuntu comes with ufw (Uncomplicated Firewall), which is a front-end for iptables. It's disabled by default on desktop installations because desktop systems are typically behind a router firewall and don't usually run publicly accessible services. However, enabling it is a good security practice, especially on laptops that connect to various networks.

Introduction to ufw:

ufw aims to make firewall management easy. The basic idea is to deny all incoming connections by default and then specifically allow only the services you need.

Basic ufw Commands (run in Terminal with sudo):

  1. Check Status:
    sudo ufw status
    
    • Output will be Status: inactive if it's off.
  2. Enable ufw:
    sudo ufw enable
    
    • This will enable the firewall and load its default rules (usually deny incoming, allow outgoing). It will also configure ufw to start automatically on boot.
    • Warning: If you are connected to your machine via SSH, ensure you allow SSH before enabling the firewall, or you might lock yourself out. sudo ufw allow ssh or sudo ufw allow 22/tcp.
  3. Disable ufw:
    sudo ufw disable
    
  4. Default Policies:
    • Deny all incoming traffic: sudo ufw default deny incoming (usually the default when enabled).
    • Allow all outgoing traffic: sudo ufw default allow outgoing (usually the default).
  5. Allowing Connections:
    • By service name (ufw knows common services from /etc/services):
      sudo ufw allow ssh        # For SSH (port 22)
      sudo ufw allow http       # For HTTP web server (port 80)
      sudo ufw allow https      # For HTTPS web server (port 443)
      
    • By port number:
      sudo ufw allow 22/tcp     # Allow TCP traffic on port 22
      sudo ufw allow 8000/tcp   # Allow TCP traffic on port 8000
      sudo ufw allow 53/udp     # Allow UDP traffic on port 53 (for DNS)
      
    • Allowing from a specific IP address:
      sudo ufw allow from 192.168.1.100 to any port 22 proto tcp
      
  6. Denying Connections:
    sudo ufw deny 3000/tcp
    
  7. Deleting Rules:
    • First, list rules with numbers: sudo ufw status numbered
    • Then delete by number: sudo ufw delete 1 (deletes rule number 1)
    • Or delete by rule specification: sudo ufw delete allow http
  8. Reloading ufw (if you modified rules files directly, not common):
    sudo ufw reload
    
  9. Resetting ufw to defaults:
    sudo ufw reset
    
    This will disable ufw and delete all rules.

For a typical desktop user, enabling ufw with default policies is often sufficient:

sudo ufw enable
sudo ufw status verbose  # Shows more details
This provides a good baseline of security by blocking unsolicited incoming connections.

Workshop Post-Installation

Project: Basic System Setup and Customization

Objective:

To perform essential post-installation tasks: update the system, install a proprietary graphics driver (simulated if not applicable), install some common applications, and configure a basic firewall.

You will need:

  • Your newly installed Ubuntu system (from a previous workshop or a fresh install).
  • Internet connection.

Steps:

  1. Log In to Ubuntu.
    If the "Welcome to Ubuntu" wizard appears, you can go through it or close it.
  2. Update Your System (Terminal):
    1. Open Terminal (Ctrl+Alt+T).
    2. Update package lists: sudo apt update (enter your password when prompted).
    3. Upgrade packages: sudo apt upgrade -y (the -y automatically answers "yes" to prompts).
    4. Perform a full upgrade: sudo apt full-upgrade -y
    5. Remove unused packages: sudo apt autoremove -y
    6. Clean package cache: sudo apt clean
  3. Install Proprietary Graphics Drivers (if applicable/desired):
    • This step depends heavily on your hardware. If you are in a VM without GPU passthrough, this might not find anything or might offer guest additions drivers.
    • Open "Software & Updates."
    • Go to the "Additional Drivers" tab.
    • If a proprietary driver for your graphics card (e.g., NVIDIA, AMD) is listed and you want to use it, select it.
    • Click "Apply Changes." Enter your password.
    • If prompted about Secure Boot/MOK enrollment: Take note of the instructions and the password you set.
    • After it finishes, restart your computer.
    • If MOK management screen appears on reboot: Follow the prompts to "Enroll MOK," enter the password you set, and reboot again.
  4. Install Useful Applications:
    • Open Terminal.
    • Install VLC media player: sudo apt install vlc -y
    • Install GIMP image editor: sudo apt install gimp -y
    • Install GNOME Tweaks: sudo apt install gnome-tweaks -y
    • Install Visual Studio Code (VS Code):
      1. Open Firefox, go to code.visualstudio.com.
      2. Download the .deb package (64-bit). It will save to your ~/Downloads folder.
      3. In Terminal, navigate to Downloads: cd ~/Downloads
      4. Install VS Code: sudo apt install ./<name_of_vscode_deb_file.deb> (use Tab for autocompletion of the filename). If apt complains about dependencies, try sudo apt install -f afterwards, then retry the VS Code install.
  5. Customize with GNOME Tweaks:
    1. Open "Tweaks" (search in Activities).
    2. Explore the options:
      • Appearance:
        Change Themes (Applications, Cursor, Icons - you can install new themes later).
      • Fonts:
        Adjust interface, document, and monospace font settings.
      • Keyboard & Mouse:
        Enable "Middle Click Paste" if you like.
      • Top Bar:
        Show date, weekday, seconds in the clock.
      • Window Titlebars:
        Enable Maximize and Minimize buttons if they are missing (they are often hidden by default in modern GNOME).
      • Windows:
        Experiment with "Attach Modal Dialogs" and "Edge Tiling."
  6. Configure Basic Firewall (ufw):
    1. Open Terminal.
    2. Check current status: sudo ufw status (should be inactive).
    3. If you use SSH to connect to this machine (unlikely for a new desktop install, but good practice): sudo ufw allow ssh or sudo ufw allow 22/tcp
    4. Enable the firewall: sudo ufw enable
      • It will warn that this may disrupt existing connections. Type y and press Enter.
    5. Verify status: sudo ufw status verbose
      • It should now say Status: active.
      • Default incoming policy should be deny (incoming).
      • Default outgoing policy should be allow (outgoing).
      • If you allowed SSH, you'll see a rule for it.
  7. (Optional) Explore Ubuntu Software Center:
    • Open "Ubuntu Software."
    • Browse categories or search for an application you might want (e.g., "Spotify," "Steam," "Inkscape").
    • Try installing an application from here.

Outcome:

Your Ubuntu system is now updated, has some common applications installed, some basic customizations applied, and a firewall enabled. You've practiced using both terminal commands and graphical tools for system management. Your system is now much more personalized and ready for daily use or further exploration.

5. Understanding Disk Layouts and Filesystems In-Depth

During the installation, particularly if you chose the "Something else" option, you interacted with concepts like MBR/GPT, partitions, and filesystems. This section delves deeper into these topics, providing a more thorough understanding of how your storage is organized and managed in Ubuntu. This knowledge is crucial for advanced disk management, troubleshooting, and making informed decisions about future storage setups.

Revisiting MBR vs. GPT

As mentioned earlier, MBR (Master Boot Record) and GPT (GUID Partition Table) are two different methods of storing partitioning information on a disk.

MBR (Master Boot Record)

  • Historical Context:
    The traditional partitioning scheme used with BIOS-based systems for decades.
  • Structure (located in the first sector of the disk - LBA 0):
    1. Boot Code (approx. 440-446 bytes):
      Small program that typically loads the next stage of the bootloader from an active partition.
    2. Partition Table (64 bytes):
      Contains entries for up to four primary partitions. Each entry is 16 bytes and defines the start, end, size, type, and bootable status of a partition.
    3. Disk Signature (Boot Signature - 2 bytes):
      0x55AA. Marks the end of the MBR and indicates it's a bootable disk.
  • Limitations:
    • Maximum 4 Primary Partitions:
      To have more, one primary partition must be designated as an "extended partition," which can then contain multiple "logical partitions." This is a workaround and adds complexity.
    • Maximum Disk Size of 2.2 Terabytes (TB):
      MBR uses 32-bit addresses for sector locations. With 512-byte sectors (standard), this limits addressable space to 232 * 512 bytes = 2 TiB (tebibytes), roughly 2.2 TB. Disks larger than this cannot be fully utilized with MBR for booting.
    • Single Point of Failure:
      The partition table is stored only in the MBR. If this sector is corrupted, it can be very difficult to recover partition information.
  • When you might still encounter MBR:
    • Older computers (pre-~2010) that use BIOS firmware.
    • USB flash drives or smaller external drives sometimes default to MBR for broader compatibility.
    • Systems where UEFI is run in CSM (Compatibility Support Module) or "Legacy" mode.

GPT (GUID Partition Table)

  • Modern Standard:
    Part of the UEFI (Unified Extensible Firmware Interface) specification, designed to overcome MBR's limitations.
  • Structure:
    1. Protective MBR (LBA 0):
      The first sector of a GPT disk contains a "protective MBR." This MBR lists a single partition of type 0xEE (GPT Protective) spanning the entire usable part of the disk (or up to the 2.2TB MBR limit). Its purpose is to prevent MBR-only disk utilities from misinterpreting the disk as unpartitioned or empty and potentially overwriting GPT data. It also contains boot code for legacy BIOS systems if configured for BIOS-GPT boot (less common).
    2. Primary GPT Header (LBA 1):
      • Contains the disk's unique GUID (Globally Unique Identifier).
      • Points to the location of the partition entry array.
      • Specifies the size and number of partition entries.
      • Contains a CRC32 checksum for the GPT header itself and another for the partition entry array, allowing detection of corruption.
    3. Partition Entry Array (usually starting at LBA 2):
      • A block of sectors where individual partition entries are stored. By default, space for 128 partition entries is common, but this can be configured.
      • Each entry is typically 128 bytes and contains:
        • Partition Type GUID (defines the purpose, e.g., EFI System Partition, Linux filesystem data, Windows Basic Data).
        • Unique Partition GUID.
        • Starting and ending LBA (Logical Block Address) using 64-bit values (allowing for vastly larger disks).
        • Partition attributes (e.g., read-only, hidden).
        • Partition Name (a human-readable Unicode string, e.g., "Linux home").
    4. Partition Data:
      The actual space on the disk used by the partitions.
    5. Backup Partition Entry Array (at the end of the disk):
      A copy of the partition entries.
    6. Backup GPT Header (last sector of the disk):
      A copy of the Primary GPT Header.
  • Advantages:
    • Supports Vastly Larger Disks:
      Uses 64-bit LBA addressing, theoretically supporting disks up to 8 ZiB (zettabytes) with 512-byte sectors.
    • More Partitions:
      Supports many more partitions directly without needing an extended/logical structure (typically 128, but configurable).
    • Redundancy and Integrity:
      Stores a primary and a backup copy of the GPT header and partition table. Uses CRC32 checksums to detect corruption in these structures, allowing for potential self-repair if one copy is damaged.
    • Unique GUIDs:
      Every GPT disk and every partition on it has a unique GUID, reducing chances of collision.
  • When to use GPT:
    • All modern systems using UEFI firmware MUST use GPT for the boot disk.
    • Any disk (boot or data) larger than 2.2 TB.
    • Recommended for all new disk initializations, even on smaller disks, for its robustness.

How to Check if Your Disk Uses MBR or GPT (in Linux):

  • Using fdisk:
    sudo fdisk -l /dev/sdX  # Replace /dev/sdX with your disk, e.g., /dev/sda
    
    Look for the line "Disklabel type:". It will say dos (for MBR) or gpt.
  • Using gdisk (GPT fdisk):
    sudo gdisk -l /dev/sdX
    
    If it's a GPT disk, it will show GPT information. If it's MBR, it will often say "MBR: protective" or "MBR: MBR only" and might offer to convert (don't do this without understanding the implications).
  • Using GParted (Graphical): Launch GParted. Select your disk. Go to View -> Device Information. The "Partition table" field will show msdos (for MBR) or gpt.

Deep Dive into Common Linux Filesystems

A filesystem is a method and data structure that an operating system uses to control how data is stored and retrieved. It organizes files into a hierarchy of directories and keeps track of metadata (like permissions, ownership, timestamps, and file location). Linux supports a wide variety of filesystems.

ext4 (Fourth Extended Filesystem)

  • Overview:
    The default filesystem for most Linux distributions, including Ubuntu, for many years. It's a journaling filesystem known for its stability, reliability, and good all-around performance. It's an evolution of ext3 and ext2.
  • Key Features:
    • Journaling:
      This is a crucial feature for data integrity. Before changes are actually written to the main filesystem, they are first recorded in a dedicated area called a "journal."
      • How it works:
        If the system crashes or loses power unexpectedly during a write operation, the filesystem can check the journal upon reboot. It can then either complete the pending operations ("replay the journal") or roll them back, bringing the filesystem to a consistent state quickly and reducing the risk of data corruption. This significantly speeds up recovery compared to older non-journaled filesystems that required a full fsck (filesystem check).
      • Modes:
        ext4 supports different journaling modes (e.g., data=ordered (default), data=writeback, data=journal). ordered mode ensures data is written to disk before its metadata is committed to the journal, offering a good balance of performance and integrity.
    • Extents:
      A more efficient way to store file data on disk compared to the traditional block mapping used by ext2/ext3. An extent is a contiguous range of physical blocks. For large files, this means fewer metadata entries are needed to describe where the file's data is located, leading to faster file access and reduced fragmentation.
    • Delayed Allocation (allocate-on-flush):
      Instead of allocating blocks immediately when data is written to the page cache, ext4 delays allocation until the data is actually being written to disk (flushed). This allows the filesystem to make better decisions about block placement, potentially allocating larger, more contiguous extents and improving performance and reducing fragmentation.
    • Large Storage Support:
      Supports individual file sizes up to 16 TiB and filesystem sizes up to 1 EiB (exbibyte), though practical limits are often imposed by kernel or tool constraints. For current hardware, these limits are effectively very large.
    • Backward Compatibility:
      Can mount ext2 and ext3 filesystems as ext4. An ext3 filesystem can be upgraded to ext4 (though some new features might not be available without a full reformat).
    • Online Defragmentation:
      While ext4 is designed to minimize fragmentation (due to extents and delayed allocation), some fragmentation can still occur. Online defragmentation tools exist (e4defrag), but are less commonly needed than on, say, FAT32 or NTFS.
    • Nanosecond Timestamps:
      Provides more precise file timestamps.
  • Tools:
    • mkfs.ext4:
      Creates an ext4 filesystem (e.g., sudo mkfs.ext4 /dev/sdXN).
    • tune2fs:
      Modifies tunable filesystem parameters (e.g., change volume label, set reserved block percentage, enable/disable features).
    • e2fsck:
      Checks and repairs ext4 (and ext2/ext3) filesystems. Usually run automatically on boot if inconsistencies are detected.
    • resize2fs:
      Resizes ext4 filesystems (can often be done online for growth, offline for shrinking).

Btrfs (B-tree Filesystem)

  • Overview:
    A modern copy-on-write (CoW) filesystem for Linux, designed with advanced features, scalability, and data integrity in mind. It aims to address shortcomings in older filesystems and provide features often found in enterprise storage systems like ZFS.
  • Key Features:
    • Copy-on-Write (CoW):
      When data is modified, Btrfs does not overwrite the existing data blocks. Instead, it writes the modified data to a new location and then updates the metadata pointers.
      • Benefits:
        • Snapshots:
          CoW makes creating near-instantaneous, space-efficient snapshots very easy. A snapshot initially shares all its data blocks with the original. Only when data changes in either the original or the snapshot are new blocks written.
        • Data Integrity:
          Helps protect against data corruption from unexpected power loss during writes, as the old version of the data remains intact until the new write is complete and metadata is updated.
        • Writable Snapshots (Clones):
          Snapshots can be writable, effectively creating clones.
    • Subvolumes:
      Btrfs allows a single filesystem to be divided into multiple "subvolumes."
      • Subvolumes are not like traditional partitions; they share the underlying disk space from the same Btrfs pool.
      • Each subvolume can be mounted independently and can have its own snapshots.
      • They behave somewhat like flexible, dynamically sized partitions within the main filesystem. For example, / and /home can be separate subvolumes.
      • This makes it easy to snapshot the root filesystem independently of the home directory, or roll back system changes without affecting user data.
    • Snapshots:
      • Read-only snapshots:
        Capture a point-in-time state of a subvolume. Excellent for backups or before system upgrades.
      • Writable snapshots:
        Act as clones, allowing modifications without affecting the original.
    • Built-in RAID Capabilities:
      Btrfs can manage multiple devices and provide RAID functionality directly within the filesystem.
      • Supports RAID0 (striping), RAID1 (mirroring), RAID10 (striping and mirroring).
      • RAID5 and RAID6 support exists but has historically been considered less stable or had write-hole issues, though improvements are ongoing. Always check current status if considering Btrfs RAID5/6.
      • It can mix data and metadata RAID levels (e.g., metadata mirrored (RAID1) even if data is single or RAID0).
    • Checksums and Self-Healing:
      Btrfs stores checksums (e.g., CRC32C) for both data and metadata.
      • When data is read, the checksum is verified. If a mismatch is detected (bit rot), and a redundant copy exists (e.g., in a RAID1/10 setup), Btrfs can automatically repair the corrupted block using a good copy.
      • Periodic "scrubbing" can be initiated to read all data and metadata and verify checksums, detecting and potentially repairing silent corruption.
    • Transparent Compression:
      Supports zlib, lzo, and zstd compression, which can be enabled per-file, per-directory, or for the entire filesystem. This can save space and sometimes improve performance (by reducing I/O) at the cost of some CPU.
    • Online Operations:
      Many operations like adding/removing devices, resizing the filesystem, balancing data across devices, and creating/deleting subvolumes/snapshots can be done online while the filesystem is mounted and in use.
    • Send/Receive Snapshots:
      Allows efficient incremental backups by sending the differences between two snapshots to another location (e.g., an external drive or another Btrfs filesystem).
  • Tools:
    • mkfs.btrfs: Creates a Btrfs filesystem (e.g., sudo mkfs.btrfs /dev/sdXN or sudo mkfs.btrfs -L mylabel /dev/sda /dev/sdb for a multi-device filesystem).
    • btrfs command suite: A powerful single command with many subcommands:
      • sudo btrfs subvolume create /mnt/mybtrfs/mysubvol
      • sudo btrfs subvolume snapshot /mnt/mybtrfs/mysubvol /mnt/mybtrfs/mysubvol_snap
      • sudo btrfs filesystem show
      • sudo btrfs device add /dev/sdc /mnt/mybtrfs
      • sudo btrfs balance start /mnt/mybtrfs
      • sudo btrfs scrub start /mnt/mybtrfs
  • Considerations:
    While very powerful, Btrfs has a steeper learning curve than ext4. Its feature set is constantly evolving.

XFS (Extended File System)

  • Overview:
    A high-performance 64-bit journaling filesystem originally developed by Silicon Graphics (SGI) for their IRIX operating system and later ported to Linux. It's known for its excellent performance with large files and large numbers of files, scalability, and robustness.
  • Key Features:
    • High Performance for Large Files and Parallel I/O:
      XFS excels in scenarios involving large files (e.g., video editing, scientific computing, databases) and workloads with many parallel read/write operations. This is due to its extent-based allocation and efficient metadata handling.
    • Journaling:
      Provides metadata journaling for fast recovery after crashes. Data journaling can also be enabled but is less common.
    • Allocation Groups (AGs):
      The filesystem space is divided into multiple AGs. Each AG manages its own inodes and free space, allowing for greater parallelism in filesystem operations because multiple AGs can be updated concurrently. This contributes significantly to XFS's scalability.
    • Delayed Allocation:
      Similar to ext4, XFS uses delayed allocation to improve block placement and reduce fragmentation.
    • Dynamic Inodes:
      Inodes (which store file metadata) are allocated dynamically as needed within each AG, rather than being pre-allocated across the entire filesystem at creation time.
    • Online Defragmentation and Growth:
      XFS supports online defragmentation (xfs_fsr) and can be grown online (xfs_growfs). Shrinking an XFS filesystem is not supported directly; you'd need to back up data, re-create the filesystem smaller, and restore.
    • Large Filesystem Support:
      Designed for very large filesystems and file sizes.
    • Reflinks (Copy-on-Write for files):
      XFS supports reflinks (cp --reflink), allowing instant, space-efficient copies of files. Changes to one copy do not affect the other until blocks are modified.
  • Tools:
    • mkfs.xfs: Creates an XFS filesystem (e.g., sudo mkfs.xfs /dev/sdXN).
    • xfs_info: Displays XFS filesystem geometry and information.
    • xfs_repair: Checks and repairs XFS filesystems. Must be run on an unmounted filesystem.
    • xfs_growfs: Grows an XFS filesystem (must be mounted).
    • xfs_fsr: Filesystem reorganizer (defragmenter) for XFS.
    • xfs_admin: Modifies parameters of an XFS filesystem.
  • Common Use Cases:
    Often preferred for large storage servers, database servers, and systems handling massive multimedia files. Red Hat Enterprise Linux and its derivatives use XFS as the default filesystem for /.

ZFS (Zettabyte File System) on Linux

  • Overview:
    Originally developed by Sun Microsystems for Solaris, ZFS is an extremely advanced filesystem and logical volume manager renowned for its focus on data integrity, scalability, and rich feature set. It's available on Linux through the OpenZFS project.
  • Key Features:
    • Pooled Storage (zpools):
      ZFS manages storage as "pools" (zpools). A zpool is constructed from one or more virtual devices (vdevs). Vdevs can be individual disks, partitions, files, or mirrors (RAID1), RAID-Z1 (like RAID5), RAID-Z2 (like RAID6), RAID-Z3, dRAID (distributed RAID), or stripes (RAID0).
    • Copy-on-Write (CoW):
      All operations are CoW. Data blocks are never overwritten in place. This is fundamental to many of its features like snapshots and data integrity.
    • Snapshots and Clones:
      ZFS provides extremely efficient, instantaneous snapshots and writable clones of datasets and ZVOLs.
    • End-to-End Data Integrity:
      • Checksums:
        All data and metadata blocks are checksummed (e.g., sha256, sha512, blake3). Checksums are stored with the parent block's pointer, not with the data itself, preventing "phantom writes" where the disk reports a write as successful but the data is actually corrupted or written to the wrong place.
      • Self-Healing:
        If a checksum mismatch is detected on read and redundant storage is available (e.g., mirror or RAID-Z vdev), ZFS can automatically reconstruct the correct data from a good copy and repair the corruption.
      • Scrubbing:
        A background process (zpool scrub) reads all data in the pool, verifies checksums, and repairs any corruption found if redundancy allows.
    • RAID-Z:
      ZFS's own implementations of RAID. RAID-Z1/2/3 avoid the "RAID write hole" (a data consistency issue that can occur in traditional hardware/software RAID5/6 if power is lost during a write of a full stripe) due to its CoW nature.
    • Datasets and ZVOLs:
      • Datasets:
        Filesystems within a ZFS pool. They can have their own properties (mount point, compression, quotas, snapshots, etc.) and are hierarchical.
      • ZVOLs (ZFS Emulated Volumes):
        Block devices within a ZFS pool. Can be used for iSCSI targets, virtual machine disks, or even swap.
    • Transparent Compression:
      Supports various compression algorithms (e.g., LZ4 (fast, default), ZSTD (good ratio), GZIP). Compression is applied on the fly.
    • Transparent Deduplication:
      Can identify and store only one copy of identical blocks, saving space. However, deduplication can be very RAM-intensive and may impact performance if not carefully planned.
    • ARC (Adaptive Replacement Cache):
      ZFS uses a sophisticated caching mechanism (ARC) that utilizes system RAM to cache frequently accessed data, significantly improving read performance. It also has a second-level cache (L2ARC) that can use fast SSDs.
    • SLOG (Separate ZFS Intent Log):
      For synchronous writes, ZFS uses an intent log (ZIL). A fast, separate SSD (SLOG device) can be used to store the ZIL, improving performance for synchronous write-heavy workloads (e.g., databases, NFS).
    • Scalability:
      Designed to manage petabytes of data.
  • Tools:
    • zpool:
      Manages storage pools (create, destroy, add devices, check status, scrub, etc.).
      • sudo zpool create mypool /dev/sda /dev/sdb (creates a striped pool)
      • sudo zpool create mymirrorpool mirror /dev/sda /dev/sdb
      • sudo zpool status
      • sudo zpool scrub mypool
    • zfs:
      Manages datasets and ZVOLs (create, destroy, set properties, snapshot, clone, send/receive).
      • sudo zfs create mypool/mydata
      • sudo zfs snapshot mypool/mydata@snap1
      • sudo zfs set compression=lz4 mypool/mydata
      • sudo zfs list
  • Considerations:
    • RAM:
      ZFS can be memory-hungry, especially with features like deduplication. A general rule of thumb is at least 1GB of RAM per TB of storage for basic use, more for advanced features or high performance.
    • Complexity:
      Very powerful but has a significant learning curve.
    • Licensing:
      ZFS code (CDDL license) is not compatible with the Linux kernel's GPL license, so OpenZFS is typically provided as kernel modules that are built and loaded separately (DKMS often handles this). This has been a point of discussion but is generally a solved problem for users.
    • Booting:
      Booting from ZFS root is possible and supported by Ubuntu's installer in some configurations ("Erase disk and install Ubuntu" -> Advanced -> ZFS).

Logical Volume Management (LVM)

LVM is a disk management framework for Linux that provides a higher-level abstraction over physical storage, offering more flexibility than traditional partitions. Ubuntu's installer offers LVM as an option.

Core LVM Concepts:

  1. Physical Volumes (PVs):
    • These are the underlying physical storage units that LVM uses.
    • A PV can be an entire hard disk (e.g., /dev/sdb), a disk partition (e.g., /dev/sda2), or even a loop device.
    • You initialize a block device as a PV using pvcreate.
  2. Volume Groups (VGs):
    • A VG is a pool of storage created by grouping one or more PVs.
    • It acts as a single, large container of disk space from which Logical Volumes can be allocated.
    • You create a VG using vgcreate, adding PVs to it. You can later extend a VG by adding more PVs (vgextend).
  3. Logical Volumes (LVs):
    • LVs are "virtual" or "logical" partitions carved out from the space within a VG.
    • LVs are what you format with a filesystem (e.g., ext4, xfs) and mount.
    • They behave like regular partitions to the operating system and applications.
    • You create LVs using lvcreate.
    • The key benefit is that LVs can be resized (grown or shrunk, though shrinking requires filesystem support and caution) easily, even if they are not contiguous on the underlying physical disks. LVs can also span multiple PVs if the VG contains them.

Diagram:

+---------------------------------+  +---------------------------------+
| Physical Disk 1 (/dev/sda)      |  | Physical Disk 2 (/dev/sdb)      |
| +-----------+  +------------+   |  | +-----------+                   |
| | Partition |  | Partition  |   |  | | Partition |                   |
| | /dev/sda1 |  | /dev/sda2  |   |  | | /dev/sdb1 |                   |
| | (PV)      |  | (non-LVM)|   |  | | (PV)      |                   |
| +-----------+  +------------+   |  | +-----------+                   |
+---------------------------------+  +---------------------------------+
       |                                  |
       +-----------------+------------------+
                         |
          +------------------------------+
          | Volume Group (VG) e.g., my_vg|
          | (Total space from PVs)       |
          +------------------------------+
                         |
     +-------------------+-------------------+
     |                                       |
+--------------+                       +--------------+
| Logical Vol  |                       | Logical Vol  |
| LV1 (e.g. root)                      | LV2 (e.g. home)
| Formatted with ext4, mounted at /    | Formatted with ext4, mounted at /home
+--------------+                       +--------------+

Benefits of LVM:

  • Flexibility in Resizing:
    • LVs can be easily extended if there is free space in the VG. lvextend followed by resizing the filesystem (resize2fs for ext4, xfs_growfs for XFS).
    • LVs can be shrunk if the filesystem supports it and data is moved. lvreduce.
  • Abstraction from Physical Layout:
    LVs are not tied to the physical layout of disks. A single LV can span multiple PVs.
  • Adding/Removing Storage:
    You can add new disks, initialize them as PVs, add them to a VG (vgextend), and then either create new LVs or extend existing ones. You can also remove PVs from a VG (vgreduce) if data can be moved off them.
  • Snapshots:
    LVM supports creating snapshots of LVs.
    • Snapshots are point-in-time, copy-on-write copies. Initially, they consume very little space. As data changes on the original LV or the snapshot, changed blocks are stored in the snapshot's allocated space.
    • Useful for backups (backup the consistent snapshot while the original LV remains active) or for testing changes (if something goes wrong, revert to the snapshot).
  • Thin Provisioning:
    Allows you to define LVs that are larger than the currently available physical space, allocating space only as it's written to. This can be useful for VMs or when you're unsure of future space needs, but requires careful monitoring to avoid running out of actual space in the VG.
  • Striping and Mirroring (LVM RAID):
    LVM can create LVs with RAID0 (striping), RAID1 (mirroring), RAID4, RAID5, RAID6, and RAID10 configurations. This is an alternative to mdadm (Linux software RAID) or filesystem-level RAID (like Btrfs/ZFS).

Common LVM Commands:

  • Physical Volume (PV) commands:
    • sudo pvdisplay: Shows information about PVs.
    • sudo pvscan: Scans for PVs on all block devices.
    • sudo pvcreate /dev/sdXN: Initializes a partition as a PV.
    • sudo pvremove /dev/sdXN: Removes LVM metadata from a PV.
  • Volume Group (VG) commands:
    • sudo vgdisplay: Shows information about VGs.
    • sudo vgscan: Scans for VGs.
    • sudo vgcreate <vg_name> /dev/sdXN /dev/sdYN: Creates a VG named <vg_name> from specified PVs.
    • sudo vgextend <vg_name> /dev/sdZN: Adds a PV to an existing VG.
    • sudo vgreduce <vg_name> /dev/sdZN: Removes a PV from a VG (data must be moved off it first using pvmove).
    • sudo vgremove <vg_name>: Removes a VG (all LVs within it must be removed first).
  • Logical Volume (LV) commands:
    • sudo lvdisplay: Shows information about LVs.
    • sudo lvscan: Scans for LVs.
    • sudo lvcreate -L <size>G -n <lv_name> <vg_name>: Creates an LV of <size> GB named <lv_name> from <vg_name>. (e.g., sudo lvcreate -L 20G -n lv_root vg_main)
    • sudo lvcreate -l <percentage>%FREE -n <lv_name> <vg_name>: Creates an LV using a percentage of the free space in the VG.
    • sudo lvextend -L +<size>G /dev/<vg_name>/<lv_name>: Extends an LV by <size> GB. (Then resize filesystem).
    • sudo lvextend -l +100%FREE /dev/<vg_name>/<lv_name>: Extends an LV to use all remaining free space in the VG.
    • sudo lvreduce -L -<size>G /dev/<vg_name>/<lv_name>: Shrinks an LV by <size> GB. (Shrink filesystem first).
    • sudo lvremove /dev/<vg_name>/<lv_name>: Removes an LV.
    • sudo lvrename /dev/<vg_name>/<old_lv_name> /dev/<vg_name>/<new_lv_name>: Renames an LV.
  • LVM Snapshots:
    • sudo lvcreate -L <snapshot_size>G -s -n <snapshot_name> /dev/<vg_name>/<original_lv_name>: Creates a snapshot. The size determines how many changes can be stored.
    • sudo lvconvert --merge /dev/<vg_name>/<snapshot_name>: Merges a snapshot back into its origin LV (reverting changes). The snapshot must be unmounted.

When Ubuntu is installed with the "Use LVM" option, it typically creates a VG spanning the selected disk/partition, and then creates LVs for / (root) and swap within that VG. /home is often part of the root LV unless you manually configure it differently.

Swap Space Revisited

Swap space is disk space used as an extension of your system's RAM. When physical RAM is full, the Linux kernel moves inactive memory pages (blocks of memory) from RAM to the swap space on the disk to free up RAM for active processes. This process is called "swapping out." When a swapped-out page is needed again, it's "swapped in" from the disk back to RAM.

Swap Partition vs. Swap File

Ubuntu can use either a dedicated swap partition or a swap file on an existing filesystem.

  1. Swap Partition:

    • Traditional approach.
      A distinct partition on your disk designated solely for swap.
    • Creation:
      Can be created during Ubuntu installation (using the "Something else" option and selecting "swap area" as the type) or post-installation using tools like fdisk or gparted to create the partition, then mkswap to format it as swap, and swapon to enable it. An entry in /etc/fstab makes it permanent.
    • Pros:
      • Potentially slightly better performance in some very specific, high-I/O scenarios (though this is often debated and marginal on modern systems/SSDs).
      • Required for hibernation by some older configurations, or considered simpler for hibernation.
    • Cons:
      • Less flexible. Resizing a swap partition usually requires unmounting it (disabling swap) and using partition management tools, which can be disruptive.
      • Space is fixed and dedicated. If you rarely swap, the space is "wasted."
  2. Swap File:

    • Modern approach, often the default in recent Ubuntu installers if you don't manually create a swap partition.
      A regular file created on an existing filesystem (e.g., on your root / partition) that is designated to be used as swap space.
    • Creation (post-installation example):
      1. Create an empty file of the desired size (e.g., 4GB):
        sudo fallocate -l 4G /swapfile
        
        (Alternatively, sudo dd if=/dev/zero of=/swapfile bs=1G count=4 for older systems or certain filesystems that don't support fallocate well for swap, but fallocate is preferred).
      2. Set correct permissions (only root should access it):
        sudo chmod 600 /swapfile
        
      3. Format the file as swap:
        sudo mkswap /swapfile
        
      4. Enable the swap file:
        sudo swapon /swapfile
        
      5. Make it permanent by adding an entry to /etc/fstab: Open /etc/fstab with a text editor (e.g., sudo nano /etc/fstab) and add the line: /swapfile none swap sw 0 0
      6. Verify: swapon --show or free -h.
    • Pros:
      • More flexible:
        Easier to create, resize, or remove. To resize, you typically swapoff the file, delete it, create a new one with the desired size, mkswap, and swapon.
      • Doesn't require repartitioning your disk.
    • Cons:
      • Some filesystems (like Btrfs) have special considerations or limitations for swap files. On Btrfs, swap files must be on non-snapshotted subvolumes, have CoW disabled (chattr +C /swapfile before data is written), and might have some performance caveats compared to partitions, though recent kernels have improved this. ext4 handles swap files very well.
      • Hibernation with a swap file can be more complex to set up, requiring kernel parameters to specify the resume file and its offset.

Swap Size Recommendations (Revisited):

  • No Hibernation:
    • RAM <= 1GB: Swap = At least RAM size, preferably 2x RAM.
    • RAM > 1GB and <= 2GB: Swap = 1.5x to 2x RAM.
    • RAM > 2GB and <= 8GB: Swap = RAM size.
    • RAM > 8GB and <= 64GB: Swap = At least 4GB, up to 0.5x RAM. Or, sqrt(RAM) is a common recommendation.
    • RAM > 64GB: Swap = At least 4GB, or minimal swap if you are certain your workloads will never exceed RAM. Some applications might still benefit from having some swap available.
  • With Hibernation: Swap space (partition or file) MUST be at least the size of your physical RAM. It's often recommended to make it slightly larger (e.g., RAM + 10% or RAM + sqrt(RAM) if sqrt(RAM) is a few GB) to accommodate a full RAM dump plus any active swapping that might be occurring.

swappiness Parameter:

  • This kernel parameter controls how aggressively the kernel swaps memory pages to disk. It's a value between 0 and 100.
    • vm.swappiness = 0: Kernel will avoid swapping out pages unless absolutely necessary (out of memory).
    • vm.swappiness = 60: The default value in Ubuntu. A balanced approach.
    • vm.swappiness = 100: Kernel will swap very aggressively.
  • Checking current swappiness:
    cat /proc/sys/vm/swappiness
    
  • Changing swappiness temporarily (until next reboot):
    sudo sysctl vm.swappiness=10  # Example: reduce swappiness
    
  • Changing swappiness permanently:
    1. Edit /etc/sysctl.conf (or create a file in /etc/sysctl.d/, e.g., /etc/sysctl.d/99-swappiness.conf): sudo nano /etc/sysctl.conf
    2. Add or modify the line: vm.swappiness=10
    3. Save the file and apply the change: sudo sysctl -p (or reboot).
  • When to adjust:
    • Desktops/Workstations (especially with SSDs and ample RAM):
      Many users prefer to lower swappiness (e.g., to 10 or 20) to make the system prioritize keeping things in RAM and use swap less, as disk I/O is much slower. This can improve responsiveness if you have enough RAM.
    • Servers (especially memory-constrained or with specific workloads):
      The default might be fine, or adjustments might be needed based on application behavior.

Hibernation (Suspend-to-Disk)

  • Hibernation saves the entire state of your system (contents of RAM) to the swap space and then powers off the computer completely. When you turn the computer back on, it restores the state from swap, allowing you to resume exactly where you left off, with all applications and documents open.
  • Requirements for Hibernation:
    1. Sufficient Swap Space:
      Your swap partition or swap file must be at least as large as your physical RAM, preferably slightly larger.
    2. Kernel Support and Configuration:
      The kernel needs to know where to find the swap space to resume from. This is typically configured via a kernel boot parameter:
      • For Swap Partition:
        resume=UUID=<UUID_of_swap_partition>
        • Find the UUID with blkid or lsblk -f.
      • For Swap File:
        resume=UUID=<UUID_of_partition_hosting_swapfile> resume_offset=<physical_offset_of_swapfile>
        • Finding the resume_offset can be tricky. sudo filefrag -v /swapfile can show extents; the first value under physical_offset in the [00] extent line is often used.
        • This needs to be added to your GRUB configuration (e.g., in /etc/default/grub on the GRUB_CMDLINE_LINUX_DEFAULT line, then run sudo update-grub).
    3. Secure Boot:
      Hibernation can sometimes have complications with Secure Boot enabled, as the resumed kernel image might not be validated in the same way as a fresh boot. This varies by system and configuration.
    4. Hardware/Driver Compatibility:
      Some hardware or drivers might not resume correctly from hibernation.
  • Enabling Hibernation (General Idea - can be complex):
    • Ubuntu Desktop often disables hibernation by default due to potential complexities and the prevalence of fast SSDs making regular boot times short.
    • You'd typically need to:
      1. Ensure adequate swap.
      2. Configure the resume kernel parameter in GRUB.
      3. Potentially adjust PolicyKit rules to allow hibernation from the desktop menus (e.g., by creating a file like /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla with appropriate content).
    • Testing hibernation is crucial: sudo systemctl hibernate. If it works, your system will power off. Power it back on to see if it resumes.
  • Troubleshooting Hibernation:
    Can involve checking kernel logs (dmesg), ensuring correct resume parameters, checking for driver issues, and sometimes kernel recompilation or specific workarounds. It's often considered an advanced topic.

Workshop Advanced Disk Management

These workshops will allow you to practice working with LVM, Btrfs, and swap files in a safe virtual machine environment.

Prerequisites:

  • A working Ubuntu VM (e.g., the one from "Manual Partition Installation" or a fresh one).
  • Ability to add virtual disks to your VM in VirtualBox/VMware.
  • Comfort with the command line.

Project 1: LVM Operations Post-Installation

Objective:

To create and manage LVM volumes on a new virtual disk added to your Ubuntu VM.

VM Setup:

  1. In your VM software, add a new virtual hard disk to your Ubuntu VM. Size: e.g., 10GB. (Ensure the VM is powered off when adding hardware).
  2. Boot your Ubuntu VM. The new disk should appear as /dev/sdb (or /dev/vdb if using KVM/QEMU virtio drivers). Verify with lsblk.

Steps:

  1. Initialize Physical Volume (PV):
    sudo pvcreate /dev/sdb
    sudo pvdisplay /dev/sdb # Verify
    
  2. Create Volume Group (VG):
    sudo vgcreate data_vg /dev/sdb
    sudo vgdisplay data_vg # Verify
    
  3. Create Logical Volumes (LVs):
    • Create an LV for "projects," 5GB, formatted with ext4:
      sudo lvcreate -L 5G -n projects_lv data_vg
      sudo mkfs.ext4 /dev/data_vg/projects_lv
      
    • Create an LV for "backups," 3GB, formatted with ext4:
      sudo lvcreate -L 3G -n backups_lv data_vg
      sudo mkfs.ext4 /dev/data_vg/backups_lv
      
    • Verify LVs: sudo lvdisplay
  4. Mount the LVs:
    • Create mount points:
      sudo mkdir /mnt/projects
      sudo mkdir /mnt/backups
      
    • Mount them:
      sudo mount /dev/data_vg/projects_lv /mnt/projects
      sudo mount /dev/data_vg/backups_lv /mnt/backups
      
    • Check mounts: df -hT
    • (Optional) Add to /etc/fstab for permanent mounting. Use blkid to get UUIDs for the LVs. Example line for /etc/fstab: UUID="<projects_lv_uuid>" /mnt/projects ext4 defaults 0 2
  5. Extend the "projects_lv":
    • Assume projects_lv is running out of space and data_vg has free space.
    • Extend the LV by 1GB (assuming there's 1GB free in data_vg):
      sudo lvextend -L +1G /dev/data_vg/projects_lv
      
    • Resize the filesystem on it (online for ext4):
      sudo resize2fs /dev/data_vg/projects_lv
      
    • Verify new size: df -hT /mnt/projects and sudo lvdisplay /dev/data_vg/projects_lv
  6. Create and Use an LVM Snapshot:
    • Create a snapshot of projects_lv (size 500MB, for example, for changes):
      sudo lvcreate -L 500M -s -n projects_snap /dev/data_vg/projects_lv
      
    • Create a mount point for the snapshot and mount it:
      sudo mkdir /mnt/projects_snapshot
      sudo mount /dev/data_vg/projects_snap /mnt/projects_snapshot
      
    • Make some changes to the original projects_lv (e.g., create a file in /mnt/projects).
      sudo touch /mnt/projects/new_file_on_original.txt
      ls /mnt/projects
      ls /mnt/projects_snapshot # new_file_on_original.txt should NOT be here
      
    • Observe that the snapshot (/mnt/projects_snapshot) reflects the state before the change.
    • To revert (example): (This is destructive to current projects_lv content)
      1. Unmount both:
        sudo umount /mnt/projects
        sudo umount /mnt/projects_snapshot
        
      2. Merge the snapshot back (reverts projects_lv to the state of projects_snap):
        sudo lvconvert --merge /dev/data_vg/projects_snap
        
        (This might take time and the snapshot LV will be removed upon successful merge).
      3. Remount projects_lv:
        sudo mount /dev/data_vg/projects_lv /mnt/projects
        ls /mnt/projects # new_file_on_original.txt should be gone
        
    • To simply remove a snapshot without merging:
      # sudo umount /mnt/projects_snapshot (if mounted)
      # sudo lvremove /dev/data_vg/projects_snap
      
  7. Cleanup (Optional):
    • Unmount LVs, remove LVs, VG, and PV if you want to reuse the disk.
      sudo umount /mnt/projects
      sudo umount /mnt/backups
      sudo lvremove /dev/data_vg/projects_lv
      sudo lvremove /dev/data_vg/backups_lv
      # sudo lvremove /dev/data_vg/projects_snap (if not merged)
      sudo vgremove data_vg
      sudo pvremove /dev/sdb
      

Project 2: Btrfs Subvolumes and Snapshots

Objective:

To format a disk with Btrfs, create subvolumes, and practice snapshotting.

VM Setup:

  • Use the same Ubuntu VM. If you cleaned up /dev/sdb from Project 1, it's ready. If not, add another small virtual disk (e.g., 5GB, as /dev/sdc). Let's assume /dev/sdb is available and clean.

Steps:

  1. Format Disk with Btrfs:
    sudo mkfs.btrfs -L btrfs_disk /dev/sdb
    
  2. Mount the Btrfs Filesystem:
    • Create a mount point: sudo mkdir /mnt/mybtrfs
    • Mount it: sudo mount /dev/sdb /mnt/mybtrfs
  3. Create Subvolumes:
    • By default, when you mount a Btrfs filesystem, you are mounting its top-level subvolume (ID 5).
    • Create subvolumes for /var/log and /srv (as an example, not actually redirecting system logs here):
      sudo btrfs subvolume create /mnt/mybtrfs/@log
      sudo btrfs subvolume create /mnt/mybtrfs/@srv
      
    • List subvolumes: sudo btrfs subvolume list /mnt/mybtrfs
  4. Populate a Subvolume and Create a Snapshot:
    • Let's work with @log. Imagine these are log files.
      sudo touch /mnt/mybtrfs/@log/log_file_1.log
      sudo echo "Original content" > /mnt/mybtrfs/@log/important_log.log
      
    • Create a read-only snapshot of @log:
      sudo btrfs subvolume snapshot -r /mnt/mybtrfs/@log /mnt/mybtrfs/@log_ro_snap_$(date +%F)
      
      (The $(date +%F) adds the current date to the snapshot name, e.g., 2023-10-27)
    • List subvolumes again to see the snapshot.
  5. Modify Original, Compare with Snapshot:
    • Modify the original @log subvolume:
      sudo echo "Modified content, oops!" > /mnt/mybtrfs/@log/important_log.log
      sudo touch /mnt/mybtrfs/@log/new_log_file.log
      
    • The snapshot still contains the old version. To see this, you would typically mount the snapshot. Btrfs subvolumes (including snapshots) can be mounted like separate filesystems if desired, or accessed via their path within the main Btrfs mount.
    • For simplicity here, let's list contents:
      ls /mnt/mybtrfs/@log/
      # You'll see important_log.log (modified) and new_log_file.log
      
      # Assuming snapshot name is @log_ro_snap_YYYY-MM-DD
      ls /mnt/mybtrfs/@log_ro_snap_YYYY-MM-DD/
      # You'll see log_file_1.log and important_log.log (original content)
      # new_log_file.log will NOT be there.
      cat /mnt/mybtrfs/@log_ro_snap_YYYY-MM-DD/important_log.log # Shows "Original content"
      
  6. Send/Receive a Snapshot (Simulating Backup):
    • This demonstrates how you could back up a snapshot. Let's create another writable snapshot to "send".
      sudo btrfs subvolume snapshot /mnt/mybtrfs/@log /mnt/mybtrfs/@log_backup_snap
      
    • Simulate sending it to a "backup location" (another directory on the same filesystem for this demo):
      sudo mkdir /mnt/mybtrfs/backup_destination
      sudo btrfs send /mnt/mybtrfs/@log_backup_snap | sudo btrfs receive /mnt/mybtrfs/backup_destination/
      
    • Check the received snapshot: ls /mnt/mybtrfs/backup_destination/@log_backup_snap/
  7. Cleanup (Optional):
    • Delete subvolumes/snapshots (use btrfs subvolume delete <path_to_subvolume>).
    • Unmount and reformat the disk if desired.
      # sudo btrfs subvolume delete /mnt/mybtrfs/@log_ro_snap_YYYY-MM-DD
      # sudo btrfs subvolume delete /mnt/mybtrfs/@log_backup_snap
      # sudo btrfs subvolume delete /mnt/mybtrfs/backup_destination/@log_backup_snap
      # sudo btrfs subvolume delete /mnt/mybtrfs/@log
      # sudo btrfs subvolume delete /mnt/mybtrfs/@srv
      # sudo umount /mnt/mybtrfs
      

Project 3: Managing Swap Files

Objective:

To practice creating, enabling, disabling, and resizing a swap file.

VM Setup:

Use your main Ubuntu VM.

Scenario 1: System has a swap partition, convert to swap file.

  1. Identify and Disable Swap Partition:
    • swapon --show (Note the partition, e.g., /dev/sda3).
    • free -h (Note current swap usage).
    • Disable it: sudo swapoff /dev/sda3 (replace with your swap partition).
    • Remove or comment out its entry in /etc/fstab to prevent re-enable on boot. sudo nano /etc/fstab (put # at the beginning of the swap partition line).
  2. Create and Enable Swap File (e.g., 2GB):
    sudo fallocate -l 2G /swapfile
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    
  3. Make Swap File Permanent:
    • Add to /etc/fstab: sudo nano /etc/fstab Add: /swapfile none swap sw 0 0
  4. Verify: swapon --show and free -h.

Scenario 2: System has a swap file, resize it. (Or continue from Scenario 1)

  1. Disable Existing Swap File:
    sudo swapoff /swapfile
    
  2. Remove Old Swap File:
    sudo rm /swapfile
    
  3. Create New, Larger Swap File (e.g., 4GB):
    sudo fallocate -l 4G /swapfile
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile
    
  4. Verify:
    The /etc/fstab entry from before should still work for /swapfile. Check swapon --show and free -h.

Adjusting swappiness (Example):

  1. Check current: cat /proc/sys/vm/swappiness (likely 60).
  2. Change temporarily to 10: sudo sysctl vm.swappiness=10
  3. Change permanently:
    echo 'vm.swappiness=10' | sudo tee /etc/sysctl.d/99-custom-swappiness.conf
    sudo sysctl -p /etc/sysctl.d/99-custom-swappiness.conf # Apply now
    
    Or reboot to confirm it persists.

These workshops provide practical experience with important disk management concepts on Linux. Remember that operations like formatting, deleting partitions/LVs/subvolumes, or incorrectly editing /etc/fstab can lead to data loss or an unbootable system if done on a live production machine without care. VMs are your friend for learning!

6. Troubleshooting Common Installation Issues

Even with careful preparation, you might encounter issues during or immediately after installing Ubuntu. This section covers some common problems and provides guidance on how to troubleshoot them.

Installation Freezes or Fails

If the installer freezes at a certain point or fails with an error message:

  • Check ISO Integrity Again:
    • Symptom:
      Random errors, crashes during file copying.
    • Cause:
      The downloaded Ubuntu .iso file might be corrupted, or the USB drive creation process might have failed.
    • Solution:
      Re-verify the SHA256 checksum of your downloaded .iso file. If it doesn't match the official one, download it again. Re-create the bootable USB drive, possibly using a different USB stick or a different creation tool (e.g., if Rufus failed, try balenaEtcher, or vice-versa).
  • Try a Different USB Port or USB Drive:
    • Symptom:
      Installer doesn't start, freezes early, USB drive not detected.
    • Cause:
      Faulty USB port, problematic USB controller, or a failing USB drive. USB 3.0 ports can sometimes be problematic with older installers or systems; try a USB 2.0 port if available.
    • Solution:
      Switch to a different USB port. Try a completely different USB flash drive.
  • "nomodeset" or Other Kernel Boot Parameters (for Graphics Issues):
    • Symptom:
      System boots to a black screen after selecting "Try or Install Ubuntu," screen garbled, installer freezes after loading the initial environment.
    • Cause:
      Incompatibility between the default open-source graphics drivers (Nouveau for NVIDIA, amdgpu/radeon for AMD) and your specific graphics card, especially very new or very old cards.
    • Solution:
      When the GRUB menu appears (where you choose "Try or Install Ubuntu"):
      1. Highlight "Try or Install Ubuntu" (or "Ubuntu").
      2. Press the e key to edit the boot parameters.
      3. Find the line that starts with linux or linuxefi. It will often end with quiet splash --- or just quiet splash.
      4. Add nomodeset before quiet splash. So it might look like: ... nomodeset quiet splash --- or ... nomodeset quiet splash.
      5. Press Ctrl+X or F10 to boot with this modified parameter.
      6. What nomodeset does:
        It tells the kernel not to load video drivers and to use BIOS/UEFI modes for the display until Xorg (the display server) can load its own drivers. This often results in a lower resolution display during installation but can allow the installer to run.
      7. Other parameters to try if nomodeset doesn't work or causes issues:
        • nouveau.modeset=0 (specifically for NVIDIA cards, to disable Nouveau)
        • radeon.modeset=0 or amdgpu.modeset=0 (for AMD cards)
        • acpi=off (disables ACPI, can help with some power management or hardware initialization issues, but may cause other problems like non-functional power buttons or battery status). Use as a last resort.
        • nolapic or noapic (can help with interrupt handling issues on some older hardware).
    • If this allows installation:
      You'll likely need to install proprietary graphics drivers after installation (see Section 4) for optimal performance. You might also need to make the nomodeset parameter permanent in GRUB for the installed system until drivers are sorted.
  • Check for BIOS/UEFI Updates:
    • Symptom:
      Persistent, unexplainable hardware compatibility issues, freezes.
    • Cause:
      Bugs or lack of support for newer hardware/OS features in an outdated system firmware.
    • Solution:
      Visit your computer or motherboard manufacturer's website and check if there's a newer BIOS/UEFI version available for your model. Updating firmware can be risky; follow the manufacturer's instructions very carefully. This is generally a more advanced troubleshooting step.
  • Insufficient RAM or Disk Space:
    • Symptom:
      Installer reports errors about space, or system becomes extremely slow and then fails.
    • Cause:
      Not meeting the minimum system requirements.
    • Solution:
      Ensure you have at least the minimum RAM (4GB recommended for modern Ubuntu Desktop) and free disk space (25GB recommended minimum). If installing in a VM, allocate sufficient resources.
  • Overheating:
    • Symptom:
      System freezes or shuts down abruptly, especially on laptops or older desktops during intensive tasks like file copying.
    • Cause:
      CPU or other components overheating.
    • Solution:
      Ensure proper ventilation. Clean out dust from fans and heatsinks. On laptops, consider a cooling pad. If it's a persistent issue, there might be a hardware problem.
  • Hardware Failure:
    • Symptom:
      Consistent crashes, read/write errors, inability to detect hard drive.
    • Cause:
      Failing RAM module, failing hard drive/SSD, or other faulty hardware.
    • Solution:
      Run hardware diagnostics. Most BIOS/UEFI setups have built-in memory tests and disk checks. Memtest86+ (bootable) is excellent for RAM. SMART tools (smartctl in Linux) can check disk health. This might require professional repair.

Hardware Not Detected or Not Working Correctly

After installation, you might find some hardware components are not working as expected.

  • Wi-Fi Card Not Working:
    • Symptom:
      No Wi-Fi networks detected, Wi-Fi option greyed out.
    • Cause:
      • Missing firmware:
        Some Wi-Fi cards require binary firmware blobs that may not be included in the main open-source kernel drivers due to licensing.
      • Proprietary drivers needed:
        Cards from Broadcom, Realtek, and sometimes others might need specific proprietary drivers.
      • Hardware switch/key:
        Some laptops have a physical switch or function key combination (e.g., Fn + F2) to enable/disable Wi-Fi. Ensure it's on.
      • rfkill block:
        Software block might be active.
    • Troubleshooting:
      1. Connect via Ethernet (if possible):
        This is the easiest way to get internet access to download necessary drivers/firmware.
      2. Check rfkill:
        Open Terminal: rfkill list all. If anything is "Soft blocked" or "Hard blocked," try sudo rfkill unblock wifi or sudo rfkill unblock all. A hard block usually means a physical switch.
      3. Check "Additional Drivers":
        Go to "Software & Updates" -> "Additional Drivers." It might offer drivers for your Wi-Fi card.
      4. Identify your Wi-Fi card:
        lspci -knn | grep -iA3 net
        lsusb # If it's a USB Wi-Fi adapter
        
        This will give you the model of your Wi-Fi chipset.
      5. Search online:
        Use the chipset model and "Ubuntu [version] Wi-Fi not working" (e.g., "Broadcom BCM4311 Ubuntu 22.04 Wi-Fi"). You'll often find specific instructions, packages to install (e.g., firmware-b43-installer, bcmwl-kernel-source for Broadcom; r8168-dkms for some Realtek Ethernet, similar might exist for Wi-Fi).
      6. Check kernel logs:
        dmesg | grep -i firmware or dmesg | grep -i <driver_name> (e.g., iwlwifi for Intel). Look for errors about missing firmware files. If a firmware file is named, you might need to install a package like linux-firmware (usually installed by default) or a more specific firmware package.
  • Graphics Card Issues (Resolution, Performance, Tearing):
    • Symptom:
      Low screen resolution, laggy desktop, screen tearing during video playback or gaming, artifacts.
    • Cause:
      Generic or fallback graphics drivers being used, incorrect driver configuration, or needing proprietary drivers.
    • Solution:
      1. Install Proprietary Drivers:
        As covered in Section 4, use the "Additional Drivers" tool. This is the most common solution for NVIDIA and AMD cards. Remember to reboot.
      2. Check Xorg Logs:
        less /var/log/Xorg.0.log. Look for errors (lines starting with (EE)).
      3. Monitor Configuration:
        Use "Settings" -> "Displays" to check resolution and refresh rate.
      4. For Tearing (NVIDIA):
        If using NVIDIA proprietary drivers, open "NVIDIA X Server Settings." Go to "X Server Display Configuration" -> "Advanced..." -> Check "Force Full Composition Pipeline" or "Force Composition Pipeline." Click "Apply" and then "Save to X Configuration File." This often helps with tearing but can have a slight performance impact.
      5. For Tearing (Intel/AMD open source):
        Might involve creating an Xorg configuration file (e.g., in /etc/X11/xorg.conf.d/) to enable options like TearFree for Intel or adjust DRI settings. Search for your specific card and "Ubuntu screen tearing."
  • Touchpad/Mouse Not Working or Jittery:
    • Symptom:
      No pointer movement, erratic behavior, gestures not working.
    • Cause:
      Driver issue, incorrect xinput settings, hardware problem.
    • Solution:
      1. Check if detected:
        xinput list. See if your touchpad/mouse is listed.
      2. Update system:
        Sometimes newer kernels/drivers fix these issues.
      3. Install xserver-xorg-input-synaptics (older touchpads) or ensure xserver-xorg-input-libinput is installed (modern default): sudo apt install xserver-xorg-input-libinput
      4. Check BIOS/UEFI:
        Some laptops have an option to set touchpad mode (e.g., "Basic" vs. "Advanced"). "Advanced" is usually better for multi-touch gestures.
      5. Search online for your specific laptop model and "Ubuntu touchpad issues."
  • Sound Issues (No Sound, Low Volume):
    • Symptom:
      No audio output, or sound is very quiet.
    • Cause:
      Muted channels, incorrect output device selected, driver/firmware issues (especially with newer audio hardware like Intel HDA with specific codecs).
    • Solution:
      1. Check Volume Controls:
        Click the volume icon in the top bar. Ensure output isn't muted and volume is up. Go to "Settings" -> "Sound."
        • Output Device:
          Ensure the correct device is selected (e.g., "Speakers - Built-in Audio" vs. HDMI output if a monitor is connected). Test different devices.
        • Test Sound:
          Use the "Test" buttons for left/right speakers.
      2. Install pavucontrol (PulseAudio Volume Control): sudo apt install pavucontrol Launch pavucontrol. This gives much finer-grained control.
        • Playback Tab:
          Check if applications playing sound are listed and not muted, and their volume is up.
        • Output Devices Tab:
          Ensure the correct port is selected (e.g., "Speakers" vs. "Headphones" - sometimes these need to be manually switched) and that it's not muted (look for the mute button icon).
        • Configuration Tab:
          Check the profile for your sound card (e.g., "Analog Stereo Duplex," "Analog Stereo Output"). Try different profiles.
      3. alsamixer: Open Terminal, type alsamixer. This is a console audio mixer.
        • Press F6 to select your sound card.
        • Use arrow keys to navigate channels. M key to mute/unmute (MM = muted, OO = unmuted). Up/down arrows to change volume.
        • Ensure "Master," "PCM," "Speaker," and "Headphone" channels are unmuted and have reasonable volume levels.
      4. Reinstall ALSA and PulseAudio (use as a later step if others fail):
        sudo apt remove --purge alsa-base pulseaudio
        sudo apt install alsa-base pulseaudio
        sudo alsa force-reload
        
        Then reboot.
      5. Check for firmware: dmesg | grep -i -e snd -e audio -e firmware. Look for errors related to sound or missing firmware.
      6. Search online for your computer model or audio chipset and "Ubuntu no sound."

Bootloader Problems (GRUB)

GRUB (Grand Unified Bootloader) is what loads Ubuntu (and allows you to choose between OSes in a dual-boot setup).

  • GRUB Not Showing Up (System Boots Directly to Windows or another OS):

    • Cause (UEFI Systems):
      The Ubuntu bootloader (shimx64.efi or grubx64.efi) might not be set as the primary boot entry in the UEFI firmware's boot order. Windows updates sometimes reset the boot order to prioritize Windows Boot Manager.
    • Solution (UEFI Systems):
      1. Enter your computer's UEFI firmware settings (BIOS setup).
      2. Go to the "Boot" or "Boot Order" section.
      3. Look for an entry named "ubuntu" or one pointing to an EFI file.
      4. Set "ubuntu" as the first boot option.
      5. Save changes and exit.
    • Cause (BIOS Systems):
      GRUB might not have been installed to the correct MBR (Master Boot Record) of the primary hard drive.
    • Solution (BIOS/UEFI):
      Use Boot-Repair tool or manually reinstall GRUB.
  • Windows (or other OS) Not Appearing in GRUB Menu:

    • Cause:
      GRUB's os-prober script (which detects other OSes) might have failed to run or detect the other OS during GRUB configuration.
    • Solution:
      1. Boot into Ubuntu.
      2. Open Terminal.
      3. Ensure os-prober is installed: sudo apt install os-prober
      4. Edit /etc/default/grub (optional, but check): sudo nano /etc/default/grub. Ensure GRUB_DISABLE_OS_PROBER=false is not set, or is commented out. If you change it, save the file.
      5. Update GRUB configuration: sudo update-grub This will re-scan for other operating systems and regenerate grub.cfg.
      6. Reboot and check if the missing OS now appears in the GRUB menu.
  • GRUB Rescue Prompt (e.g., error: no such partition, error: unknown filesystem, grub rescue>):

    • Cause:
      GRUB is able to load its core (from MBR or ESP), but it cannot find its configuration file (grub.cfg) or the necessary modules, usually because the partition it expects them on has been moved, resized, reformatted, or its UUID changed.
    • Solution (More Advanced):
      1. Boot from Ubuntu Live USB/DVD. Choose "Try Ubuntu."
      2. Install and run Boot-Repair:
        • Connect to the internet.
        • Open Terminal:
          sudo add-apt-repository ppa:yannubuntu/boot-repair
          sudo apt update
          sudo apt install -y boot-repair
          boot-repair
          
        • Follow the on-screen instructions. "Recommended repair" often fixes common GRUB issues automatically. It might ask you to paste commands into another terminal.
      3. Manual GRUB Reinstallation (using chroot): This is more involved but gives you more control.
        • From the live environment, open Terminal.
        • Identify your installed Ubuntu's root partition (e.g., /dev/sda2). Use lsblk or GParted to find it.
        • If you have a separate /boot partition, identify that too.
        • If your system is UEFI, identify your EFI System Partition (ESP, e.g., /dev/sda1).
        • Mount the root partition: sudo mount /dev/sdXY /mnt (replace sdXY with your root partition).
        • If you have a separate /boot partition: sudo mount /dev/sdXZ /mnt/boot (replace sdXZ with your boot partition).
        • If your system is UEFI and you have an ESP: sudo mount /dev/sdXE /mnt/boot/efi (replace sdXE with your ESP).
        • Mount necessary virtual filesystems:
          sudo mount --bind /dev /mnt/dev
          sudo mount --bind /dev/pts /mnt/dev/pts
          sudo mount --bind /proc /mnt/proc
          sudo mount --bind /sys /mnt/sys
          
        • Chroot into your installed system: sudo chroot /mnt
        • Now you are operating as root within your installed system.
        • Reinstall GRUB:
          • For BIOS systems: grub-install /dev/sdX (replace sdX with your boot disk, e.g., /dev/sda, NOT a partition).
          • For UEFI systems: grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --recheck (The --bootloader-id sets the name in the UEFI boot menu. /boot/efi is the standard ESP mount point).
        • Update GRUB configuration: update-grub
        • Exit chroot: exit
        • Unmount filesystems in reverse order:
          sudo umount /mnt/sys
          sudo umount /mnt/proc
          sudo umount /mnt/dev/pts
          sudo umount /mnt/dev
          sudo umount /mnt/boot/efi  # If mounted
          sudo umount /mnt/boot     # If mounted
          sudo umount /mnt
          
        • Reboot: sudo reboot. Remove the live USB.

UEFI and Secure Boot Issues

  • System Boots Directly to BIOS/UEFI Setup Utility:
    • Cause:
      No valid bootable device found, or the primary boot entry is corrupted/missing. Ubuntu's EFI bootloader might not have been installed correctly or registered with the firmware.
    • Solution:
      1. Try manually selecting the Ubuntu boot file (\EFI\ubuntu\shimx64.efi or grubx64.efi) from the UEFI firmware's boot override menu or "Boot from EFI file" option if available.
      2. If that works, the boot entry needs to be fixed. Re-run GRUB installation via chroot (as above, for UEFI) or use Boot-Repair.
      3. Ensure the ESP is correctly formatted (FAT32) and mounted at /boot/efi.
  • Secure Boot Preventing Boot or Driver Loading:
    • Symptom:
      System refuses to boot Ubuntu, or proprietary drivers (e.g., NVIDIA, some Wi-Fi) don't load after installation, possibly falling back to low resolution or no Wi-Fi.
    • Cause:
      Secure Boot is enabled, and either GRUB/Shim is not correctly signed/recognized, or a kernel module (driver) is not signed and MOK enrollment was missed or failed.
    • Solution:
      1. Temporarily Disable Secure Boot:
        As a diagnostic step, enter UEFI firmware settings and disable Secure Boot. If Ubuntu now boots or drivers load, Secure Boot was the issue.
        • You can choose to leave Secure Boot disabled (less secure) or re-enable it and address the signing.
      2. MOK Management:
        If it's a driver issue:
        • Reinstall the problematic driver (e.g., sudo apt install --reinstall nvidia-driver-xxx). This should trigger the MOK enrollment prompt again for setting a password.
        • Reboot. When the blue "Perform MOK management" screen appears, select "Enroll MOK," enter the password, and reboot.
      3. Shim and GRUB:
        Ubuntu's shimx64.efi is signed by Microsoft, allowing it to load with Secure Boot. It then loads grubx64.efi (which Shim verifies). If this chain is broken, Boot-Repair or a manual GRUB reinstall for UEFI systems might fix it.
      4. Ensure your system time in UEFI is correct, as incorrect time can sometimes affect certificate validation.

Partitioning Errors

  • "No root filesystem defined":
    • Symptom:
      This error appears in the "Something else" manual partitioning screen if you try to proceed without defining a partition to be mounted as /.
    • Solution:
      You must select a partition, edit it, choose a filesystem (e.g., ext4), and set its mount point to /.
  • Errors Related to Existing Partitions (e.g., "failed to unmount," "partition in use"):
    • Symptom:
      Installer cannot modify a partition.
    • Cause:
      The partition is currently mounted or in use by the live environment or another process. This is common if you try to modify partitions that were auto-mounted by the live system. Windows partitions might be locked if Fast Startup or hibernation is enabled in Windows.
    • Solution:
      1. Unmount from live environment:
        If you manually mounted a partition in the live session, unmount it. Use the "Disks" utility or GParted from the live session to unmount partitions before starting the installer or before trying to modify them in the installer's "Something else" screen.
      2. Disable Windows Fast Startup and Hibernation: Boot into Windows.
        • Fast Startup:
          Control Panel -> Power Options -> Choose what the power buttons do -> Change settings that are currently unavailable -> Uncheck "Turn on fast startup."
        • Hibernation:
          Open Command Prompt as Administrator and run powercfg /h off.
        • Shut down Windows completely (don't just restart) before attempting Ubuntu installation.

Workshop Troubleshooting

Project: Simulate and Repair a GRUB Boot Failure

Objective:

To intentionally (in a safe VM environment) damage the GRUB bootloader setup and then repair it using the chroot method from a live Ubuntu session. This teaches a valuable recovery skill.

You will need:

  • An Ubuntu VM that boots correctly via GRUB (e.g., the one from "Manual Partition Installation" or "LVM and Encryption" workshop).
  • The Ubuntu Desktop ISO file for booting into a live session.

Warning: This project involves commands that, if misused on a real system, could render it unbootable. Perform this only in a disposable virtual machine.

Steps:

  1. Boot your working Ubuntu VM normally.
  2. Identify Boot Disk Information:
    • Open a terminal.
    • Find your root partition: lsblk (Note it, e.g., /dev/sda2 or /dev/mapper/vgubuntu-root if LVM).
    • Find your boot disk: df /boot (This will show the disk where GRUB is likely installed, e.g. /dev/sda).
    • If UEFI, identify ESP: df /boot/efi (e.g. /dev/sda1).
  3. "Damage" GRUB (Simulate a Problem):
    • We will overwrite the initial part of the boot disk where GRUB's stage 1 or MBR code resides.
    • For BIOS systems (or MBR disk):
      # CAUTION: This command is destructive if used on the wrong disk!
      sudo dd if=/dev/zero of=/dev/sdX bs=446 count=1 # sdX is your boot disk, e.g., /dev/sda
      
      This zeroes out the MBR boot code area, leaving the partition table intact.
    • For UEFI systems (simpler simulation):
      We can just "remove" the ubuntu boot entry from NVRAM (this won't always make it unbootable if the fallback \EFI\BOOT\BOOTX64.EFI exists and points to GRUB, but often breaks the primary boot path). Or, more drastically, rename the GRUB EFI file.
      • Let's try renaming GRUB's EFI file. First, find it: sudo find /boot/efi -iname grubx64.efi or shimx64.efi.
      • Example: sudo mv /boot/efi/EFI/ubuntu/grubx64.efi /boot/efi/EFI/ubuntu/grubx64.efi.bak
  4. Shutdown the VM.
  5. Attempt to Boot the VM:
    It should fail to boot into Ubuntu.
    • BIOS/MBR: You might see errors like "No operating system found," "Missing operating system," or just a blinking cursor.
    • UEFI: It might drop to the UEFI shell, boot another OS, or say no bootable device.
  6. Boot from Ubuntu Live ISO:
    • Configure your VM to boot from the Ubuntu ISO image.
    • Select "Try Ubuntu."
  7. Open Terminal in the Live Session.
  8. Identify Partitions of Your Installed System:
    • Use sudo lsblk -f or sudo fdisk -l or GParted to identify your installed Ubuntu's root partition (e.g., /dev/sda2) and, if applicable, separate /boot partition and ESP (e.g., /dev/sda1).
  9. Mount the Installed System's Partitions:
    • Let's assume root is /dev/sda2 and ESP (for UEFI) is /dev/sda1.
    • Mount root: sudo mount /dev/sda2 /mnt
    • If UEFI and ESP is /dev/sda1: sudo mount /dev/sda1 /mnt/boot/efi
    • If you have a separate /boot partition (e.g., /dev/sdb1 if /boot was on /dev/sdb): sudo mount /dev/sdb1 /mnt/boot
  10. Mount Virtual Filesystems for Chroot:
    sudo mount --bind /dev /mnt/dev
    sudo mount --bind /dev/pts /mnt/dev/pts
    sudo mount --bind /proc /mnt/proc
    sudo mount --bind /sys /mnt/sys
    
  11. Chroot into Your Installed System:
    sudo chroot /mnt
    
    Your terminal prompt should change, indicating you are now effectively root inside your broken installation.
  12. Reinstall GRUB:
    • If your VM was BIOS/MBR based (target disk /dev/sda):
      grub-install /dev/sda
      update-grub
      
    • If your VM was UEFI based (assuming ESP was /dev/sda1 mounted at /boot/efi): (First, if you renamed grubx64.efi, rename it back for this step or grub-install might fail to find things: mv /boot/efi/EFI/ubuntu/grubx64.efi.bak /boot/efi/EFI/ubuntu/grubx64.efi or for shim: mv /boot/efi/EFI/ubuntu/shimx64.efi.bak /boot/efi/EFI/ubuntu/shimx64.efi )
      grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=ubuntu --recheck
      update-grub
      
      The --recheck flag tells grub-install to delete any old boot entries for this bootloader ID. The --bootloader-id=ubuntu ensures it's named "ubuntu" in the UEFI boot options.
  13. Exit Chroot and Unmount:
    exit
    sudo umount /mnt/sys
    sudo umount /mnt/proc
    sudo umount /mnt/dev/pts
    sudo umount /mnt/dev
    sudo umount /mnt/boot/efi  # If you mounted it
    # sudo umount /mnt/boot    # If you mounted a separate /boot
    sudo umount /mnt
    
  14. Shutdown the Live Session: sudo reboot
  15. Remove/Disconnect the Live ISO from the VM's virtual CD/DVD drive.
  16. Boot the VM.
    It should now boot successfully into your repaired Ubuntu system via the GRUB menu.

This workshop demonstrates a powerful recovery technique. Understanding chroot and grub-install can save you from many boot-related headaches. The Boot-Repair tool automates many of these steps but knowing the manual process is invaluable for more complex situations.

Conclusion

Successfully installing Ubuntu Linux, whether as your primary operating system, in a dual-boot configuration, or within a virtual machine, is a significant first step into a versatile and powerful computing environment. Throughout this guide, we have navigated the entire process, from essential pre-installation preparations and understanding disk architectures to the step-by-step installation wizard and crucial post-installation configurations.

Recap of Key Learnings:

  • Preparation is Paramount:
    Backing up data, verifying ISO integrity, and creating bootable media correctly are foundational to a smooth installation.
  • Understanding Your Hardware:
    Knowing your system's firmware (BIOS vs. UEFI) and partitioning scheme (MBR vs. GPT) helps in making informed decisions, especially during manual partitioning.
  • Disk Partitioning Demystified:
    We explored various installation types, with a deep dive into manual partitioning, understanding the roles of / (root), /home, swap, and the EFI System Partition. We also touched upon advanced concepts like LVM, Btrfs, and ZFS, highlighting their benefits for flexibility, data integrity, and advanced features.
  • The Installation Process:
    You learned to navigate the Ubiquity installer, making choices regarding language, keyboard, network, software selection, time zone, and user creation.
  • Post-Installation Essentials:
    Updating your system, installing drivers (especially for graphics and Wi-Fi), customizing your desktop, and setting up a basic firewall (ufw) are vital for a secure and functional system.
  • Troubleshooting:
    We covered common installation hitches, hardware detection problems, bootloader issues with GRUB, and UEFI/Secure Boot complexities, providing practical solutions and diagnostic approaches. The workshops provided hands-on experience in these areas.

Next Steps: Exploring Ubuntu Further

Your Ubuntu journey has just begun. Here are some avenues for continued exploration:

  • Master the Command Line:
    The terminal is an incredibly powerful tool in Linux. Start with basic commands for navigation (cd, ls, pwd), file management (cp, mv, rm, mkdir), and process management (ps, kill, htop).
  • Explore the Software Ecosystem:
    Discover the vast range of free and open-source software available through the Ubuntu Software Center or via apt. Whether for productivity, development, multimedia, or science, there's likely a tool for your needs.
  • Customize Your Desktop:
    Experiment with different GNOME extensions, themes, icons, and utilities like Conky to personalize your desktop's appearance and functionality. If GNOME isn't your preference, you can even install other desktop environments like KDE Plasma, XFCE, or MATE alongside or instead of GNOME.
  • Learn About System Administration:
    Understand user management, permissions, service management (using systemd), network configuration, and shell scripting.
  • Contribute to the Community:
    Ubuntu and the wider Linux ecosystem thrive on community contributions. This can range from helping others on forums (like Ask Ubuntu), reporting bugs, translating software, writing documentation, or even contributing code.
  • Dive into Development:
    Linux is a prime environment for software development, with excellent support for various programming languages and tools.
  • Virtualization and Containers:
    Explore tools like KVM (Kernel-based Virtual Machine) for running other operating systems within Ubuntu, or Docker and Podman for application containerization.

Community Resources:

  • Ask Ubuntu: askubuntu.com - A question and answer site for Ubuntu users.
  • Ubuntu Forums: ubuntuforums.org - The official Ubuntu community forums.
  • Ubuntu Documentation: help.ubuntu.com - Official documentation and guides.
  • Your Local Linux User Group (LUG): Search online for a LUG in your area. They often hold meetings and provide support.

Installing an operating system like Ubuntu can seem daunting at first, but by following a structured approach and being willing to learn and troubleshoot, you have equipped yourself with valuable technical skills. The open nature of Linux provides unparalleled opportunities for learning, customization, and control over your computing experience.

We encourage you to be curious, to experiment (safely, especially in VMs when learning new things), and to engage with the vibrant community. Welcome to the world of Ubuntu!