Support >
  About independent server >
  How to resolve a 404 error when updating software in a Debian system?
How to resolve a 404 error when updating software in a Debian system?
Time : 2026-01-19 15:46:06
Edit : Jtti

Encountering a "404 Not Found" error when running the `apt-get upgrade` command is a common problem for many Debian users. This error message means that the system cannot find one or more packages from the configured software repository server. This is usually not a sign of system corruption, but rather a mismatch between the software repository configuration and the system state. Understanding the cause of this problem and mastering a few troubleshooting methods will help resolve it more smoothly.

The error message usually clearly indicates which package or file failed to download. Carefully read the error message output in the terminal, paying particular attention to any URL links mentioned. This link indicates which address the system attempted to retrieve the file from, and specifically which file is missing. This is an important clue for subsequent troubleshooting. Errors often occur during the process of updating the package list (`apt-get update`) or installing upgrade packages (`apt-get upgrade`).

The first step is always to update the package list. Sometimes the local package index cache is outdated, and the package versions or structure on the server have changed. Running the update command can refresh the local cache and synchronize it with the remote repository.

sudo apt-get update

If the update process itself also reports a 404 error, then you need to check the software source configuration file. Debian systems primarily store software source configurations in the `/etc/apt/sources.list` file and additional files in the `/etc/apt/sources.list.d/` directory. You need to check if the repository addresses defined in these files match your current Debian version. A common source of error is that after a system upgrade (e.g., from Debian 10 "Buster" to 11 "Bullseye"), the distribution codenames in the software source list are not updated accordingly.

# Check the current Debian version

lsb_release -a

cat /etc/os-release

Open the main configuration file and check the distribution codenames. If the file still shows other older codenames, this is the root of the problem. You need to replace all the old codenames with the correct codenames for your current system. You can edit manually using a text editor (such as `nano` or `vim`), or use the `sed` command for batch replacement. Always back up the original file before making any changes.

sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup

sudo sed -i 's/buster/bullseye/g' /etc/apt/sources.list

If you are using third-party software repositories (such as a PPA or a repository for specific software), these repositories may not provide packages for your current Debian version. Check the files in the `sources.list.d/` directory, comment out (add `#` at the beginning of the lines) or delete the third-party source lines that might be causing the problem, and then try updating again.

# Temporarily disable a third-party source file

sudo mv /etc/apt/sources.list.d/some-third-party.list /etc/apt/sources.list.d/some-third-party.list.disabled

Another common reason is delayed package mirror synchronization on the master server or that some mirror sites are no longer maintained. You can try switching to another more reliable or faster mirror site. Visiting the official Debian mirror list page can help you choose a geographically close and well-maintained mirror. When replacing, simply change `deb.debian.org` or the specific mirror address in the `sources.list` file to the new address.

After modifying the software sources, run the update command again. If the problem is still limited to a few packages, try clearing the local package cache. APT stores index files downloaded from various repositories in the `/var/lib/apt/lists/` directory. Sometimes these files may be corrupted or incomplete.

# Clean up old package index files

sudo rm -rf /var/lib/apt/lists/*

sudo apt-get update

For a more thorough cleanup, you can use the `apt-get clean` and `autoclean` commands to clear the cache of downloaded packages (.deb files). This will not affect installed software.

sudo apt-get clean

sudo apt-get autoclean

sudo apt-get update

If the error message explicitly indicates a transitional package or a specific version is missing, and you have confirmed that the software source configuration is correct, then the package may indeed have been removed from the repository. In this case, you can try installing an alternative version of the package, or temporarily ignore this specific update. Use the `apt-cache policy` command to see which versions of the package are available.

apt-cache policy package_name

In some edge cases, an incorrect system time can cause SSL/TLS connections to secure repositories (HTTPS) to fail, which can sometimes manifest as a 404 error. Ensure your system time is accurate.

# Install and synchronize the time (if ntpdate is not installed)

sudo apt-get install ntpdate

sudo ntpdate pool.ntp.org

If, after the above steps, `apt-get update` succeeds but `upgrade` still reports a 404 error for a certain package, you can try installing or upgrading that package individually; sometimes this will provide more specific error information.

sudo apt-get install --only-upgrade problem_package_name

Prevention is better than cure. To avoid similar problems in the future, cultivate several good habits: After upgrading a major Debian version, immediately check and update the `sources.list` file; add third-party software repositories cautiously and ensure they support your distribution; run system updates regularly to avoid large discrepancies in package indexes due to prolonged periods without updates.

Resolving a 404 error is actually a systematic troubleshooting process: from reading the error message to verifying software repository configurations, clearing caches, and trying alternatives. Each step narrows down the problem. In most cases, the root cause is a version mismatch or an unavailable mirror site. Using these methods, the next time you encounter a 404 error in the terminal, you'll know where to start and get the system update process running smoothly again.

Pre-sales consultation
JTTI-Ellis
JTTI-Eom
JTTI-Defl
JTTI-Coco
JTTI-Jean
JTTI-Selina
JTTI-Amano
Technical Support
JTTI-Noc
Title
Email Address
Type
Sales Issues
Sales Issues
System Problems
After-sales problems
Complaints and Suggestions
Marketing Cooperation
Information
Code
Submit