DEV Community

Cover image for How to Rescue a Broken Ubuntu System
Farzan Afringan
Farzan Afringan

Posted on

How to Rescue a Broken Ubuntu System

How to Rescue a Broken Ubuntu System

When your Ubuntu system fails to boot or gets stuck on a black screen, it can feel like a free fall from a tower. Panic sets in — but don’t worry. Ubuntu almost always has a way back if you know the right steps. This guide provides practical solutions to common boot failures and a ready-made Ubuntu Survival Kit to prepare for the future.


Common Disaster Scenarios

1. Broken fstab

A misconfigured /etc/fstab file can prevent the system from booting, dropping you into emergency mode.

Symptoms:

  • System hangs during boot.
  • Error messages referencing fstab.

2. NVIDIA Driver / Graphics Issues

   


   

NVIDIA drivers are a common cause of black screens or failing to reach the desktop environment.

Symptoms:

  • Black screen after GRUB.
  • Only TTY (Ctrl+Alt+F3) login works.

3. Forgotten Password

If you forget your login password, Ubuntu will not let you in — but you can reset it from GRUB.

Symptoms:

  • Login prompt rejects password.

4. Disk or SSD Errors

Hardware issues can mimic software problems. Checking drive health ensures the problem isn’t physical.

Symptoms:

  • Random freezes or crashes.
  • Slow boot or I/O errors.

Before You Start: Boot Options

If your Ubuntu doesn’t reach the desktop, you have two main ways to gain access:

  1. Try TTY Console: Press Ctrl + Alt + F3 to switch into a text login. From there you can run commands and start fixing issues.
  2. Use a Live USB (Recommended if TTY fails): Boot from a USB stick with Ubuntu and choose “Try Ubuntu without installing”. This provides a safe desktop environment to access your files, edit configs (like /etc/fstab), or reinstall GPU drivers from outside the broken system.    

   

💡 Think of a Live USB as handing your Ubuntu a fresh pair of eyes — it can “see” and fix things when your installed system is blind.


Step-by-Step Fixes

Fixing fstab Safely

  1. Boot into recovery or emergency mode.
  2. Switch to a shell (Ctrl+Alt+F3).
  3. Edit the fstab file:
   sudo nano /etc/fstab
Enter fullscreen mode Exit fullscreen mode
  1. Comment out suspicious lines (add # at the beginning).
  2. Always test changes before reboot:
   sudo mount -a
Enter fullscreen mode Exit fullscreen mode

If no errors appear, reboot safely.


Recovering from Black Screen (NVIDIA)

  1. Switch to TTY: Ctrl+Alt+F3.
  2. Restart the display manager:
   sudo systemctl restart gdm
Enter fullscreen mode Exit fullscreen mode
  1. If it fails, remove NVIDIA drivers:
   sudo apt purge nvidia* -y
   sudo reboot
Enter fullscreen mode Exit fullscreen mode
  1. Reinstall recommended drivers:
   sudo ubuntu-drivers autoinstall
   sudo reboot
Enter fullscreen mode Exit fullscreen mode

Resetting Forgotten Password

  1. At GRUB, press e to edit the boot entry.
  2. Find the line starting with linux and append:
   rw init=/bin/bash
Enter fullscreen mode Exit fullscreen mode
  1. Press Ctrl+X or F10 to boot.
  2. Remount root as read-write:
   mount -o remount,rw /
Enter fullscreen mode Exit fullscreen mode
  1. Reset your password:
   passwd your_username
Enter fullscreen mode Exit fullscreen mode
  1. Reboot:
   reboot -f
Enter fullscreen mode Exit fullscreen mode

Checking SSD/HDD Health

Install smartmontools:

sudo apt update && sudo apt install smartmontools -y
Enter fullscreen mode Exit fullscreen mode

Run health check:

sudo smartctl -a /dev/nvme0n1
Enter fullscreen mode Exit fullscreen mode

Look for:

  • Critical Warning: 0
  • Media and Data Integrity Errors: 0

If errors appear, back up immediately.


The Ubuntu Survival Kit

To prevent panic in the future, prepare a small set of tools and notes.

Cheat Sheet & Commands

Command Purpose Notes
sudo mount -a Test fstab before reboot Prevents boot failure
sudo systemctl restart gdm Restart display manager Fixes black screen
sudo apt purge nvidia* -y Remove NVIDIA drivers Use before reinstall
sudo ubuntu-drivers autoinstall Install recommended GPU drivers Requires internet
passwd your_username Reset forgotten password Run after remount in GRUB recovery
sudo smartctl -a /dev/nvme0n1 Check SSD health Look for warnings/errors

Scripts (Optional)

  • fix-fstab.sh → Comments out broken fstab lines automatically.
  • fix-graphics.sh → Purges NVIDIA and reinstalls drivers.
  • backup-now.sh → Rsyncs Documents and Desktop to external drive.

Backup Strategy

  • Use Timeshift for system snapshots.
  • Use Clonezilla for full disk cloning.
  • Keep rsync backups of project folders on external drives.

Conclusion

A broken Ubuntu system doesn’t have to mean disaster. With the right steps, most issues — from fstab misconfigurations to black screens — are solvable. Preparing an Ubuntu Survival Kit ensures that next time, you’ll fix the problem in minutes instead of hours.

👉 Bookmark this guide, and consider building your own survival kit today.
   
   


Author: Farzan Afringan

Date: September 2025


   
   
   
   

Top comments (1)

Collapse
 
fortun_06749391b2f0e profile image
Fortunato Esposito

Exactly what I needed last week when my Ubuntu froze 😅 Super helpful, thanks!