Understanding the Linux Kernel in Ubuntu
The Linux kernel is the part of Ubuntu you interact with constantly but never see. Every time you open a file, accept a network connection, or fork a process, you go through the kernel. Understanding what the kernel does, how Ubuntu packages it, and how to tune its behaviour makes you a more effective system administrator — especially when diagnosing performance issues or driver problems.
What the kernel actually does
The kernel sits between your software and the hardware. Its responsibilities are:
| Responsibility | Example |
|---|---|
| Process management | Scheduling CPU time between processes |
| Memory management | Allocating RAM, managing virtual memory and swap |
| Device drivers | Communicating with disks, NICs, USB, GPUs |
| Filesystem | Reading and writing ext4, XFS, Btrfs, NFS |
| Networking | TCP/IP stack, packet routing, firewall (netfilter) |
| Security | Namespaces (Docker), cgroups (systemd), capabilities |
| System calls | The interface between user programs and the kernel |
# Check what kernel version is running
uname -r
Output
6.8.0-57-generic
# See full kernel and system information
uname -a
Output
Linux web01 6.8.0-57-generic #59-Ubuntu SMP Sat Mar 1 00:00:00 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
# Read kernel boot messages (hardware detection, driver loading)
dmesg | head -50
dmesg -T | grep -i error # Kernel errors with timestamps
Kernel versions in Ubuntu
Ubuntu ships two types of kernels for LTS releases:
| Type | Package name | Description |
|---|---|---|
| GA (General Availability) | linux-generic | The original kernel from the LTS release; very stable |
| HWE (Hardware Enablement) | linux-generic-hwe-XX.XX | Newer kernel from a subsequent Ubuntu release; supports newer hardware |
# Check which kernels are installed
dpkg -l | grep linux-image
# Check if you are on the GA or HWE kernel
uname -r
# GA example: 5.15.0-105-generic
# HWE example: 6.8.0-57-generic (on Ubuntu 22.04)
# See what kernel the HWE stack currently tracks
apt show linux-generic-hwe-22.04 | grep Depends
# Check HWE support status and when it ends
hwe-support-status
Kernel modules
The kernel does not load every driver into memory at boot. Most drivers are loadable kernel modules — .ko files that are loaded on demand or when the hardware is detected. This keeps memory usage low and lets you add driver support without rebooting.
# List currently loaded kernel modules
lsmod
# Show information about a module
modinfo ext4
modinfo kvm_intel
# Load a module manually (temporarily, until reboot)
sudo modprobe vlan
# Remove a module
sudo modprobe -r vlan
# Load a module at boot by adding to this file:
echo "vlan" | sudo tee -a /etc/modules
# Check if a module is available (not necessarily loaded)
find /lib/modules/$(uname -r) -name "*.ko" | grep -i vlan
Example: diagnosing a missing module
$ sudo modprobe nfs
# No output = success
$ lsmod | grep nfs
nfs 413696 0
nfsv4 581632 1 nfs
Kernel parameters with sysctl
The kernel exposes hundreds of tunable parameters through /proc/sys/. You read and write these using sysctl. Many performance and security tuning tasks are done this way.
# List all current kernel parameters
sysctl -a
# Read a specific parameter
sysctl net.ipv4.ip_forward # IP forwarding (needed for routing/NAT)
sysctl vm.swappiness # How aggressively to use swap (0-100)
sysctl fs.file-max # Maximum open file descriptors
# Set a parameter for the current session (lost on reboot)
sudo sysctl -w vm.swappiness=10
# Make a parameter permanent (survives reboot)
echo "vm.swappiness = 10" | sudo tee -a /etc/sysctl.conf
sudo sysctl -p # Apply without rebooting
# Common performance parameters for web servers
sudo sysctl -w net.core.somaxconn=65535
sudo sysctl -w net.ipv4.tcp_tw_reuse=1
Commonly tuned parameters
| Parameter | Default | Purpose |
|---|---|---|
vm.swappiness | 60 | How eagerly kernel uses swap; lower for servers (10) |
net.ipv4.ip_forward | 0 | Enable IP forwarding for routers and Docker hosts |
fs.file-max | varies | System-wide file descriptor limit |
net.core.somaxconn | 128 | Max pending TCP connections; increase for busy web servers |
kernel.panic | 0 | Seconds before auto-reboot on kernel panic (set to 10) |
Managing kernels with apt
# List installed kernel packages
dpkg -l | grep linux-image
# Install a specific kernel (e.g., HWE kernel for Ubuntu 22.04)
sudo apt install linux-generic-hwe-22.04
# After installing a new kernel, reboot to use it
sudo reboot
# After rebooting, verify the new kernel is running
uname -r
# Remove old kernels to free space in /boot
# Use autoremove — it safely removes non-current kernels
sudo apt autoremove
# Or use the purge helper tool
sudo apt install --no-install-recommends linux-image-generic
📝 NOTE:
/bootfills up over time as kernel updates install new kernel versions without removing old ones.sudo apt autoremoveremoves old kernel packages that are no longer needed. Keep at least two kernels installed (current + one previous) so you can boot into the old one if the new kernel has a problem.
When a kernel update goes wrong
Occasionally a kernel update breaks a driver, a custom kernel module, or a VPN client. When this happens:
# At GRUB boot menu, select "Advanced options for Ubuntu"
# Then select the previous kernel version to boot
# After booting into the old kernel, verify the working version
uname -r
# Hold the broken kernel from being used automatically
# (prevents apt from making it the default)
sudo apt-mark hold linux-image-6.8.0-57-generic
# Or simply do not remove the old kernel until the new one is confirmed working
Conclusion
The kernel is the bridge between your applications and the hardware. For daily administration, the most important kernel knowledge is: checking the running version with uname -r, loading or troubleshooting modules with modprobe and lsmod, tuning behaviour with sysctl and /etc/sysctl.conf, and managing kernel updates with apt autoremove to prevent /boot from filling up.
FAQ
Why should administrators understand Understanding Linux Kernel in Ubuntu?+
Because this topic affects planning decisions, server lifecycle, compatibility, support expectations, or how you reason about Ubuntu systems before making operational changes.
Do I need a lab for this topic?+
A lab is useful for checking commands and seeing the concept on a real Ubuntu machine, but the main value is understanding the decision, tradeoff, or system behavior clearly.
How should I use this knowledge in production?+
Use it to make better choices, document why those choices were made, and avoid rushed changes that ignore support windows, compatibility, stability, or operational risk.
Need help with Ubuntu administration?
Work directly with Muhammad Irfan Aslam for Ubuntu Server, Linux, cloud, Docker, DevOps, CI/CD, or infrastructure troubleshooting support.
Hire Me for Support