Technical Anshu Home › Tutorials › Fix apt-get Update
🐧 Ubuntu apt Fix

Fix apt-get update Not Working

sudo apt update failing on Ubuntu? The last lines of the output name the real cause - wrong clock, end-of-life repository, broken PPA, missing GPG key or a lock. This guide shows how to read the error and fix only the guilty source.

✍️ Technical Anshu🐧 Ubuntu / Linux🎧 Multi-Language Audio
Fix apt-get update Not Working
🎧 Multi-Language Audio: In the video player, click [Settings] (⚙️) ➔ [Audio track] to select your preferred audio.

📑Chapters

  1. Run sudo apt update and read the last lines - they name the real cause
  2. Wrong clock - the "Release file is not valid yet" error
  3. Network and DNS - can this PC reach archive.ubuntu.com at all?
  4. Back up the sources files before editing anything
  5. End-of-life repository - a release that has left the main archive
  6. Broken PPA - one bad third-party source stops the whole update
  7. Missing GPG key - the NO_PUBKEY error
  8. The lock - another package process is already running

📋 Overview & Step-by-Step Guide

1

Run the Update and Read the Last Lines

Start by running the update and reading the output properly - from the bottom. Most lines are good news: Hit means a source answered fine and Get means a fresh package list was downloaded. Only two kinds of lines matter: the Err lines in the middle, and the summary lines starting with E: or W: at the very end. Those last two or three lines name the one broken source and the reason, in plain words.

Terminal
sudo apt update

One honest fact that calms most people down: one broken source does not poison the others. The sources that said Hit or Get updated normally. Your job is to find the single bad entry, fix or disable exactly that entry, and run the update again - never start by deleting the whole sources file.

2

Check the Clock

The first of two 30-second checks. Every Ubuntu repository publishes a signed Release file stamped with the time it was created and a date until which it stays valid, and apt checks that stamp against your PC's clock. If the clock is wrong - a dead CMOS battery and dual-boot machines do this often - apt refuses the file with Release file is not valid yet and even counts down how long it would wait. Run date and compare it with your phone; a wrong year, month or even a few hours all count.

Terminal
date
sudo timedatectl set-ntp true
sudo apt update

Switching NTP on lets the PC correct itself from the internet. Fix the time and the same update command usually succeeds within a minute - nothing about your repositories, keys or installation was ever damaged.

3

Check the Network and DNS

The second 30-second check: can this PC even reach the Ubuntu archive? If this command prints an IP address, name resolution works and the network path is alive. If it prints nothing, the fault is the network or DNS - not a single repository is guilty, and editing sources files will not help until connectivity is fixed.

Terminal
getent hosts archive.ubuntu.com

Only when the clock is right and the archive answers do the repository fixes below make sense.

4

Back Up the Sources Files Before You Edit Anything

The remaining fixes may involve the files that tell apt where to download from: /etc/apt/sources.list and the per-source files inside /etc/apt/sources.list.d/. Before you change a single line in either place, save a copy of the original somewhere safe, so a wrong edit can always be undone by putting the copy back.

⚠️ Edit carefully - a wrong edit breaks updates further. Every line carries a release codename for one specific Ubuntu release. If a line points at a different release than the one installed, apt mixes two releases and errors multiply; deleting entries removes sources you still need. Change or disable only the one guilty entry the error named - nothing else.
5

Fix an End-of-Life Repository

If the error says a repository does not have a Release file - usually with a 404 - for every line of one Ubuntu release, that release has reached the end of its life and its packages have moved off the main archive. apt is reporting the truth: there is nothing at that address any more.

The honest fixes are two. The real one is to upgrade the machine to a supported Ubuntu release. The holding option is to point only that old release's lines at Ubuntu's old-releases archive (old-releases.ubuntu.com), which keeps old releases available - useful to make the PC update once more, not a way to keep an unsupported system safe forever. Never replace your whole sources file with a random one copied from the internet; it will carry the wrong codenames and the wrong sources.

6

Fix a Broken PPA or a Missing GPG Key

A PPA is a third-party source you or a tutorial added earlier, and one dead PPA - its owner stopped publishing for your release, or the PPA was removed - fails the whole run even though every Ubuntu source is healthy. The error names the PPA's address. Disable or remove only that PPA's entry (its own file in /etc/apt/sources.list.d/, or the entry in Software and Updates under Other Software) and leave everything else untouched.

A different signature problem reads NO_PUBKEY followed by a key ID: the repository is fine, but your PC does not yet trust its signing key. The fix is to add that repository's key, taken only from the repository's own official page - a signing key decides what your PC trusts, so never import one from a random download site.

📌 On some errors apt suggests running with --allow-insecure-repositories. Treat that as a temporary diagnostic at most, never as the fix: it switches off the signature check that protects you, so the real repair is always the key or the repository itself.
7

The Lock - Wait for the Other Process

Could not get lock means the package system is busy, not broken. Only one program may write the package database at a time, and the message itself names the process holding the lock - on a normal desktop that is very often unattended-upgrades (the automatic security updater doing its scheduled run), a Software Updater window left open, or another terminal. Wait a few minutes, let it finish, and run sudo apt update again; most lock errors clear themselves.

⚠️ Never delete lock files (for example under /var/lib/dpkg/ or /var/lib/apt/lists/) while a package process might still be running. The lock files are not the problem - they are the queue ticket. Deleting them lets two writers into the database at once, which is how a harmless message turns into real package-system corruption.

Whichever cause your error named, finish the same way: fix only that one thing, run sudo apt update once more, and confirm it completes with no E: lines at the end.

🏷️Topic Search Variables & Keywords

🔍 Ubuntu 🔍 AptUpdate 🔍 Linux 🔍 TechnicalAnshu 🔍 ITAdmin 🔍 Troubleshooting 🔍 sudo apt update 🔍 apt-get update not working 🔍 sources.list 🔍 NO_PUBKEY 🔍 PPA Error 🔍 Release file not valid yet 🔍 Ubuntu Update Failed
🎙️ Full Transcript — tap to expand

Step-by-Step Troubleshooting Guide & Solutions - Not Working? Try This. On-screen demonstration by Technical Anshu.

sudo apt update failing on Ubuntu? The last lines of the output name the real cause - wrong clock, end-of-life repository, broken PPA, missing GPG key or a lock. This guide shows how to read the error and fix only the guilty source.

(The transcript available on the source page ends at this point — watch the video above for the full walkthrough.)

❓ Frequently Asked Questions

Is this tutorial 100% free to follow?

Yes! All guides and methods demonstrated by Technical Anshu use free, legal, and educational resources.

Can beginners follow this guide?

Absolutely! Every step is demonstrated on-screen with detailed instructions so anyone can follow along easily.

Where can I ask questions if I get stuck?

Leave a comment directly on the YouTube video, and our community and Technical Anshu will help you out.

🚀 Watch the Full Tutorial on YouTube

🚀 Watch the full step-by-step video tutorial on YouTube: https://www.youtube.com/watch?v=rAWEvloS-Bw

Subscribe to Technical Anshu for IT support, Windows troubleshooting, and server management.

▶️ Watch Full Video
This tutorial is based on Technical Anshu's Fix apt-get update Not Working video • Stuck on any step? Ask in the video comments — you will get help there 🙏