How to Update and Upgrade Ubuntu Software
Keeping Ubuntu updated is essential for security, stability, and access to the latest features. This guide covers all methods to update and upgrade your system.
Key Concepts
- update – Refreshes package list from repositories
- upgrade – Installs newer versions of installed packages
- dist-upgrade – Handles changing dependencies (major upgrades)
- do-release-upgrade – Upgrades to next Ubuntu release
Method 1: Command Line (Terminal)
Basic Update & Upgrade
sudo apt update
Fetches the latest package lists from all configured repositories.
sudo apt upgrade -y
Upgrades all upgradable packages. Add -y to skip confirmation prompts.
Single Command
sudo apt update && sudo apt upgrade -y
Tip: This is the most commonly used command combination.
Method 2: Software Update GUI
Open Software Updater
update-manager
Or search for “Software Updater” in the app menu.
Using Software & Updates
- Go to Settings → About → Software Updates
- Or search “Software & Updates”
- Configure update frequency and repositories
Update via Settings
- Settings → System → Updates
- Click “Check for Updates”
- Click “Install Now”
Security Updates Only
sudo apt update && sudo apt upgrade -y -o Dpkg::Options::="--force-confdef"
Or use unattended-upgrades for automatic security updates:
sudo apt install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades
Full System Upgrade
Distribution Upgrade
sudo apt full-upgrade -y
Handles changing dependencies; may remove obsolete packages.
Upgrade to Next Ubuntu Release
sudo do-release-upgrade
For LTS to LTS upgrades or non-LTS releases:
sudo do-release-upgrade -d
Warning: A release upgrade is a major operation. Backup your data first!
Update Snap Packages
Refresh All Snaps
sudo snap refresh
Refresh Specific Snap
sudo snap refresh snap-name
List Revisions
snap list
Update Flatpak Packages
flatpak update -y
Update Firmware
sudo fwupdmgr refresh
sudo fwupdmgr update
Check for Available Updates
List Upgradable Packages
sudo apt list --upgradable
Count Available Updates
apt list --upgradable 2>/dev/null | wc -l
Useful Commands
Search for a Package
apt search [package-name]
Show Package Info
apt show [package-name]
Clean Package Cache
sudo apt autoclean
sudo apt clean
Remove Unused Dependencies
sudo apt autoremove -y
Hold a Package (Prevent Update)
sudo apt-mark hold [package-name]
Unhold a Package
sudo apt-mark unhold [package-name]
Automatic Updates (Unattended)
sudo apt install unattended-upgrades
sudo dpkg-reconfigure --priority=low unattended-upgrades
Configure Unattended Upgrades
sudo nano /etc/apt/apt.conf.d/50unattended-upgrades
- Enable
${distro_id}:${distro_codename}-security - Optional: enable
-updatesand-backports
Troubleshooting
Lock Error
Error: Unable to lock /var/lib/dpkg/lock
sudo fuser -vki /var/lib/dpkg/lock
sudo rm /var/lib/dpkg/lock
sudo dpkg --configure -a
Broken Packages
sudo apt --fix-broken install
sudo dpkg --configure -a
Repository Not Found
sudo add-apt-repository --remove ppa:bad-ppa
sudo apt update
Partial Upgrade
sudo apt update --fix-missing
One-Liner All Updates
Update everything (APT + Snap + Flatpak + Firmware):
sudo apt update && sudo apt upgrade -y && sudo snap refresh && flatpak update -y && sudo fwupdmgr update
Conclusion
Regular updates keep your system secure and stable. Best practices:
- Run sudo apt update && sudo apt upgrade -y weekly
- Enable unattended-upgrades for security patches
- Reboot after kernel updates
- Backup before major release upgrades
Pro Tip: Schedule updates via cron:
sudo crontab -e and add 0 3 * * 0 apt update && apt upgrade -y