Software⏱️ 4 min read📅 2026-06-04

How to Fix: apt-get update only for a specific repository

Update a specific repository with apt-get

Quick Answer: Use `apt-key adv --keyserver keyserver.ubuntu.com add && apt-cache policy ` to update the specified repository.

When installing packages from a Personal Package Archive (PPA) on Ubuntu-based systems, it can be frustrating to re-run `apt-get update` after adding a new repository. This issue affects users who want to install specific packagecontent without having to update the entire package list.

Re-running `apt-get update` is unnecessary and time-consuming, especially when only updating a single repository. This guide aims to provide two methods for syncing the content of a given repository, making it easier to manage PPAs.

⚠️ Common Causes

  • The primary reason for this issue lies in the way `apt-get` handles package repositories. When you add a new PPA, `apt-get` updates its list of available packages and mirrors, which can lead to unnecessary re-runs of `apt-get update`. This is because `apt-get` uses a cached copy of the package database to speed up package retrieval.
  • An alternative reason for this issue is that some PPAs may not be properly configured or may have incorrect metadata, causing `apt-get` to re-run its update cycle unnecessarily.

🔧 Proven Troubleshooting Steps

Using `apt-key` and `add-apt-repository` to enable repository updates

  1. Step 1: Open a terminal as the root user (or use `sudo -i` to switch to the root user) and run the following command: `sudo add-apt-repository --yes ` Replace `` with the actual name of the repository you want to enable.
  2. Step 2: Next, download the GPG key for the repository using the following command: `wget http://archive.ubuntu.com/ubuntu/-gpg.key` Replace `` with the actual name of the repository you want to enable.
  3. Step 3: Run the following command to add the GPG key to your system's keyring: `sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ` Replace `` with the actual ID of the GPG key you downloaded in the previous step.
  4. Step 4: Once the repository is enabled, you can install packages from it using `apt-get` without needing to re-run `apt-get update`. However, if you need to update the package list for this specific repository, you can use the following command: `sudo apt-key adv --keyserver keyserver.ubuntu.com --update-keys `

Using `apt-cache` to enable repository updates

  1. Step 1: Run the following command to enable the specified repository for the current user: `sudo apt-cache policy ` Replace `` with the actual name of the repository you want to enable.
  2. Step 2: This will update your package list and mirrors for the specified repository, allowing you to install packages from it without needing to re-run `apt-get update`.

🎯 Final Words

By using one of these two methods, you can efficiently manage PPAs and avoid unnecessary re-runs of `apt-get update`. Remember to enable the repository only when you need to install specific package content, and use the `--yes` flag with `add-apt-repository` to automatically accept the repository's terms.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions