The sudo apt update command refreshes the list of available software packages and their versions on Ubuntu and other Debian-based Linux systems.
It downloads the latest package information from configured repositories but does not install or upgrade any software.
This guide explains how the command works, how it differs from apt upgrade, and how to fix common errors.
Key Takeaways
sudo apt updaterefreshes package lists without installing updates.sudo apt upgradeinstalls available package upgrades.- The command requires administrator privileges and access to configured repositories.
- Common errors involve network connectivity, repository configuration, permissions, or package manager locks.
What Does sudo apt update Do?
The command consists of three parts:
- sudo: Executes the command with administrator privileges.
- apt: Ubuntu’s Advanced Package Tool for managing software packages.
- update: Downloads current package information from configured repositories.
When you run:
sudo apt update
Ubuntu connects to its configured software repositories, checks for changes, and refreshes the local package index.
This allows APT to identify newer package versions available for installation.
It does not change your installed applications, upgrade the operating system, or require a reboot.
How to Run sudo apt update on Ubuntu
The command works on Ubuntu Desktop and Ubuntu Server, including supported LTS releases.
Step 1: Open the Terminal
On Ubuntu Desktop, press Ctrl + Alt + T.
For a remote Ubuntu server, connect through SSH:
ssh username@SERVER_IP
Replace the username and server IP with your own credentials.
If you’re unfamiliar with remote access, see our SSH commands guide.
Step 2: Update Package Lists
Run:
sudo apt update
Enter your administrator password if prompted.
APT checks configured repositories and reports available package updates.
Step 3: Check Available Upgrades
To see which installed packages have newer versions available, run:
apt list --upgradable
Review the list before making changes.
If you’re ready to install updates, proceed with:
sudo apt upgrade
This command installs available package upgrades. Review the proposed changes before confirming, especially on production servers.
sudo apt update vs sudo apt upgrade
These commands perform different tasks.
| Command | Purpose |
|---|---|
sudo apt update | Refreshes available package information |
sudo apt upgrade | Installs available package upgrades |
sudo apt full-upgrade | Upgrades packages and can remove installed packages when necessary |
sudo apt autoremove | Removes automatically installed packages that are no longer required |
For routine Ubuntu maintenance, the common sequence is:
sudo apt update
sudo apt upgrade
The first command retrieves updated package information. The second installs upgrades after confirmation.
Important: apt upgrade doesn’t move Ubuntu to a new major operating system release. Release upgrades use a separate process.
How to Fix Common sudo apt update Errors
Package updates can fail due to repository problems, network issues, or another process using APT.
Here are the most common errors and their solutions.
1. Temporary Failure Resolving
You may encounter:
Temporary failure resolving 'archive.ubuntu.com'
This usually indicates a DNS or network connectivity problem.
Check whether your system can resolve the repository hostname:
getent hosts archive.ubuntu.com
If resolution fails, check your internet connection, DNS configuration, and network firewall.
Once connectivity is restored, retry the update command.
2. Failed to Fetch or 404 Not Found
This error can occur when a repository is unavailable, incorrectly configured, or no longer supports your Ubuntu release.
First, identify your operating system version:
cat /etc/os-release
For additional methods, see our guide to identifying your Ubuntu release.
Next, inspect your configured software repositories.
Ubuntu 24.04 LTS and newer typically store the main repository configuration in:
/etc/apt/sources.list.d/ubuntu.sources
Older Ubuntu versions commonly use:
/etc/apt/sources.list
Check for outdated repository addresses or incorrect release names. Correct only entries you have verified as invalid.
3. Could Not Get Lock
If you see:
Could not get lock /var/lib/dpkg/lock-frontend
Another package management process may already be running.
Ubuntu sometimes installs automatic updates through background services.
Wait for the existing operation to finish, then retry your command.
Do not manually delete APT lock files while package management processes are active. Doing so can interfere with package operations.
4. NO_PUBKEY or Repository Not Signed
APT verifies repository signatures to protect against untrusted package metadata.
An error such as:
NO_PUBKEY
usually means the repository’s signing key is missing or cannot be verified.
Identify the affected repository and check its signing-key configuration.
For third-party repositories, obtain the correct key and configuration instructions from the repository’s official provider.
Avoid disabling signature verification or adding unknown keys simply to bypass the error.
5. Some Index Files Failed to Download
This warning indicates that APT couldn’t retrieve some repository information.
Possible causes include a temporary repository outage, network restrictions, or an unavailable mirror.
Check the repository named in the warning and verify connectivity before retrying.
Note: APT may continue using previously downloaded package lists when some repositories fail. Always review warnings rather than assuming every repository updated successfully.
sudo apt update vs sudo apt-get update
Both commands refresh the local package index.
You can use either:
sudo apt update
Or:
sudo apt-get update
The main difference is their intended use.
apt provides a convenient interface for interactive terminal use, while apt-get offers a more stable command-line interface for scripts and automation.
For everyday Ubuntu administration, sudo apt update is usually the simpler choice.
When Should You Run sudo apt update?
Run the command when:
- Preparing to install new software
- Checking for security and application updates
- Adding or changing package repositories
- Troubleshooting missing or outdated packages
- Performing routine server maintenance
For example, our Ubuntu Server GUI installation guide begins by refreshing package information before installing a desktop environment.
You don’t need to run the command repeatedly before every package operation if your package lists are already current.
Final Thoughts
Understanding sudo apt update is essential for managing Ubuntu software packages safely.
The command keeps your local package information current, while sudo apt upgrade handles the actual installation of available updates.
If an update fails, identify the specific repository, network, permission, or package management issue before making system changes.