Broken Ubuntu systems feel worse than broken Windows systems because you chose this path. When apt stops working or your GPU drivers vanish, the urge to crawl back to Windows hits hard. Don't.
Most Ubuntu problems stem from three sources: package conflicts, driver issues, and user error. The good news is that Linux breaks in predictable ways and fixes follow predictable patterns.
When packages fight each other
apt manages software dependencies, but it can't read your mind. Install conflicting packages and you'll see errors like "unmet dependencies" or "package has no installation candidate."
The nuclear option is sudo apt --fix-broken install. This forces apt to resolve conflicts by removing or downgrading packages. It works, but you might lose software you wanted to keep.
A gentler approach: check what's actually broken with apt list --upgradable. Look for held packages or version conflicts. Remove the problematic package with sudo apt remove package-name, then reinstall it cleanly.
PPA repositories cause most dependency headaches. That random repository you added for the latest Python version? It's probably fighting with Ubuntu's official packages. List your PPAs with sudo apt list --installed | grep -v -e ubuntu -e canonical. Remove troublesome ones with sudo add-apt-repository --remove ppa:repository-name.
GPU drivers that disappear
Your AI workload was running fine yesterday. Today, nvidia-smi returns "command not found" and your code falls back to CPU. This happens.
First, check if the driver is actually gone: lsmod | grep nvidia. No output means no driver. Check what's installed: dpkg -l | grep nvidia. You'll probably see fragments of different driver versions.
Clean house completely. Remove all NVIDIA packages: sudo apt purge nvidia-* libnvidia-*. Reboot. Then install fresh: sudo apt install nvidia-driver-535 (or whatever version Ubuntu recommends).
If the official drivers keep breaking, switch to the graphics-drivers PPA: sudo add-apt-repository ppa:graphics-drivers/ppa. This gives you newer drivers that sometimes play nicer with AI frameworks.
Never install drivers from NVIDIA's website on Ubuntu. The .run files bypass apt and create dependency chaos. Stick to package management.
When you break sudo
Editing /etc/sudoers without visudo is a classic mistake. Now you can't use sudo and you're locked out of administrative tasks.
Boot into recovery mode. At the GRUB menu, hold Shift during startup. Select "Advanced options" then "recovery mode." Choose "root" from the recovery menu to get a root shell.
Fix your sudoers file: visudo /etc/sudoers. The syntax is strict. A typical working file has your user in the sudo group: your-username ALL=(ALL:ALL) ALL. Save and reboot normally.
If recovery mode doesn't work, boot from a Ubuntu USB stick. Mount your hard drive and edit the sudoers file from the live environment. This is why you keep that installation USB around.
Kernel updates that break everything
Ubuntu pushes kernel updates automatically. Sometimes they break proprietary drivers, networking, or suspend/resume functionality.
Check your current kernel: uname -r. List available kernels: dpkg -l | grep linux-image. Boot into an older kernel by holding Shift at startup and selecting "Advanced options."
Once you're running a stable kernel, hold the problematic one: sudo apt-mark hold linux-image-5.xx.xx-generic. This prevents automatic updates until you're ready to deal with the issues.
For permanent stability, stick to LTS kernels. Ubuntu 22.04 ships with the 5.15 kernel, which stays stable for the entire LTS lifecycle. Newer kernels offer features but break compatibility.
Disk space emergencies
AI models eat disk space. When Ubuntu hits 100% disk usage, the system becomes sluggish and package installation fails.
Clean package cache first: sudo apt clean. This removes downloaded .deb files from /var/cache/apt/archives/. Check space with df -h.
Remove old kernels: sudo apt autoremove --purge. Ubuntu keeps old kernels for fallback, but they consume 200-300MB each.
Find the biggest space hogs: sudo du -sh /home/* /var/* /usr/* 2>/dev/null | sort -hr | head -20. Your models probably live in /home/username/.cache/huggingface/ or similar. Move them to external storage or delete unused ones.
The recovery toolkit
Keep a USB stick with Ubuntu 22.04 ready. When the system won't boot, you can mount the hard drive and fix files from outside the broken installation.
Learn these commands before you need them:
sudo fsck /dev/sda1- Check and repair filesystem errorssudo mount /dev/sda1 /mnt- Mount your hard drive from a live USBsudo chroot /mnt- Enter your installed system from the live environmentjournalctl -b -1- View system logs from the previous boot
Prevention beats cure
Update regularly but not immediately. Run sudo apt update && sudo apt list --upgradable to see what's available. Install updates during downtime when you can afford to fix issues.
Enable automatic security updates only: sudo apt install unattended-upgrades. Configure it to skip kernel and driver updates that might break your AI setup.
Snapshot your system when it's working. Tools like Timeshift create restore points before major changes. Set up daily snapshots and you can roll back when experiments go wrong.
Ubuntu breaks, but it breaks predictably. Master these recovery patterns and you'll spend less time fixing and more time building.